Skip to content

Export coded results as SPSS (.sav)

POST
/v2/export/sav
curl --request POST \
--url https://api.surveycoder.io/v2/export/sav \
--header 'Content-Type: application/json' \
--header 'X-Request-Id: 550e8400-e29b-41d4-a716-446655440000' \
--header 'x-api-key: <x-api-key>' \
--data '{ "project_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "question_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "layout": "columns_by_mention", "include_demographics": false }'

Generate an SPSS .sav file for a single question’s coded results. Requires the SPSS microservice to be running on the server side.

X-Request-Id
string format: uuid
Example
550e8400-e29b-41d4-a716-446655440000

Client-generated request ID for tracing. Returned as-is in the response X-Request-Id header.

Media type application/json

Options for SPSS .sav export.

object
project_id
required

Project to export.

string format: uuid
question_id
required

Specific question to export (SPSS export is single-question).

string format: uuid
layout

Data layout for the .sav file:

  • columns_by_mention — Separate variables for 1st, 2nd, 3rd mention.
  • binary_dummy — One 0/1 variable per code.
string
default: columns_by_mention
Allowed values: columns_by_mention binary_dummy
include_demographics

Include demographic variables in the .sav file.

boolean

SPSS .sav file download

Media type application/x-spss-sav
string format: binary
Content-Disposition
string
Example
attachment; filename="export-a1b2c3d4.sav"

Suggested filename for the download.

Request body failed validation.

Media type application/json

Standard error envelope.

object
success
required
boolean
error
required
object
code
required

Machine-readable error code. See the error reference for the full list.

string
message
required

Human-readable explanation of what went wrong.

string
request_id

Echo of the X-Request-Id header, when provided.

string format: uuid
doc_url

Link to documentation for this specific error code.

string format: uri
Example
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "responses array is required and must not be empty",
"doc_url": "https://docs.surveycoder.io/errors/validation-error"
}
}

Missing or invalid API key.

Media type application/json

Standard error envelope.

object
success
required
boolean
error
required
object
code
required

Machine-readable error code. See the error reference for the full list.

string
message
required

Human-readable explanation of what went wrong.

string
request_id

Echo of the X-Request-Id header, when provided.

string format: uuid
doc_url

Link to documentation for this specific error code.

string format: uri
Example
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "x-api-key header is required",
"doc_url": "https://docs.surveycoder.io/errors/unauthorized"
}
}

Resource not found.

Media type application/json

Standard error envelope.

object
success
required
boolean
error
required
object
code
required

Machine-readable error code. See the error reference for the full list.

string
message
required

Human-readable explanation of what went wrong.

string
request_id

Echo of the X-Request-Id header, when provided.

string format: uuid
doc_url

Link to documentation for this specific error code.

string format: uri
Example
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Project not found",
"doc_url": "https://docs.surveycoder.io/errors/not-found"
}
}

SPSS microservice error

Media type application/json

Standard error envelope.

object
success
required
boolean
error
required
object
code
required

Machine-readable error code. See the error reference for the full list.

string
message
required

Human-readable explanation of what went wrong.

string
request_id

Echo of the X-Request-Id header, when provided.

string format: uuid
doc_url

Link to documentation for this specific error code.

string format: uri
Example
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "responses array is required and must not be empty",
"doc_url": "https://docs.surveycoder.io/errors/validation-error"
}
}

SPSS service not configured

Media type application/json

Standard error envelope.

object
success
required
boolean
error
required
object
code
required

Machine-readable error code. See the error reference for the full list.

string
message
required

Human-readable explanation of what went wrong.

string
request_id

Echo of the X-Request-Id header, when provided.

string format: uuid
doc_url

Link to documentation for this specific error code.

string format: uri
Example
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "responses array is required and must not be empty",
"doc_url": "https://docs.surveycoder.io/errors/validation-error"
}
}