Add a form to your site
Any HTML form works: point its action at your form's endpoint and use method="post". The fastest way to a form that matches your fields is the generator, which the CLI, the MCP tools and the dashboard all use.
Generate it
npx -y https://formto.io/dl/cli-latest.tgz init --yes --name "Quote request"init creates the form, sets its fields, writes formto-quote-request.html and allows submissions only from the site in package.json homepage. Agents call formto_generate_form_code for the same HTML or a React component.
What the generated form contains
- A
<label>for every field and the right input type (email,tel,url,number,date). - Radio buttons for four options or fewer, a
<select>above that. - The
_gotchahoneypot: hidden from people, filled by bots, dropped by formto. - A small script that submits with
fetchand shows a thank-you message. Without JavaScript the form still posts normally and formto shows its own thank-you page.
Generate, then restyle: change classes and layout freely, but keep the field names, the action URL and the honeypot.
Submit with JavaScript
The endpoint answers JSON when you ask for it, so your own script can show errors inline:
<form id="contact" action="https://api.formto.io/f/YOUR_FORM_ID" method="post">
<input name="email" type="email" required>
<textarea name="message" required></textarea>
<input type="text" name="_gotcha" tabindex="-1" autocomplete="off" aria-hidden="true" style="position:absolute;left:-10000px">
<button type="submit">Send</button>
<p id="contact-status" role="status"></p>
</form>
<script>
document.getElementById('contact').addEventListener('submit', async (event) => {
event.preventDefault()
const form = event.currentTarget
const res = await fetch(form.action, { method: 'POST', body: new FormData(form), headers: { Accept: 'application/json' } })
const body = await res.json()
document.getElementById('contact-status').textContent = body.success ? 'Thanks, we got it.' : body.error
})
</script>Thank-you pages
Set a success redirect on the form and formto sends the browser there after a normal (non-JavaScript) post, adding submission_id and status=success to the URL. Without one, formto shows a plain thank-you page.
See Works with for where the code goes on WordPress, Webflow, Squarespace, Shopify and others, and Templates for ready-made forms.