API Reference
The Dooform API allows you to programmatically manage forms, responses, and other resources.
Base URL
All API requests should be made to:
https://api.dooform.com/v1
Authentication
Dooform uses API keys for authentication. Include your API key in the Authorization header:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.dooform.com/v1/forms
Getting Your API Key
- Go to your Account Settings
- Navigate to the API section
- Click "Generate New API Key"
- Copy and store your key securely
⚠️ Security Note: Keep your API key secure. Never expose it in client-side code or public repositories.
Rate Limits
The API is rate-limited to prevent abuse:
- 100 requests per minute for most endpoints
- 1000 requests per hour total
- Rate limit headers are included in all responses
Forms Endpoint
List All Forms
GET /forms
Response:
{
"data": [
{
"id": "form_123",
"title": "Contact Form",
"status": "published",
"created_at": "2024-01-15T10:30:00Z",
"response_count": 42
}
],
"pagination": {
"page": 1,
"per_page": 20,
"total": 5
}
}
Get Form Details
GET /forms/:id
Response:
{
"id": "form_123",
"title": "Contact Form",
"description": "Get in touch with us",
"status": "published",
"fields": [
{
"id": "field_1",
"type": "text",
"label": "Full Name",
"required": true
},
{
"id": "field_2",
"type": "email",
"label": "Email Address",
"required": true
}
],
"settings": {
"allow_multiple_responses": false,
"require_password": false,
"redirect_url": null
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T11:45:00Z"
}
Create a New Form
POST /forms
Request Body:
{
"title": "Feedback Form",
"description": "Share your feedback with us",
"fields": [
{
"type": "text",
"label": "Name",
"required": true
},
{
"type": "textarea",
"label": "Feedback",
"required": true
}
]
}
Responses Endpoint
List Form Responses
GET /forms/:form_id/responses
Query Parameters:
page- Page number (default: 1)per_page- Items per page (default: 20, max: 100)start_date- Filter responses from this dateend_date- Filter responses to this date
Response:
{
"data": [
{
"id": "response_456",
"form_id": "form_123",
"data": {
"field_1": "John Doe",
"field_2": "[email protected]"
},
"ip_address": "192.168.1.1",
"user_agent": "Mozilla/5.0...",
"submitted_at": "2024-01-15T14:30:00Z"
}
],
"pagination": {
"page": 1,
"per_page": 20,
"total": 42
}
}
Webhooks
Set up webhooks to receive real-time notifications when forms are submitted.
Webhook Payload
{
"event": "form.response.created",
"data": {
"response_id": "response_456",
"form_id": "form_123",
"form_title": "Contact Form",
"response_data": {
"field_1": "John Doe",
"field_2": "[email protected]"
},
"submitted_at": "2024-01-15T14:30:00Z"
}
}
Configuring Webhooks
- Go to your form settings
- Add your webhook URL in the Webhooks section
- Select the events you want to receive
- Save your settings
Error Handling
The API returns standard HTTP status codes:
200- Success201- Created400- Bad Request401- Unauthorized403- Forbidden404- Not Found429- Rate Limited500- Internal Server Error
Error Response Format:
{
"error": {
"code": "validation_error",
"message": "The title field is required.",
"details": {
"field": "title",
"value": null
}
}
}
Code Examples
JavaScript/Node.js
const axios = require('axios');
const client = axios.create({
baseURL: 'https://api.dooform.com/v1',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
// Get all forms
async function getForms() {
try {
const response = await client.get('/forms');
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
}
Python
import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
# Get all forms
response = requests.get(
'https://api.dooform.com/v1/forms',
headers=headers
)
if response.status_code == 200:
forms = response.json()
print(forms)
else:
print(f"Error: {response.status_code}")
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.dooform.com/v1/forms');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpCode === 200) {
$forms = json_decode($response, true);
print_r($forms);
}
curl_close($ch);
?>
SDKs
Official SDKs are available for popular programming languages:
Support
Need help with the API? Contact our developer support team:
- Email: [email protected]
- Discord: Join our community
- GitHub: Submit issues