Documentation

Embed a form

HTML, fetch and cURL examples for the public form endpoint.

The public endpoint

Every form has a unique endpoint on your FormO host: POST /api/f/{endpoint}. It accepts JSON, urlencoded and multipart bodies. No API key or account session is needed — the endpoint itself is the credential. Rotate it from the forms list if it leaks; the old URL stops working immediately.

Delivery is asynchronous

The request only stores the submission. The delivery worker sends the email after the response, so a slow SMTP server never blocks your visitor.

HTML form

Paste this into your site and replace the endpoint and thank-you URL. Add your site origin in the form settings first.

html
<form action="https://your-formo-host/api/f/fmo_a1b2c3d4e5f6" method="POST">
<input name="email" type="email" required />
<textarea name="message" required></textarea>
<!-- Honeypot: keep hidden. -->
<input name="_gotcha" type="text" tabindex="-1" autocomplete="off" hidden />
<input type="hidden" name="_redirect" value="https://your-site.com/thank-you" />
<button type="submit">Send</button>
</form>

JavaScript fetch

Use JSON and Accept: application/json when you want to show your own success state. An Idempotency-Key makes double submits safe for 24 hours.

javascript
const res = await fetch("https://your-formo-host/api/f/fmo_a1b2c3d4e5f6", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
email: "visitor@example.com",
message: "Hello from my website",
}),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? "Submission failed");
console.log(data.id, data.duplicate);

cURL

bash
curl -X POST https://your-formo-host/api/f/fmo_a1b2c3d4e5f6 \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"email":"visitor@example.com","message":"Hello"}'

Fields and headers

FieldBehaviour
Any field nameStored in the submission data and rendered into the notification email.
_gotchaHoneypot. Keep it hidden; bots that fill it receive a fake success and no delivery.
_redirectOptional HTTPS URL on an allowed origin. Overrides the default thank-you page.
cf-turnstile-responseRequired only when the form has Turnstile enabled.

See the delivery guide for status codes and retry behaviour.

Thank-you page

A plain HTML post follows a 303 redirect to FormO's thank-you page. That page shows the confirmation, waits three seconds, then returns the visitor to the site they came from. A valid _redirect must be HTTPS and use an allowed origin; an invalid value falls back to the FormO page.

StatusMeaning
200Accepted. JSON body contains ok, id and optionally duplicate.
303HTML form post accepted; browser is redirected to the thank-you page.
403Origin is not allowed for this form.
410Form is inactive or deleted.
413Payload exceeds the form limit (default 64 KiB).
422Submission is empty.
429Rate limit reached; Retry-After is set.

Frequently asked questions

How do I embed a FormO form on any website?

Every form has a unique endpoint at POST /api/f/{endpoint}. Paste an HTML form whose action is that URL, add your site origin in the form settings, and include the hidden _gotcha honeypot and optional _redirect field. No API key or account session is needed.

Which body formats does the public endpoint accept?

It accepts JSON, urlencoded and multipart bodies. Use Accept: application/json when you want a JSON success response; an Idempotency-Key makes duplicate submits safe for 24 hours.

What does a 200 response from a FormO endpoint mean?

200 means the submission was accepted; the JSON body contains ok, id and optionally duplicate. HTML form posts return 303 and redirect to the thank-you page, while a 403 means the origin is not allowed for this form.