Docs / JavaScript
Submit forms with fetch
The js artifact is the plain-HTML baseline plus a small enhancement script: it posts with fetch, reads the JSON response, and reports the outcome in a polite live region. Without JavaScript it still works as a normal form post.
1 — Create your endpoint
curl https://api.conform.centrst.com/v1/routes \
-H 'Content-Type: application/json' \
-d '{"email":"[email protected]","alias":"Contact"}'
2 — Fetch the ready-made form
curl 'https://api.conform.centrst.com/v1/routes/YOUR_FORM_ID/install?framework=js&raw=1' > contact-form.html
Paste the fragment into any page. It is unstyled semantic HTML — it inherits your site's styles — with labeled controls, autocomplete attributes, the spam honeypot, and a role="status" region announcing success or the API's human-readable error message.
3 — Confirm the inbox, then prove delivery
curl -sS -X POST https://api.conform.centrst.com/f/cfm_7K4P9X2M8RWD3JNH \
-d 'name=Test&[email protected]&message=Hello from a test&_test=true'
The destination inbox clicks one verification email; poll GET /v1/routes/YOUR_FORM_ID until status is "active". The _test response returns test: true as proof.
Sending JSON instead?
POST /f/YOUR_FORM_ID accepts a flat JSON object with Content-Type: application/json — same reserved fields, same responses. See the API reference.