/smart-forms/:id/exportExport
Export completed smart form sessions as a CSV or Excel file
Overview
Exports all completed sessions for a smart form as a downloadable file. Supports CSV and XLSX formats. The response is a binary file stream with appropriate Content-Disposition headers — not a JSON envelope. Only COMPLETED sessions are included in the export.
Request
/smart-forms/:id/exportHeaders
| Header | Value |
|---|---|
Authorization | Bearer fxk_live_<your-api-key> |
Path Parameters
Query Parameters
Example Request
# Export as CSV
curl -X GET "https://api.formfex.com/api/v1/public/smart-forms/SMART_FORM_ID/export?format=csv" \
-H "Authorization: Bearer $FORMFEX_API_KEY" \
-o sessions.csv
# Export as XLSX
curl -X GET "https://api.formfex.com/api/v1/public/smart-forms/SMART_FORM_ID/export?format=xlsx" \
-H "Authorization: Bearer $FORMFEX_API_KEY" \
-o sessions.xlsxResponse
This endpoint returns a binary file stream, not a JSON body.
| Response Header | Value |
|---|---|
Content-Type | text/csv; charset=utf-8 (CSV) or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (XLSX) |
Content-Disposition | attachment; filename="<form-title>_sessions.csv" |
CSV Column Structure
| Column | Description |
|---|---|
Session ID | UUID of the session |
First Name | Respondent's first name |
Last Name | Respondent's last name |
Email | Respondent's email address |
Completion Type | natural or early_exit |
Questions Answered | Number of questions answered |
Completed At | ISO 8601 completion timestamp |
Error Response (JSON)
Error responses from this endpoint follow the standard BaseResponse envelope:
Error Cases
| Status | Description |
|---|---|
401 | Invalid or missing API key |
404 | Smart form not found or not owned by this API key |
Completed Sessions Only
The export includes only sessions with status COMPLETED. Active, analyzing, and expired sessions are excluded.
Empty Export
If no completed sessions exist, the CSV file will contain only the header row. The Content-Disposition filename is derived from the form title with non-alphanumeric characters replaced by underscores.
n8n
In n8n, this operation is available as Export Sessions under the Smart Form resource in the Formfex node.