Submit endpoint
The core API endpoint accepts form submissions. Any HTTP client or HTML form can use it.
POST https://formstodb.com/api/submit
Content-Type: application/x-www-form-urlencoded
OR
Content-Type: multipart/form-data
Required field
_key string Your form's API key (required)
All other fields are captured automatically
Any field you include is stored and shown in the lead panel. Common fields:
name string Lead's full name
email string Lead's email (enables Email button)
phone string Lead's phone (enables WhatsApp & Call)
message string Free-text message
company string Company name
... Any custom fields
Response
// Success
{ "ok": true, "lead_id": "uuid", "message": "Lead captured" }
// Error — invalid key
{ "ok": false, "error": "Invalid form key", "code": 401 }
// Error — limit reached
{ "ok": false, "error": "Submission limit reached", "code": 429 }
HTML form example
<form action="https://formstodb.com/api/submit" method="POST">
<input type="hidden" name="_key" value="YOUR_KEY">
<input type="text" name="name" required>
<input type="email" name="email" required>
<input type="tel" name="phone">
<textarea name="message"></textarea>
<button type="submit">Send</button>
</form>
JavaScript fetch example
const res = await fetch('https://formstodb.com/api/submit', {
method: 'POST',
body: new FormData(document.getElementById('myForm'))
});
const data = await res.json();
if (data.ok) {
// Show success message
} else {
// Handle error: data.error
}
CORS
The submit endpoint accepts requests from any origin — no CORS configuration needed on your end.
Webhook payload
When a webhook is configured, FormsToDB sends this payload to your URL within 1–2 seconds of a submission:
{
"event": "lead.created",
"lead_id": "uuid-v4",
"form_id": "uuid-v4",
"form_name": "Contact Form",
"name": "John Smith",
"email": "john@example.com",
"phone": "+34 612 345 678",
"data": { "all": "form fields", "here": true },
"ip_address": "1.2.3.4",
"referer": "https://yoursite.com/contact",
"user_agent": "Mozilla/5.0 ...",
"created_at": "2026-06-13T10:00:00.000Z"
}