A form backend your AI agent can set up from start to finish
Your agent reserves the form with one request and hands you a link to switch it on. After that it can change every setting, get code for any stack and fetch the privacy text, through REST or MCP.
Or let your agent start without one: it sends you the link.
curl -X POST https://formhaven.net/api/v1/start \
-H "Content-Type: application/json" \
-d '{"name": "Contact form on example.nl",
"site_url": "https://example.nl",
"client": "Claude Code"}'
How the agent does it
-
1
Reserve the form
One POST to https://formhaven.net/api/v1/start with a name. The answer holds the form address, a link for the site owner and a setup key. No account or key is needed.
-
2
Wire it into the site
The agent puts the address in the form's action straight away. Until the owner switches it on, a post gets a FORM_NOT_ACTIVE answer and nothing is stored.
-
3
The owner presses Activate
You open the link, create an account or log in, and press one button. The link works for 7 days.
-
4
The agent finishes the setup
The setup key now works as an API key on the REST API and the MCP server at https://formhaven.net/mcp: settings, code per stack, the privacy text and the submissions. It works for 30 days; after that, you create an API key in the dashboard.
Every MCP tool
Connect any MCP client to the server with an API key, or with the setup key once the form is active. This list is read from the server itself.
create_form
Create a form and get the endpoint URL to put in the HTML form's
action attribute. Counts toward the account's plan limit on
forms.
update_form
Change a form's name, website, thank-you page, how long
submissions are kept (or keep none), its webhook, the sites
allowed to post to it and its DidMyFormSend key. Send only the
fields to change. Setting a webhook returns the signing secret
for the FormHaven-Signature header. The key is never returned:
the form shows monitor.on and monitor.key_prefix.
get_form_code
Get ready-to-paste code for a form: plain HTML, a JavaScript
fetch call, a React component or an Astro component, with the
form's real address and the hidden spam trap filled in. Includes
the bot-check script line when the form has the bot check on.
get_privacy_text
Get the paragraph the website's privacy policy needs for this
form, in English, Dutch, German, French, Spanish, Italian,
Portuguese or Polish, filled in from the form's real settings:
who processes the messages, where they are stored, who sends the
emails and how long FormHaven keeps a copy. Also returns a
one-line notice to put above the form's submit button. Add the
paragraph to the site's privacy page and tell the site owner to
check it; it is not legal advice.
list_forms
List every form on the account with its id, endpoint URL, number
of real (non-spam) submissions and health: what stops its
messages reaching people and how to fix it. Each form also has a
report block: last month and this month so far, with a line the
site owner can paste into a client report. Plus the account
limits and how it is billed.
list_submissions
Read the newest submissions of one form, newest first. Set spam
to true to read what the spam filter caught instead.
add_recipient
Email a form's submissions to one more address, usually the site
owner's client. We email the address a confirmation link, and it
gets nothing until that is pressed. Calling it again for an
address that has not confirmed sends the link again. Up to 5
addresses per form.
remove_recipient
Stop emailing a form's submissions to an address added with
add_recipient. The account owner keeps getting them if
notify_owner is on.
update_form_emails
Set the sender name a form's recipients see (e.g. the agency's
name; empty uses the account name), whether the account owner
also gets each submission, whether confirmed recipients can read
the form's messages on a page linked from their emails, and
whether they also get a weekly email with last week's count and
that link. With notify_owner false and no recipient confirmed
yet, the owner still gets them, so nothing is lost. Ask the site
owner before turning recipients_can_view on: anyone the email is
forwarded to can open that link.
update_form_spam
Turn a form's bot check on or off and set its spam words. The
bot check is invisible to visitors: the page loads one script
(returned as bot_check_script) that solves a small puzzle before
the form sends, and posts without it go to spam. A submission
containing a spam word goes to spam too. Spam is kept, never
emailed.
retry_deliveries
Email a form's messages that did not arrive once more, after the
site owner fixed the address. list_forms shows them under health
as UNDELIVERED. Up to 50 per call and 3 calls an hour per form.
delete_form
Delete a form and every submission stored on it, for a client
site that is gone. The bill is per form, so it counts one form
fewer from that day. confirm must repeat the form's name
exactly. Ask the site owner before calling it: the submissions
cannot be brought back.
Every REST route
Send the key as Authorization: Bearer on every route except the start request. Errors come back as JSON with a message field.
POST /api/v1/start
Reserve a form without an account. Returns the endpoint, a link
for the site owner and a setup key.
GET /api/v1/start/{id}
With the setup key: whether the site owner has activated the
form yet.
GET /api/v1/forms
Every form on the account.
POST /api/v1/forms
Create a form.
GET /api/v1/forms/{id}
One form with its settings, recipients, health and monthly
report.
PATCH /api/v1/forms/{id}
Change any setting: name, website, thank-you page, retention,
store none, webhook, allowed sites, DidMyFormSend key, emails,
spam.
DELETE /api/v1/forms/{id}
Delete a form and its submissions. Send {"confirm": "<the form's
name>"}. Full API keys only. The bill counts one form fewer from
that day.
GET /api/v1/forms/{id}/submissions
Submissions, newest first; ?spam=1 for the spam list.
GET /api/v1/forms/{id}/privacy-text
The privacy-policy paragraph for the site; ?lang=en, nl, de, fr,
es, it, pt or pl.
POST /api/v1/forms/{id}/recipients
Email a form's submissions to another address, after it
confirms.
POST /api/v1/forms/{id}/recipients/{email}/resend
Send the confirmation link again.
DELETE /api/v1/forms/{id}/recipients/{email}
Stop emailing that address.
POST /api/v1/forms/{id}/deliveries/retry
Send the messages that did not arrive again, once the address
works. The health block of the form lists them.
POST /api/v1/forms/{id}/deliveries/rehearsal
Rehearse a refused message: saves a sample as refused by a
placeholder client address, emails the site owner the real
alert, and Send again then delivers the sample to the owner.
Never counted, billed or listed. 2 a day per form, 5 per
account.
Connect the MCP server
Clients that support OAuth need only the address: you sign in to FormHaven and press Allow. With a key, in Claude Code it is one command; other clients take the same address and header in their own config file.
claude mcp add --transport http formhaven https://formhaven.net/mcp \
--header "Authorization: Bearer YOUR_KEY"
What a form answers
A post with Accept: application/json gets {"ok": true} or {"ok": false} with an errors list in the shape Formspree uses, so existing JavaScript keeps working.
FORM_NOT_FOUND no form at this address
FORM_NOT_ACTIVE reserved by an agent, not switched on yet
FORM_PAUSED the owner's plan ended or covers fewer forms
EMPTY the post had no named fields
TOO_MANY_FIELDS more than 50 fields
TYPE_EMAIL the email field holds no valid address
Questions about this setup
- Does the agent need an account or an API key?
- No. It starts the form without one. The setup key it gets back works as an API key for 30 days once you have switched the form on. After that, create an API key on the API keys page and give it to the agent.
- Why does a person have to press Activate?
- So nothing a visitor sends is stored before someone has an account and has accepted our terms and data processing agreement, and so we never email an address a stranger typed in.
- What if nobody presses Activate?
- After 7 days the reservation lapses and the address stops answering. The agent can start a new one.
- Which agents does it work with?
- Any agent that can send an HTTP request: Claude Code, Cursor, Codex and others. For the MCP tools, any client that supports remote MCP servers over HTTP, either with a Bearer header or by signing in with OAuth.
- Can I connect without creating an API key?
- Yes, if your MCP client supports OAuth sign-in. Give it the server address, sign in to FormHaven when it asks and press Allow. The connection shows up on your API keys page, where you can end it.
- Where is the data stored?
- On our server at Hetzner in Falkenstein, Germany. A data processing agreement covers every account, and each form has its own retention, 1 to 365 days, or none.
More to read
Get your form address in a minute
14 days free, no card. Then €1 per form a month, €0.50 from the 11th form.