Plain HTML form
A form element whose action is the intake URL. No JavaScript, no API key, no server code; Turnstile is one div and one script tag.
Sample: samples/html-form (index.html, thanks.html, README).
The snippet
<form action="https://api.contactusiq.com/s/au_xxxxxxx" method="POST">
<label for="name">Name</label>
<input id="name" name="name" type="text" autocomplete="name" required>
<label for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email" required>
<label for="message">Message</label>
<textarea id="message" name="message" required></textarea>
<!-- Honeypot: hidden with CSS, not type="hidden", so bots that fill every text input fill it. Must stay empty. -->
<div style="position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden" aria-hidden="true">
<label for="_honeypot">Leave this field empty</label>
<input id="_honeypot" name="_honeypot" type="text" tabindex="-1" autocomplete="off">
</div>
<!-- Absolute URL of your thank-you page. Remove for the hosted thank-you page. -->
<input type="hidden" name="_redirect" value="https://example.com/thanks.html">
<!-- Optional subject prefix for the notification. -->
<input type="hidden" name="_subject" value="Website enquiry">
<!-- Cloudflare Turnstile: the managed widget injects a hidden cf-turnstile-response input. -->
<div class="cf-turnstile" data-sitekey="0x4AAAAAAA_PLACEHOLDER"></div>
<button type="submit">Send message</button>
</form>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>Steps
- Copy the form into your page. Keep
method="POST"; the browser's default encoding (application/x-www-form-urlencoded) is accepted. Addenctype="multipart/form-data"only if you need it; both work. - Replace
au_xxxxxxxwith your form id and0x4AAAAAAA_PLACEHOLDERwith the Turnstile site key from the Snippet screen. To skip Turnstile, delete thedivand the script; the form still works at stricter spam heuristics. - Set
_redirectto the absolute URL of your thank-you page, or remove it to use the hosted thank-you page. - Deploy on the verified domain.
Field names are free-form: add phone, company or anything else. Required fields and maximum lengths are defined on the form in the dashboard and enforced server-side; a missing required field returns 400.
How to test
- Submit from the page on the verified domain. Expect
303 See Otherwith aLocationheader to your thank-you page, or200with the hosted page when_redirectis absent. - The enquiry appears in the inbox with the visitor's IP, the page URL and the Turnstile outcome.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
200 or 303 but nothing in the inbox | Origin or Referer does not match a verified domain (opening the file locally or on localhost counts). Silent rejections return a success-looking response on purpose. Serve from the verified domain or allow any origin on the form for testing. |
| Turnstile shows an error | Wrong site key, or the domain is not listed on the Turnstile widget in Cloudflare. |
429 | 5 submissions per IP per form per 10 minutes. Wait for the seconds in Retry-After. |
400 | A required field is missing or the body is malformed; the body names the field. |
404 | Wrong form id, or the form is not published. |
413 | Body over 64 KB. |
Privacy line
Add a sentence under the form naming the owner and ContactUsIQ as processor and linking to both privacy policies, for example: "Your message is delivered by ContactUsIQ. It records your IP address to prevent abuse." The plain HTML form sets no cookies; Turnstile may set one for challenge state, which is strictly necessary for the challenge. See Privacy.