Complete guide to integrating with Forms API
Start with 100 free submissions
Forms API lets you collect form submissions without building backend infrastructure. Create forms, get an endpoint, and start collecting data in minutes.
Create your account and set up your forms from the dashboard.
Design your form in the dashboard or use one of our templates.
Use our API to submit form data and view submissions in your dashboard.
Use this endpoint to submit data to your forms. Requires a valid Form ID and an active subscription.
No API key is required. Just include your formId in the request body.
Headers
Content-Type: application/jsonJSON Payload
{
"formId": "YOUR_FORM_ID",
"formData": {
"name": "John Doe",
"email": "john@example.com",
"message": "Hello from Forms API!"
}
}Note: Replace YOUR_FORM_ID with your actual Form ID from the dashboard.
200 OK
{
"success": true,
"remaining": 19
}The remaining field shows how many submissions you have left in your current billing period.
The API enforces your form's schema server-side. A required field is rejected if its value is null, undefined, a whitespace-only string, or an empty array. For select and radio fields, the submitted value must match one of the field's defined options. Validation failures return a 400 with an array of error messages:
400 Validation Error
{
"error": ["Name is required", "Plan must be one of Free, Pro, Enterprise"]
}Error Examples
// 400 - Bad Request
{ "error": "Missing fields" }
{ "error": ["Name is required", "Plan must be one of Free, Pro, Enterprise"] }
// 403 - Forbidden
{ "error": "This form is not currently accepting submissions.", "code": "SUBSCRIPTION_REQUIRED" }
{ "error": "This form restricts submissions to specific origins. Add your domain in the form settings.", "code": "ORIGIN_DENIED" }
{ "error": "Origin not allowed", "code": "ORIGIN_DENIED" }
{ "error": "Invalid origin", "code": "ORIGIN_DENIED" }
// 404 - Not Found
{ "error": "Form not found" }
// 410 - Gone
{ "error": "This form is no longer accepting submissions", "code": "FORM_ARCHIVED" }
// 429 - Too Many Requests
{ "error": "Submission limit exceeded (100). Upgrade your plan for more.", "code": "SUBSCRIPTION_LIMIT_EXCEEDED" }
{ "error": "Too many requests" }
// 500 - Internal Server Error
{ "error": "Server error" }| Code | Description |
|---|---|
| 200 | Success - Form submitted successfully |
| 400 | Bad Request - Missing fields or validation failed |
| 403 | Forbidden - Subscription inactive or origin denied |
| 404 | Not Found - Form not found |
| 410 | Gone - Form is archived |
| 429 | Too Many Requests - Rate limit or submission limit exceeded |
| 500 | Internal Server Error - Server error |
Basic cURL Request
curl -X POST https://apiforms.com/api/forms/submit \
-H "Content-Type: application/json" \
-d '{
"formId": "YOUR_FORM_ID",
"formData": {
"name": "John Doe",
"email": "john@example.com",
"message": "Hello from Forms API!"
}
}'Using fetch()
const response = await fetch("https://apiforms.com/api/forms/submit", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
formId: "YOUR_FORM_ID",
formData: {
name: "John Doe",
email: "john@example.com",
message: "Hello from Forms API!"
}
})
});
const result = await response.json();
console.log(result);Using requests library
import requests
response = requests.post("https://apiforms.com/api/forms/submit", json={
"formId": "YOUR_FORM_ID",
"formData": {
"name": "John Doe",
"email": "john@example.com",
"message": "Hello from Forms API!"
}
})
result = response.json()
print(result)Using cURL in PHP
<?php
$url = 'https://apiforms.com/api/forms/submit';
$data = [
'formId' => 'YOUR_FORM_ID',
'formData' => [
'name' => 'John Doe',
'email' => 'john@example.com',
'message' => 'Hello from Forms API!'
]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$result = json_decode($response, true);
echo json_encode($result, JSON_PRETTY_PRINT);
curl_close($ch);
?>Our documentation covers the basics, but if you need help implementing Forms API or have questions about advanced features, we're here to help.