Answers

Retrieve and process survey responses

Answers & Reports

The API lets you retrieve survey summaries, detailed reports, filter and manage responses. You can hide answers, add tags and get survey analytics.

Download the markdown version of the "Answers & Reports" section for use in ChatGPT / other LLMs:

Get survey answer list

GET /quiz/{id}/answers

Returns a list of answers for a specific survey with date filtering and pagination.

Request parameters

Parameter Type Required Description
limit integer No Number of answers (default: 20)
offset integer No Pagination offset (default: 0)
date date No Date filter (format: Y-m-d)
is_complete boolean No Completion status filter (true/false)
sort string No Sort field (date_start, date_end)
order string No Sort direction (desc, asc)
Request example
curl -X GET "https://api.surveyninja.io/api/v3/service/quiz/123/answers?limit=50&offset=0&is_complete=true&sort=date_end&order=desc" \ -H "Authorization: Bearer YOUR_TOKEN"
API response
{ "success": true, "data": { "total": 150, "limit": 50, "offset": 0, "answers": [ { "id": "answer_1234567890", "quiz_id": "1234567890", "submitted_at": "2024-01-15T14:30:00Z", "is_complete": true, "ip_address": "192.168.1.1", "user_agent": "Mozilla/5.0...", "answers": [ { "question_id": "q1", "question_text": "How do you rate our service?", "answer": "Excellent", "answer_type": "single_choice" } ] } ] } }

Get survey summary

GET /quiz/{id}/summary

Returns the survey summary with key statistics.

Request example
curl -X GET https://api.surveyninja.io/api/v3/service/quiz/123/summary \ -H "Authorization: Bearer YOUR_TOKEN"
API response
{ "status": true, "summary": { "all_visited": 150, "filled_completely": 128, "started_not_finished": 22, "completion_rate": 85, "geography_visits": [ { "count": 45, "country": "Russia" } ], "visits_devices": [ { "device": "desktop", "percent": 65.2 } ], "all_average_transit_time": "04:18" } }

Get survey report

POST /quiz/{id}/report

Returns the report of answers for a specific survey with filtering.

Request parameters

Parameter Type Required Description
is_complete boolean No Completion status filter (true/false)
dateFrom string No Filter start date (format: dd.mm.yyyy)
dateTo string No Filter end date (format: dd.mm.yyyy)
filled string No Fill status: "completed", "incomplete"
widgets array No Array of question filters with parameters: widget_uuid, type, operator, value
scoreOperator string No Score filter operator: "greater", "less", "equal"
scoreValue integer No Score value for filtering
answerCorrect string No Answer correctness filter: "correct", "incorrect"
extraFields array No Array of extra fields with parameters: name, value
ip string No IP address for filtering
country array No Array of countries for filtering
browser array No Array of browsers for filtering
device array No Array of devices for filtering: "desktop", "mobile", "tablet"
tags array No Array of tags for filtering
Request example
curl -X POST https://api.surveyninja.io/api/v3/service/quiz/123/report \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "is_complete": true, "dateFrom": "01.01.2024", "dateTo": "31.01.2024", "filled": "completed", "widgets": [ { "widget_uuid": "550e8400-e29b-41d4-a716-446655440000", "type": "choiceSingle", "operator": "equal", "value": ["option-uuid-1", "option-uuid-2"] } ], "scoreOperator": "greater", "scoreValue": 80, "answerCorrect": "correct", "extraFields": [ { "name": "field_name", "value": "field_value" } ], "ip": "192.168.1.1", "country": ["Russia", "Ukraine"], "browser": ["Chrome", "Firefox"], "device": ["desktop", "mobile"], "tags": ["important", "needs attention"] }'
API response
{ "status": true, "data": { "report": [ { "widget_id": "550e8400-e29b-41d4-a716-446655440000", "title": "How do you rate our service?", "type": "rating", "count": 150, "average": 4.2, "avg_filling_time": 12.5, "answer_count": 150, "rowId": "row-123", "options": "{\"min\":1,\"max\":5,\"step\":1}", "filtered_data": "{\"1\":5,\"2\":10,\"3\":25,\"4\":60,\"5\":50}" } ], "answer_total_count": 150, "correct_answers": false, "answer_moderate_count": 5, "filters": [], "filters_count": 0, "answer_hide_count": 3, "answer_hide_amount": 150.00 } }

Get report filters

GET /quiz/{id}/filters/report

Returns available report filters.

Request example
curl -X GET https://api.surveyninja.io/api/v3/service/quiz/123/filters/report \ -H "Authorization: Bearer YOUR_TOKEN"
API response
{ "status": true, "data": { "dateFrom": "01.01.2024", "dateTo": "31.01.2024", "filled": "completed", "widgets": [ { "widget_uuid": "550e8400-e29b-41d4-a716-446655440000", "type": "choiceSingle", "operator": "equal", "value": ["option-uuid-1", "option-uuid-2"] } ] } }

Hide/show answer

POST /quiz/{id}/answer/{answer_id}/hide

Hides or shows a specific answer.

Request parameters

Parameter Type Required Description
is_hide boolean Yes true — hide answer, false — show answer
Request example
curl -X POST https://api.surveyninja.io/api/v3/service/quiz/123/answer/answer_123/hide \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "is_hide": true }'
API response
{ "status": true, "is_hide": true }

Add tags to answer

POST /quiz/{id}/answer/{answer_id}/tags

Adds tags to a specific answer for organization and filtering.

Request parameters

Parameter Type Required Description
tags array Yes Array of tags to add to the answer
Request example
curl -X POST https://api.surveyninja.io/api/v3/service/quiz/123/answer/answer_123/tags \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "tags": ["important", "needs attention", "problem"] }'
API response
{ "status": true, "result": { "created": [ { "id": 1, "name": "important" } ], "attached": [ { "id": 1, "name": "important" }, { "id": 2, "name": "needs attention" }, { "id": 3, "name": "problem" } ], "detached": [], "deleted": [] } }