Skip to content

Export coded results as Excel (.xlsx)

POST
/v2/export/excel
curl --request POST \
--url https://api.surveycoder.io/v2/export/excel \
--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_ids": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "layout": "wide_by_question", "include_categories": true, "include_sentiment": false, "include_confidence": true, "include_demographics": true, "include_code_dictionary": true }'

Generate an Excel file with coded results. Supports four layout modes and toggleable columns for categories, sentiment, confidence, and demographics. Includes a Code Dictionary sheet by default.

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 Excel or CSV export.

object
project_id
required

Project to export.

string format: uuid
question_ids

Specific question IDs to include. When omitted, all coded questions in the project are exported.

Array<string>
layout

Data layout:

  • wide_by_question — One row per respondent, codes as columns grouped by question.
  • columns_by_mention — One row per respondent, separate columns for 1st mention, 2nd mention, etc.
  • binary_dummy — One row per respondent, one 0/1 column per code.
  • one_row_per_code — One row per response-code pair (long format).
string
default: wide_by_question
Allowed values: wide_by_question columns_by_mention binary_dummy one_row_per_code
include_categories

Include category name column.

boolean
default: true
include_sentiment

Include sentiment column.

boolean
include_confidence

Include confidence column.

boolean
default: true
include_demographics

Include demographic/metadata columns from the original data.

boolean
default: true
include_code_dictionary

Include a Code Dictionary sheet (Excel only, ignored for CSV).

boolean
default: true

Excel file download

Media type application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
string format: binary
Content-Disposition
string
Example
attachment; filename="Brand Study.xlsx"

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"
}
}