# Posting response via API gives error when using multiple choice

**URL:** <https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194>\
**Category:** CSS Knowledge Bonanza! 🕺\
**Created:** [March 30, 2023, 11:31am UTC](https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194 "2023-03-30T11:31:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaron](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@aaron](https://community.surveysparrow.com/u/aaron)\
**Post date:** [March 30, 2023, 11:31am UTC](https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194/1 "2023-03-30T11:31:36Z")

</div>

I am trying to post a response using the V3 endpoint: https://api.surveysparrow.com/v3/responses

This works fine if I am posting a text answer, but if my answer is a multiple choice type then i get the following error:

```
"message": "Invalid value passed or missing values in payload"

```

This is an example of my post body:

{  
"survey\_id": 424967,  
"answers": [  
{  
"question\_id": 7115241,  
"answer": "Yes"  
}  
]  
}

I cant see anything in the documentation that is marked as required that i am missing from my request or anything that indicates what should be different for non text questions.

Any ideas?

---

<div class="post-metadata">

**Author:** ![SurveySparrow\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/community.surveysparrow.com/surveysparrow_support/32/322_2.png) [@SurveySparrow\_Support](https://community.surveysparrow.com/u/SurveySparrow_Support)\
**Post date:** [March 30, 2023, 11:59am UTC](https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194/2 "2023-03-30T11:59:41Z")

</div>

Hi Aaron,

We're glad to have you as part of our community! 👋

Regarding your question, for the "answer" parameter, you'll need to provide the corresponding choice ID.

Let me know if it works!! 😃

---

<div class="post-metadata">

**Author:** ![aaron](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@aaron](https://community.surveysparrow.com/u/aaron)\
**Post date:** [March 30, 2023, 12:08pm UTC](https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194/3 "2023-03-30T12:08:30Z")

</div>

Hi,

Thanks for the quick reply, unfortunately that doesnt seem to be working still, payload:

{  
"survey\_id": 4249456,  
"answers": [  
{  
"question\_id": 7115241,  
"answer": 18245279  
}  
]  
}

I have tried the ID as a string and as a number.

Thanks

---

<div class="post-metadata">

**Author:** ![SurveySparrow\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/community.surveysparrow.com/surveysparrow_support/32/322_2.png) [@SurveySparrow\_Support](https://community.surveysparrow.com/u/SurveySparrow_Support)\
**Post date:** [March 30, 2023, 12:41pm UTC](https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194/4 "2023-03-30T12:41:26Z")

</div>

Hi Aaron,

I apologize for not mentioning this earlier. It is necessary for us to pass the choice id in an array format. I have provided a snapshot below for your reference.

 ![Screenshot 2023-03-30 at 6.08.45 PM (2)](https://europe1.discourse-cdn.com/flex013/uploads/surveysparrow1/original/1X/ae94d088801fa7dc956935afb77db7b315a59d59.png)

Let me know if you have any questions! 🙂

---

<div class="post-metadata">

**Author:** ![aaron](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@aaron](https://community.surveysparrow.com/u/aaron)\
**Post date:** [March 30, 2023, 12:46pm UTC](https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194/5 "2023-03-30T12:46:10Z")

</div>

Perfect! works now thank you 🙂

---

<div class="post-metadata">

**Author:** ![Marsy\_Franco](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@Marsy\_Franco](https://community.surveysparrow.com/u/Marsy_Franco)\
**Post date:** [April 9, 2024, 5:47am UTC](https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194/6 "2024-04-09T05:47:51Z")

</div>

Hello, I am receiving the same error as Aaron and have tried the following payload similar to what is listed in your screenshot with no luck. I am changing the survey id and question id and answer for this post by removing the las 3 digits.

{  
"survey\_id": "514",  
"answers": [  
{  
"question\_id": 9163,  
"answer": [23729]  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![SurveySparrow\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/community.surveysparrow.com/surveysparrow_support/32/322_2.png) [@SurveySparrow\_Support](https://community.surveysparrow.com/u/SurveySparrow_Support)\
**Post date:** [April 9, 2024, 7:51am UTC](https://community.surveysparrow.com/t/posting-response-via-api-gives-error-when-using-multiple-choice/3194/7 "2024-04-09T07:51:27Z")

</div>

Hi Marsy,

Welcome aboard to the community! 😄

Expect an email from us shortly requesting more details.
