GET/smart-forms/:id/export

Export

Export completed smart form sessions as a CSV or Excel file

Scope: SMART_FORMS_READ

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

GET/smart-forms/:id/export

Headers

HeaderValue
AuthorizationBearer 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.xlsx

Response

This endpoint returns a binary file stream, not a JSON body.

Response HeaderValue
Content-Typetext/csv; charset=utf-8 (CSV) or application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (XLSX)
Content-Dispositionattachment; filename="<form-title>_sessions.csv"

CSV Column Structure

ColumnDescription
Session IDUUID of the session
First NameRespondent's first name
Last NameRespondent's last name
EmailRespondent's email address
Completion Typenatural or early_exit
Questions AnsweredNumber of questions answered
Completed AtISO 8601 completion timestamp

Error Response (JSON)

Error responses from this endpoint follow the standard BaseResponse envelope:

Error Cases

StatusDescription
401Invalid or missing API key
404Smart 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.