Retrieve and export survey responses. Access individual answers and export data as CSV, JSON, Excel or an SPSS package.
/surveys/:id/responsesRetrieve a paginated list of survey responses with answers.
| Name | Type | Description |
|---|---|---|
page | integer | Page number (default: 1) |
pageSize | integer | Items per page (1-100, default: 20) |
status | string | Filter: in_progress, completed, abandoned |
since | datetime | Filter responses after this date (ISO 8601) |
until | datetime | Filter responses before this date (ISO 8601) |
curl -X GET "https://surventrics.ai/api/v1/surveys/SURVEY_ID/responses?status=completed&pageSize=50" \
-H "Authorization: Bearer YOUR_API_KEY"{
"data": [
{
"id": "resp_550e8400-e29b-41d4-a716-446655440000",
"sessionId": "sess_abc123",
"status": "completed",
"startedAt": "2024-01-20T10:30:00Z",
"completedAt": "2024-01-20T10:35:00Z",
"deviceType": "mobile",
"country": "US",
"answers": [
{
"questionId": "q_001",
"questionTitle": "How satisfied are you?",
"value": "Very Satisfied",
"answeredAt": "2024-01-20T10:31:00Z"
},
{
"questionId": "q_002",
"questionTitle": "How likely are you to recommend us?",
"value": 9,
"answeredAt": "2024-01-20T10:32:00Z"
}
]
}
],
"pagination": {
"total": 142,
"page": 1,
"pageSize": 50,
"totalPages": 3,
"hasMore": true
}
}responses:read/surveys/:id/responses/exportExport all survey responses as a CSV or JSON file. Great for data analysis and backups.
| Name | Type | Description |
|---|---|---|
format | string | csv (default), json, xlsx, or spss. xlsx is an Excel workbook; spss is a zip containing data.csv, an import.sps syntax file that already points at it, and a README. |
status | string | Filter: completed (default) or all |
since | datetime | Export responses after this date |
until | datetime | Export responses before this date |
curl -X GET "https://surventrics.ai/api/v1/surveys/SURVEY_ID/responses/export?format=csv" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o responses.csvThe CSV includes metadata columns followed by one column per question, headed by the question's text. It is the same file the results page downloads:
Response ID,Started At,Completed At,Status,Duration (seconds),Device Type,Country,Quality Score,How satisfied are you?,How likely to recommend?
sess_abc,2024-01-20T10:30:00Z,2024-01-20T10:35:00Z,completed,300,mobile,US,0.95,Very Satisfied,9
sess_def,2024-01-20T11:00:00Z,2024-01-20T11:08:00Z,completed,480,desktop,UK,0.88,Satisfied,7curl -X GET "https://surventrics.ai/api/v1/surveys/SURVEY_ID/responses/export?format=json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o responses.json{
"survey": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "Customer Satisfaction Survey",
"slug": "customer-satisfaction-2024"
},
"questions": [
{ "id": "q_001", "title": "How satisfied are you?", "type": "single_choice" },
{ "id": "q_002", "title": "How likely to recommend?", "type": "nps" }
],
"responses": [
{
"response_id": "resp_001",
"respondent_id": "sess_abc",
"status": "completed",
"started_at": "2024-01-20T10:30:00Z",
"completed_at": "2024-01-20T10:35:00Z",
"device_type": "mobile",
"country": "US",
"quality_score": 0.95,
"q_001": "Very Satisfied",
"q_002": 9
}
],
"exportedAt": "2024-01-21T09:00:00Z",
"totalResponses": 142
}responses:export| Status | Description |
|---|---|
in_progress | Respondent started but hasn't completed the survey |
completed | Survey fully completed and submitted |
abandoned | Started but never completed (session expired) |
The value field type depends on the question type:
| Question Type | Value Type | Example |
|---|---|---|
| single_choice | string | "Option A" |
| multiple_choice | array | ["A", "B"] |
| nps, stars, slider | number | 8 |
| short_text, long_text | string | "Great service!" |
| ranking | array | ["B", "A", "C"] |
| matrix_single | object | {"row1": "col2", "row2": "col3"} |