For AI agents
How an agent integrates a site with ContactUsIQ. Read llms.txt, pick a sample, replace au_xxxxxxx, keep the honeypot, add Turnstile, test with curl.
This page is for coding agents integrating a website on someone's behalf. Everything here is also in the human pages; this is the short path.
Files to read first
| File | What it gives you |
|---|---|
| /llms.txt | An index of this site's pages with one-line summaries and links to the raw markdown. |
| /llms-full.txt | Every page of this site concatenated in reading order, with headings. One fetch, whole contract. |
| /openapi.yaml | OpenAPI 3.1 for the intake API and the planned management API. x-status: planned marks what is not live. |
| samples/README.md | The sample index, the shared contract and a "For AI agents" section per sample. |
The ContactUsIQ product spec is the source of truth behind these docs. Do not invent endpoints, fields or behaviour that are not in it.
The contract in one block
POST https://api.contactusiq.com/s/{formPublicId}
Content-Type: application/x-www-form-urlencoded | multipart/form-data | application/json
Reserved fields: _honeypot, _redirect, _subject, _intent, _rating, _page, cf-turnstile-response
Optional: _idempotency field or Idempotency-Key header (10 minutes)
Headers: Origin (or Referer) must be a verified domain; Accept: application/json for {ok, id}
Responses: 200 accepted or silently rejected, 303 redirect, 400 malformed, 404 unknown form, 413 too large, 429 rate limited with Retry-After
Rate limits: 5 per IP per form per 10 minutes; 60 per form per minuteProcedure
- Identify the stack of the site you are editing and pick the matching sample folder under samples/:
html-form,js-embed,json-fetch,react,nextjs,astro,wordpress-shortcode(orapps/wp-plugin),curl. Each has a README with numbered steps and a "For AI agents" paragraph. - Ask for, or locate, the form public id (
au_xxxxxxxin every sample) and, if the page renders Turnstile itself, the Turnstile site key (0x4AAAAAAA_PLACEHOLDER). Both are on the form's Snippet screen in the dashboard. Never guess an id. - Replace
au_xxxxxxxeverywhere in the copied files. The prefix is part of the id; keep whatever prefix the real id has (au_,eu_,us_). - Keep the honeypot. A text input named
_honeypot, empty, hidden with CSS (nottype="hidden"),tabindex="-1",autocomplete="off". Do not remove it and do not pre-fill it. - Add Turnstile where the sample has it: the
div.cf-turnstilewith the site key and thehttps://challenges.cloudflare.com/turnstile/v0/api.jsscript for HTML forms, or the explicit render API for JSON clients. The embed and widget scripts handle Turnstile themselves. A form without Turnstile still works, at stricter spam heuristics. - Set
_redirectto an absolute URL on the site if the owner wants their own thank-you page; otherwise leave it out for the hosted thank-you page or handle{ok, id}inline. - Do not add a server route unless the site already has one that must be kept; the browser posts directly. If a proxy is required, forward
Origin,X-Forwarded-ForandUser-Agentand pass the upstream status andRetry-Afterthrough unchanged (see the Next.js sample'sroute.ts). - Confirm the domain is verified. If it is not, tell the owner which record to add: TXT at
_contactusiq.<domain>with valuecontactusiq-verify=<token>, or the meta tag, or the well-known file. See Domain verification. - Test with curl from a shell, using a verified domain as
Origin:
curl -i https://api.contactusiq.com/s/au_xxxxxxx \
-H "Origin: https://www.example.com" \
-H "Content-Type: application/json" -H "Accept: application/json" \
--data '{"name":"Test Person","email":"test@example.com","message":"Hello","_honeypot":""}'Expect 200 and {"ok":true,"id":"sub_..."}. Then test from the deployed page on the verified domain, because localhost, file:// and preview hostnames are not verified and are silently dropped.
Interpreting results
| Observation | Meaning | Action |
|---|---|---|
200 but the owner sees nothing in the inbox | Silent rejection: origin not verified, honeypot filled, or spam score above threshold | Check Origin, check the honeypot is empty, test on the verified domain |
| CORS error in the browser on a JSON post | Preflight refused because the page origin is not verified | Deploy to the verified domain, or ask the owner to allow any origin for development |
404 | Wrong id or unpublished form | Ask the owner for the id from the Snippet screen and to publish the form |
429 | Rate limited | Wait Retry-After seconds; do not loop |
400 with error | A required field is missing or the body is malformed | Match the form's fields; GET /f/{id}/schema lists them |
Things not to do
- Do not put the visitor's email in a From header anywhere; ContactUsIQ uses Reply-To. This applies to any mail you might wire around it.
- Do not remove
_honeypot, rename it, or make ittype="hidden". - Do not embed a Turnstile secret in a page. Only the site key is public.
- Do not build an email sender into the integration for Phase 1; no email is sent in the first release and the inbox is the delivery surface.
- Do not target the management API (
app.contactusiq.com/v1) yet; it is planned. The WordPress plugin's call toPOST /v1/domains/{id}/verifyis the one documented client and its server side isTODO(spec).
The feedback widget
To add the floating feedback panel to an app, insert one script tag in the shared layout with the id of a form whose kind is "feedback widget":
<script src="https://api.contactusiq.com/f/au_xxxxxxx/widget.js"
data-form="au_xxxxxxx" data-position="bottom-right"
data-intents="question,feedback,problem" data-app-version="1.0.0" async defer></script>Add data-user-id, data-user-name and data-user-email from the session for signed-in users. Details: Feedback widget.