Form Submission API
What an endpoint must do to receive a :::form. The document below is the OpenAPI 3.1 file that
@recit/form publishes (@recit/), generated from the same zod
schemas as the client and the reference server, and its examples are checked by the tests.
The prose version, with the TODO API checklist and the recipes, is in the docs:
Form submission API. Check your own
endpoint with recit form check-.
POST / Receive one submission of a form
| Name | In | Description |
|---|---|---|
Idempotency-Key | header | Sent with encoding=json only (it triggers a preflight). The same key is in meta.submissionId, or in _recit.submission for the default body. |
Request body
application/x-www-form-urlencoded · FlatSubmission
{
"name": "Lorem Ipsum",
"email": "lorem@example.com",
"mode": "remote",
"consent": "true",
"_recit.website": "",
"_recit.form": "signup",
"_recit.version": "1",
"_recit.locale": "en",
"_recit.submission": "3f2c0d8e-0000-4000-8000-000000000000",
"_recit.story": "meetup",
"_recit.elapsed": "8421",
"_recit.consent": "2026-10"
}multipart/form-data · FlatSubmission
application/json · Envelope
{
"form": "signup",
"version": 1,
"locale": "en",
"data": {
"name": "Lorem Ipsum",
"email": "lorem@example.com",
"mode": "remote"
},
"meta": {
"submissionId": "3f2c0d8e-0000-4000-8000-000000000000",
"story": "meetup",
"page": "https://example.com/meetup",
"elapsedMs": 8421,
"consent": {
"name": "consent",
"version": "2026-10",
"granted": true
},
"antispam": {
"honeypot": "",
"turnstile": null
}
}
}Responses
201 Accepted (200 and 202 are accepted too). A filled honeypot gets a 2xx too, without any processing.
Access-Control-Allow-Origin: One origin of the site (never * with credentials), on every response
application/json
{
"id": "sub_01",
"message": "Thanks, lorem ipsum."
}303 Accepted, submit=native: the browser follows Location to the success page
Location
400 Malformed body (JSON that does not parse)
401 Authentication needed (auth=publishable-key, or auth=bearer without an accepted token)
WWW-Authenticate: For auth=bearer: `Bearer realm="form"`, the token missing or not accepted
403 Origin or key refused
409 The same idempotency key with a different body
413 Too large
415 Content type refused
422 Validation: one entry of errors[] per field, its pointer and its code
application/problem+json
{
"type": "https://recit.dev/problems/validation",
"title": "Your answers need a correction",
"status": 422,
"detail": "One field is not valid.",
"errors": [
{
"pointer": "#/data/email",
"code": "format",
"detail": "Lorem ipsum."
}
]
}429 Too many requests
Access-Control-Allow-Origin: One origin of the site (never * with credentials), on every responseRetry-After: Seconds, or an HTTP date
application/problem+json
{
"type": "about:blank",
"title": "Too many requests",
"status": 429
}5XX Server error, generic: no personal data of another submission
OPTIONS / CORS preflight
Required only for encoding=json or an auth header: the default urlencoded and multipart bodies are simple requests, sent without a preflight.
Responses
204 The origin is allowed
Access-Control-Allow-Origin: One origin of the site (never * with credentials), on every responseAccess-Control-Allow-MethodsAccess-Control-Allow-HeadersAccess-Control-Expose-Headers
POST /uploads Give a ticket to send one file (upload=presigned)
Only for a form with upload=presigned. The client asks one ticket per chosen file, sends the bytes to the ticket's url (PUT with its headers, or POST with its fields then the file, as an object store's presigned URL or policy expects), then submits the ticket's file reference as the field's value, without multipart. The API checks the form, the field, accept= and max-size=, and binds the address to the asked size and type; an unknown reference in the submission is a 422 on its field (code format).
Request body
application/json · UploadRequest
{
"form": "apply",
"field": "cv",
"name": "lorem.pdf",
"type": "application/pdf",
"size": 182044,
"submissionId": "3f2c0d8e-0000-4000-8000-000000000000"
}Responses
201 The ticket: where the bytes go, and the reference to submit
Access-Control-Allow-Origin: One origin of the site (never * with credentials), on every response
application/json
{
"file": "up_01",
"url": "https://bucket.example.com/up_01?X-Amz-Signature=lorem",
"method": "PUT",
"headers": {
"Content-Type": "application/pdf"
}
}400 Not an upload request
401 auth=bearer without an accepted token: no ticket is given
WWW-Authenticate: For auth=bearer: `Bearer realm="form"`, the token missing or not accepted
403 Origin refused
413 Too large
415 Content type refused: application/json only
422 The form takes no presigned upload (#/form), or the file is refused on its field (accept, maxSize, enum)
429 Too many requests
501 This API takes no presigned upload
OPTIONS /uploads CORS preflight
Required only for encoding=json or an auth header: the default urlencoded and multipart bodies are simple requests, sent without a preflight.
Responses
204 The origin is allowed
Access-Control-Allow-Origin: One origin of the site (never * with credentials), on every responseAccess-Control-Allow-MethodsAccess-Control-Allow-HeadersAccess-Control-Expose-Headers