Skip to main content

Get Form Responses

Retrieve all responses submitted to a specific form in JSON format.

Endpoint

Authentication

Requires Clerk authentication. You can only access responses for forms you own.

Parameters

string
required
The UUID of the form whose responses you want to retrieve

Response

boolean
Always true for successful requests
string
The title of the form
number
Total count of responses
array
Array of response objects, ordered by submission date (newest first)

Example Request

Example Response

Error Responses

Source: app/api/forms/[id]/responses/route.ts:5

Export Responses

Export all form responses as a downloadable CSV file (or other formats in the future).

Endpoint

Authentication

Requires Clerk authentication. You can only export responses for forms you own.

Parameters

string
required
The UUID of the form whose responses you want to export
string
default:"csv"
Export format. Currently only csv is supported.

Response

Returns a file download with appropriate headers:
  • Content-Type: text/csv (for CSV format)
  • Content-Disposition: attachment; filename="{form-title}.csv"
The CSV file includes:
  • A header row with field names plus “Submitted At”
  • One row per response
  • Timestamp in ISO 8601 format

Example Request

Example CSV Output

Error Responses

Implementation Details

The export process:
  1. Validates user authentication and form ownership
  2. Retrieves the form title and user ID
  3. Fetches all responses for the form
  4. Formats responses with timestamps in ISO 8601 format
  5. Passes data to the appropriate exporter (CSV by default)
  6. Returns file with proper MIME type and download headers
Source: app/api/forms/[id]/export/route.ts:6

Export Formats

Currently supported formats:
  • csv - Comma-separated values (default)
The export system is designed to support additional formats in the future by adding new exporters to lib/exporter.ts.

Using with JavaScript