Docs
Form Submissions API
Official API reference maintained directly inside the SmartForm app.
SmartForm exposes a developer-first API for posting submissions to forms you own. Each request is authenticated with your personal API key so that externally created submissions stay traceable and secure.
Tip: Prerequisites
Generate your API key from Settings → Developer API access inside the SmartForm application. Each user receives a unique key and can rotate it at any time.
Base URL
https://smartform.dev/api/v1
All Form Submission endpoints live under /api/v1. Replace https://smartform.dev with your workspace domain when self-hosting.
Authentication
Provide your API key in one of the supported headers:
Authorization: Bearer <API_KEY>(recommended)X-API-Key: <API_KEY>
Keys are scoped to the user who owns the form. Requests with missing or invalid credentials return 401 Unauthorized.
Quick Start
Submit a response to an existing survey:
curl --request POST \
--url https://smartform.dev/api/v1/forms/YOUR_SURVEY_ID/submissions \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"fields": [
{ "questionId": "question_1", "value": "Very satisfied" },
{ "questionId": "question_2", "value": "user@example.com" }
]
}'
Submit responses
POST /forms/{formId}/submissions
Send batched answers for a survey or form you own. The formId matches the SmartForm survey ID and can be copied from the URL inside the builder.
Request Body
{
"submittedAt": "2024-04-05T16:03:12.000Z",
"fields": [
{
"questionId": "clwxyz12ab34",
"value": "Very satisfied"
},
{
"questionId": "clwxyz98zy76",
"values": ["Fast onboarding", "Helpful support"]
},
{
"questionId": "clwxyz77mn45",
"value": 9
}
],
"context": {
"pageUri": "https://example.com/signup",
"pageName": "Sign up"
}
}
Parameters
Submission Data
| Field | Type | Required | Description |
|---|---|---|---|
fields | array | Yes | Array of question responses |
fields[].questionId | string | Yes | ID of the question from SmartForm |
fields[].value | string/number/boolean | No* | Single answer value (mutually exclusive with values) |
fields[].values | array | No* | Multiple answer values for choice questions |
submittedAt | ISO-8601 string | No | Custom timestamp (defaults to API receive time) |
context | object | No | Metadata for analytics (currently ignored) |
Note: Each field must have either value or values, but not both.
Field Types
- Single Value: Use
valuefor text inputs, ratings, and single selections - Multiple Values: Use
valuesarray for multi-select choice questions - Data Types: Strings, numbers, and booleans are accepted; all values are stringified server-side
Validation Rules
- Answers cannot exceed 255 characters
- Question IDs must exist in the target survey
- Survey must be active (not archived)
- All required questions must have responses
Response
Success Response (200)
{
"submissionId": "clx0abc123",
"formId": "clwxyz12ab34",
"receivedAt": "2024-04-05T16:03:13.205Z",
"status": "accepted"
}
| Field | Type | Description |
|---|---|---|
submissionId | string | Unique identifier for the submission |
formId | string | The survey ID that received the submission |
receivedAt | ISO-8601 string | Timestamp when submission was processed |
status | string | Always "accepted" for successful submissions |
Error Responses
| Status Code | Error Type | Description | Solution |
|---|---|---|---|
400 | Bad Request | Invalid JSON, missing fields, or answers too long | Check payload structure and field limits |
401 | Unauthorized | Missing or invalid API key | Verify API key in request headers |
404 | Not Found | Survey ID doesn't exist or doesn't belong to user | Confirm survey ID and ownership |
409 | Conflict | Survey is inactive/archived | Reactivate survey in SmartForm |
500 | Internal Server Error | Server-side processing error | Retry with exponential backoff |
Common Issues:
- Question IDs must match exactly as defined in SmartForm
- Required questions cannot be omitted
- Choice questions may require
valuesarray instead of singlevalue - Timestamps must be valid ISO-8601 format
Code Examples
cURL
curl --request POST \
--url https://smartform.dev/api/v1/forms/YOUR_SURVEY_ID/submissions \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"fields": [
{ "questionId": "question_1", "value": "Very satisfied" },
{ "questionId": "question_2", "value": "user@example.com" },
{ "questionId": "question_3", "values": ["Option A", "Option C"] }
],
"submittedAt": "2024-04-05T16:03:12.000Z",
"context": {
"pageUri": "https://example.com/feedback",
"pageName": "Product Feedback"
}
}'
JavaScript (Node.js)
const response = await fetch('https://smartform.dev/api/v1/forms/SURVEY_ID/submissions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
fields: [
{ questionId: 'question_1', value: 'Excellent' },
{ questionId: 'question_2', value: 'user@example.com' },
],
submittedAt: new Date().toISOString(),
}),
});
const result = await response.json();
console.log('Submission created:', result.submissionId);
Python
import requests
import json
url = "https://smartform.dev/api/v1/forms/YOUR_SURVEY_ID/submissions"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"fields": [
{"questionId": "question_1", "value": "Very satisfied"},
{"questionId": "question_2", "value": "user@example.com"}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
result = response.json()
print(f"Submission ID: {result['submissionId']}")
Best Practices
Reliability
- Implement idempotent retries for network failures
- Use exponential backoff for rate limiting
- Validate survey IDs before sending submissions
- Store
submissionIdfor tracking and debugging
Data Integrity
- Match question types correctly (single vs. multiple values)
- Respect field length limits (255 characters max)
- Include all required question responses
- Use consistent timestamp formats
Security
- Never expose API keys in client-side code
- Rotate keys regularly via SmartForm settings
- Use HTTPS for all API communications
- Validate data before submission
Integration
- Log submission IDs to correlate with internal events
- Handle different response formats for various question types
- Consider batching multiple submissions when possible
- Monitor API usage and error rates
Need help? Contact support@smartform.dev for assistance.