Submission API

Collect submissions by POSTing JSON to the public submission endpoint. The server is the source of truth: every value is validated against the form's own field definitions, regardless of what the client sends.

Endpoint

POST /api/submit/{formId}
Content-Type: application/json

Request body

{
  "data": {
    "name": "Grace Hopper",
    "email": "[email protected]",
    "message": "I'd like a demo"
  }
}

data is a flat object keyed by field id (or field label for the simple case). Only the fields you defined on the form are accepted; unknown keys are ignored and required fields are enforced server-side.

Field validation

Each value is checked against the field's type and options:

  • Required fields must be present and non-empty.
  • Email fields must be a valid address.
  • Select / radio fields must match a defined option.
  • Numbers must parse as numbers.

Limits are enforced to prevent payload abuse: a maximum body size, a maximum number of fields, and a maximum length per field.

Responses

| Status | Meaning | | --- | --- | | 200 | Submission accepted. | | 400 | Validation failed (see details), or the captcha check failed (code: "CAPTCHA_FAILED"). | | 403 | Origin not authorized. | | 404 | Form does not exist or is not published. | | 429 | Rate limited. |

Validation errors return a structured body:

{
  "error": "Invalid request",
  "details": { "email": ["Invalid email address"] }
}

Bot protection (captcha)

Public forms are protected by a proof-of-work captcha that is hosted together with your forms: no third-party service sees your visitors, and the check is styled to match each form. The hosted form page shows it automatically.

Browser submissions include the resulting single-use captchaToken; the server verifies it before processing and rejects a missing, reused or invalid token with 400 and code: "CAPTCHA_FAILED". A form owner can turn the check off per form under Settings → Spam protection. Server-to-server calls using a scoped API key bypass the challenge — see Authentication.

Idempotency

To prevent duplicate submissions on retry or double-click, send a stable idempotencyKey. Two requests with the same (formId, idempotencyKey) insert once; the second returns the original result.

{
  "data": { "email": "[email protected]" },
  "idempotencyKey": "your-stable-request-id"
}

Example (JavaScript)

const res = await fetch(`/api/submit/${formId}`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    data: { name: "Grace Hopper", email: "[email protected]" },
    idempotencyKey: crypto.randomUUID(),
  }),
});

if (!res.ok) {
  throw new Error((await res.json()).error ?? "Submission failed");
}