# ContactUsIQ developer documentation (full) > Every page of https://developers.contactusiq.com in reading order. ContactUsIQ is a hosted contact-form backend: one form action URL, POST https://api.contactusiq.com/s/{formPublicId}, that records enquiries with IP and page context, screens them with Cloudflare Turnstile and spam checks, and shows them in an inbox. Phase 1 sends no email. Early access (waitlist only): provided as is, use at your own risk. OpenAPI: https://developers.contactusiq.com/openapi.yaml Generated 2026-11-29 by apps/developers/scripts/build-llms.mjs. --- # Introduction > ContactUsIQ is a hosted contact-form backend. Point any form at one URL and every enquiry is recorded, screened for spam and shown in an inbox. Section: Start here. URL: https://developers.contactusiq.com/. Raw: https://developers.contactusiq.com/md/index.md > **Waitlist.** ContactUsIQ is in early access. Accounts are opened from the [waitlist](https://contactusiq.com/waitlist), and everything described here is provided as is, without warranty. Use it at your own risk. ContactUsIQ gives a website one URL to post its contact form to. The service records the enquiry with the sender's IP address and page context, screens it with Cloudflare Turnstile and layered spam checks, and shows it in an inbox for the verified owner of the domain. From Phase 2 it also emails the enquiry to confirmed recipients. There is no backend to write, no API key to hide in a static site and no library to install. A plain HTML `form` element is a complete integration. ### The one-URL model Every integration, from a hand-written HTML page to a React app or a WordPress plugin, targets the same public intake endpoint: ```text POST https://api.contactusiq.com/s/{formPublicId} Content-Type: application/x-www-form-urlencoded | multipart/form-data | application/json ``` - `{formPublicId}` is the short, unguessable id of a published form, for example `au_gbn7f3a`. The prefix names the data residency cell the workspace lives in (`au_` for Australia). - Field names are free-form. A handful of names are reserved: `_honeypot`, `_redirect`, `_subject`, `_intent`, `_rating`, `_page` and `cf-turnstile-response`. - The endpoint is unauthenticated by design. It is protected by domain ownership verification, `Origin` and `Referer` checks, CAPTCHA and rate limits instead of a secret. The smallest working form: ```html
``` Replace `au_xxxxxxx` with the id shown on your form's Snippet screen in the dashboard. The [Quickstart](/quickstart) walks through the whole five-minute setup. ### Phase 1 is portal-first The first release sends no email at all. Every enquiry from every verified domain is stored and appears in the workspace inbox within seconds, with a Web Push notification and an unread badge as the nudge. This is deliberate: the inbox is the system of record, and an email provider outage can never lose a lead because every submission is stored before anything else happens. Email delivery through Amazon SES, recipient double opt-in, the visitor acknowledgement and own-domain sending arrive in Phase 2. Pages that describe Phase 2 behaviour say so at the top. ### What the service does with a submission 1. The edge drops oversized bodies, wrong content types and known bad user agents. 2. The intake function loads the published form definition (cached for 60 seconds), checks that the `Origin` or `Referer` matches a verified domain, checks the honeypot and required fields, verifies the Turnstile token server-side with the client IP, applies rate limits and scores the message with heuristics. 3. The submission is stored with its payload, client context (IP, country and city, user agent, referrer, UTM parameters) and spam verdict. 4. The browser gets a thank-you page, a `303` redirect or a JSON `{ok, id}` body. A rejected submission gets the same success-looking response so bots learn nothing; the real outcome is visible in the inbox. 5. A worker pushes a notification to the workspace members' devices. From Phase 2 it also queues email to each confirmed recipient. ### Where to go next | Page | Read it when | | --- | --- | | [Quickstart](/quickstart) | You want a form live in five minutes. | | [Concepts](/concepts) | You want to understand workspaces, domains, forms, cells and submissions. | | [Integrations](/integrations) | You are adding the form to a specific stack: HTML, JavaScript, React, Next.js, Astro, WordPress, curl. | | [Feedback widget](/feedback-widget) | You want the floating "ask a question, give feedback, report a problem" panel in an app. | | [Domain verification](/domain-verification) | You are adding the TXT record, meta tag or well-known file. | | [API reference](/api) | You need the exact request and response contract, or the management API. | | [For AI agents](/for-ai-agents) | You are an agent integrating a site on someone's behalf. | ### About these docs Every statement here comes from the ContactUsIQ product spec, which is the source of truth. Where the spec describes something that is not yet built, the page or section is marked **Planned**. Nothing is added that the spec does not say. Every page is plain Markdown you can read raw under [/md](/md/index.md), and the whole site is also published as [llms.txt](/llms.txt), [llms-full.txt](/llms-full.txt) and [openapi.yaml](/openapi.yaml). --- # Quickstart > Add a domain, verify it, create a form, paste the snippet, send a test and see it in the inbox. About five minutes. Section: Start here. URL: https://developers.contactusiq.com/quickstart. Raw: https://developers.contactusiq.com/md/quickstart.md > **Waitlist.** ContactUsIQ is in early access. Accounts are opened from the [waitlist](https://contactusiq.com/waitlist), and everything described here is provided as is, without warranty. Use it at your own risk. This walkthrough takes a site from nothing to a working, spam-screened contact form. You need access to the site's DNS (or its HTML head, or its public folder) and a place to edit the page that holds the form. ### 1. Sign in and open your workspace Once your waitlist place is confirmed, sign in at [app.contactusiq.com](https://app.contactusiq.com) with Google or GitHub. A workspace named after you is created on first sign-in. A workspace holds many domains, and every form, submission and setting belongs to exactly one workspace. ### 2. Add the domain In the dashboard choose **Domains**, then **Add**, and type the hostname the form will be served from, for example `example.com`. The wizard shows one DNS TXT record to add: | Type | Host | Value | | --- | --- | --- | | TXT | `_contactusiq.example.com` | `contactusiq-verify=` | The token is shown once; copy it with the button next to it. The wizard polls DNS every 30 seconds for 15 minutes and tells you in plain words what it found. If you cannot edit DNS, pick one of the fallbacks on the same screen: - an HTML meta tag on the home page: `` - a file at `https://example.com/.well-known/contactusiq.txt` containing the token Subdomains such as `www.example.com` inherit the parent's verification, so one record covers them. Details and troubleshooting: [Domain verification](/domain-verification). ### 3. Recipients (Phase 2) Phase 1 sends no email, so there is nothing to confirm here: you read every enquiry in the inbox. From Phase 2 you add a recipient address, click the link in the confirmation email (double opt-in), and only then does email flow to it. ### 4. Create the form Choose **Forms**, then **New**. Name it, keep or edit the preset fields (name, email, phone, message), and set: - **CAPTCHA**: invisible Turnstile by default. - **After submit**: an inline thank-you message, or a redirect to a page on your site. - **Spam sensitivity**: Relaxed, Normal or Strict. Publish the form. Publishing requires the domain to be verified. ### 5. Paste the snippet The form's **Snippet** screen shows the public id (`au_xxxxxxx`), the Turnstile site key and three flavours of code. The plain HTML flavour works with JavaScript switched off: ```html
``` Replace `au_xxxxxxx`, `0x4AAAAAAA_PLACEHOLDER` and the `_redirect` URL. The other flavours are a [JavaScript embed](/integrations/js-embed) (one script tag and one `div`) and a [JSON endpoint](/integrations/json-fetch) for React and Next.js sites. ### 6. Send a test Deploy the page on the verified domain and submit it. Testing from `file://` or `localhost` is silently dropped because the `Origin` does not match a verified domain, unless the form is set to allow any origin. The wizard also has a **Send a test** button that submits on your behalf. What you should see: - Without `_redirect`: `200` and the hosted thank-you page. - With `_redirect`: `303` and a `Location` header pointing at your page. - With `Accept: application/json`: `200` and `{"ok":true,"id":"sub_..."}`. ### 7. Read it in the inbox Open **Inbox**. The submission appears in real time with the visitor's IP, country and city, browser, the page it came from and the spam verdict. A Web Push notification arrives on any device where you allowed it. Mark it read, archive it, mark it spam or not spam, or open your mail client to reply with the visitor's address already in Reply-To. Deliberately spammy submissions (a filled honeypot, a wrong origin) return the same `200` to the browser but do not reach the inbox; they are counted in the blocked total. ### Next steps - Add the [feedback widget](/feedback-widget) to an app for questions, feedback and bug reports. - Read the [request rules and response codes](/api/intake) before writing your own client. - Pick a framework guide under [Integrations](/integrations). --- # Concepts > Workspaces, domains and verification, forms and public ids, submissions and client context, reachability, intents, the feedback widget and sending modes. Section: Start here. URL: https://developers.contactusiq.com/concepts. Raw: https://developers.contactusiq.com/md/concepts.md ### Workspaces A workspace is the tenant boundary. It holds domains, forms, recipients, submissions, the sending domain, API keys and webhooks, and is the unit of billing. An account can belong to several workspaces (an agency runs one per client) and switches between them in the header. Members have one of three roles: owner, admin or viewer. Every workspace is pinned to one data residency **cell** for life. Australia is the default and the only cell at launch; EU and US cells are provisioned on request for paying plans. See [Privacy, GDPR and data residency](/privacy#data-residency-cells). ### Domains and verification A domain is a hostname the workspace has proved it controls. Proof is a DNS TXT record, an HTML meta tag or a well-known file, re-checked every 24 hours. A form can only be published on a verified domain, and the intake API only accepts submissions whose `Origin` or `Referer` matches a verified domain of the form. Subdomains (`www.`, `app.`, any child) inherit the parent's verification. Verification is separate from **sending authority**, which is the optional, Phase 2 proof that ContactUsIQ may send email as the domain. Details: [Domain verification](/domain-verification). ### Forms and public ids A form belongs to one domain and defines the fields, validation rules, CAPTCHA mode, spam sensitivity, thank-you behaviour, auto-reply template and, from Phase 2, its recipients. Publishing a form bumps its version; each submission records the version it used. Every published form has a **public id**, the short unguessable string in the intake URL: ```text https://api.contactusiq.com/s/au_gbn7f3a ^^ cell prefix ``` The prefix carries the workspace's cell: `au_` for Australia, `eu_` for the EU, `us_` for the US. The global edge reads the prefix and routes the request to the right region without any lookup, so an intake request never makes a cross-region call. Per-cell hostnames such as `api.eu.contactusiq.com` also exist for customers who need a fixed region in a firewall allow-list. If a Business workspace is moved between cells, its form ids are reissued with the new prefix and the old ids redirect for 90 days. Forms have a **kind**: `contact` for ordinary forms, or `feedback-widget` for forms delivered as the floating panel. ### Submissions and client context A submission is one accepted or rejected post to a form. It stores: - **payload**: the fields exactly as submitted. - **client context**: IP address, country and city derived from the IP, user agent, referrer page, UTM parameters and the timestamp. Widget submissions add intent, rating and page context (URL, title, viewport, browser, OS, locale, app version, optional hashed user id) as structured columns. - **verdict**: the spam score from 0 to 1, the verdict, and a rejection reason when there is one. - **status** and a timeline of events: received, screened, accepted, queued, sent, delivered, bounced, read, archived. The full IP is kept for 30 days for abuse investigation, then nulled; a salted hash and the country remain for analytics. Rejected submissions are stored for analytics and hidden from the inbox by default; submissions hidden as spam are kept 30 days so a false positive can be rescued. Every submission is stored before any notification is attempted. The insert is the commit point. ### Reachability (Phase 2) From Phase 2 every accepted enquiry triggers a short acknowledgement email to the visitor, which doubles as a live check that the address exists. The result sets the submission's `reachability`: | Value | Meaning | | --- | --- | | `reachable` | The acknowledgement was delivered. Green badge, normal inbox. | | `unreachable` | No MX record, disposable domain, hard bounce or complaint. Moved to the Unreachable view, excluded from response-time metrics. | | `unconfirmed` | Soft bounce still failing after 24 hours, or acknowledgements turned off. Grey badge, normal inbox. | | `engaged` (later) | The visitor replied to the acknowledgement or clicked the reference link. | Details and the rules that stop the acknowledgement being abused: [Email and deliverability](/email-deliverability#visitor-acknowledgement-and-reachability). ### Intents An intent says what the visitor meant. The four values are `question`, `feedback`, `problem` and `idea`. The feedback widget sets `_intent` automatically from the option the visitor picked; any client can send it as a field. Each intent can have its own field preset, recipients, auto-reply and subject prefix, and the inbox filters by it. ### The feedback widget Any form can also be delivered as a floating icon in the corner of an app page. A click opens a panel where the visitor asks a question, gives feedback, reports a problem or suggests an idea without leaving the page. Underneath it is the same intake pipeline, so it inherits verification, CAPTCHA, spam screening, delivery, the inbox and analytics; what it adds is structured context about where the visitor was. One script tag installs it; everything else is configured on the form in the dashboard. See [Feedback widget](/feedback-widget). ### Sending modes A workspace has one sending mode: | Mode | What happens | Available | | --- | --- | --- | | Portal only | Nothing is emailed. Enquiries are read in the inbox with Web Push and unread badges. No mail sub-processor exists in this mode. | Phase 1, and later for owners who want no email | | Managed sender | Email from `notify@mail.contactusiq.com` with Reply-To set to the visitor. No DNS to add. | Phase 2, default, Free | | Own domain | Email from an address on the owner's domain, for example `enquiries@example.com`, after adding DKIM, SPF and DMARC records. | Phase 2, Pro | In every mode the visitor's address is never the From header; it is always Reply-To. See [Email and deliverability](/email-deliverability). ### Personas Five roles appear in the product: the **Platform Admin** who runs the service, the **Client** who owns a workspace, the **Workspace Member** who helps triage, the **Visitor** who fills in a form, and the **Recipient** who receives the email from Phase 2. These docs are written for the client or the developer working for them. --- # Integrations > One page per stack. Each repeats the minimal snippet and links to the copy-paste sample folder on GitHub. Section: Integrations. URL: https://developers.contactusiq.com/integrations. Raw: https://developers.contactusiq.com/md/integrations/index.md Every integration targets the same endpoint, `POST https://api.contactusiq.com/s/{formPublicId}`, so the choice is about how the page is built, not about the API. All samples use the placeholder form id `au_xxxxxxx` and the Turnstile site key placeholder `0x4AAAAAAA_PLACEHOLDER`; replace both with the values on your form's Snippet screen. | Stack | Guide | Sample folder | Shape of the integration | | --- | --- | --- | --- | | Plain HTML | [Plain HTML form](/integrations/html-form) | [`samples/html-form`](/samples/html-form/README.md) | A `form` with an `action` URL. No JavaScript required. | | Any page | [JavaScript embed](/integrations/js-embed) | [`samples/js-embed`](/samples/js-embed/README.md) | One script tag and one `div`; fields and theme come from the dashboard. | | Vanilla JS | [JSON fetch](/integrations/json-fetch) | [`samples/json-fetch`](/samples/json-fetch/README.md) | `fetch` with JSON, inline thank-you, handles 400 and 429. | | React | [React](/integrations/react) | [`samples/react`](/samples/react/README.md) | A hooks-only component with Turnstile via the explicit API. | | Next.js | [Next.js](/integrations/nextjs) | [`samples/nextjs`](/samples/nextjs/README.md) | App Router page plus client component; optional proxy route. | | Astro | [Astro](/integrations/astro) | [`samples/astro`](/samples/astro/README.md) | A `.astro` page with the HTML form, or the embed with `is:inline`. | | WordPress | [WordPress](/integrations/wordpress) | [`apps/wp-plugin`](/samples/wp-plugin/README.md) and [`samples/wordpress-shortcode`](/samples/wordpress-shortcode/README.md) | The plugin (block, shortcode, widget, Contact Form 7 adapter) or a one-file shortcode. | | Webflow, Squarespace, Wix | [Site builders](/integrations/site-builders) | guide only | Custom-code embed of the HTML form or the script tag. | | Any HTTP client | [curl](/integrations/curl) | [`samples/curl`](/samples/curl/README.md) | Form-encoded, JSON, multipart, idempotency key, honeypot negative test. | ### Choosing a flavour - **Plain HTML form** when the site is static, you want zero JavaScript, or you want a redirect to your own thank-you page. Works with JavaScript disabled. - **JavaScript embed** when you want the form's fields, labels and theme managed in the dashboard so changes appear without a deploy. - **JSON fetch** (including the React and Next.js components) when the page is an app that should stay put and show an inline result. JSON posts from a browser are cross-origin, so the page must be served from a verified domain for the CORS preflight to succeed. ### What every integration needs 1. A verified domain in the workspace and a published form on it. 2. The form's public id, and the Turnstile site key if the page renders Turnstile itself. 3. An empty hidden `_honeypot` field (the embed and widget add their own). 4. To be served over HTTPS from the verified domain when testing. `localhost` and `file://` are never verified; a form can be set to allow any origin for development. --- # 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. Section: Integrations. URL: https://developers.contactusiq.com/integrations/html-form. Raw: https://developers.contactusiq.com/md/integrations/html-form.md Sample: [`samples/html-form`](/samples/html-form/README.md) (`index.html`, `thanks.html`, README). ### The snippet ```html
``` ### Steps 1. Copy the form into your page. Keep `method="POST"`; the browser's default encoding (`application/x-www-form-urlencoded`) is accepted. Add `enctype="multipart/form-data"` only if you need it; both work. 2. Replace `au_xxxxxxx` with your form id and `0x4AAAAAAA_PLACEHOLDER` with the Turnstile site key from the Snippet screen. To skip Turnstile, delete the `div` and the script; the form still works at stricter spam heuristics. 3. Set `_redirect` to the absolute URL of your thank-you page, or remove it to use the hosted thank-you page. 4. 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 Other` with a `Location` header to your thank-you page, or `200` with the hosted page when `_redirect` is 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](/privacy#cookies-and-consent). --- # JavaScript embed > One script tag and one div. ContactUsIQ renders the form with your theme, loads Turnstile, submits by fetch and shows an inline thank-you. Section: Integrations. URL: https://developers.contactusiq.com/integrations/js-embed. Raw: https://developers.contactusiq.com/md/integrations/js-embed.md Sample: [`samples/js-embed`](/samples/js-embed/README.md) (`index.html` for the form, `widget.html` for the feedback widget, README). ### The snippet ```html
``` `GET /f/{formPublicId}/embed.js` returns a script that renders the form with the workspace's chosen theme, loads Turnstile with the key configured on the form, submits by `fetch` with `Accept: application/json` and shows an inline thank-you with the reference id. It is cached at the edge. Fields, labels, required rules and the Turnstile key all come from the form definition, so edits in the dashboard appear on the site without a deploy. No Turnstile site key is needed in the page. ### Steps 1. Put the `div` where the form should appear and the `script` tag after it (or anywhere on the page). 2. Replace `au_xxxxxxx` with your form id. 3. Keep `data-target` pointing at the `div`, or omit it to render where the script tag sits. 4. Deploy on the verified domain. ### Content Security Policy If the site sets a CSP, allow: ```text script-src https://api.contactusiq.com https://challenges.cloudflare.com frame-src https://challenges.cloudflare.com connect-src https://api.contactusiq.com ``` The embed script is served with Subresource Integrity hashes. ### Behaviour - Loads deferred and never blocks the host page if it fails to load. - Sets no cookies of its own. - On `429` shows the wait time from `Retry-After`; on `400` shows the field named in the error. - The same script family serves the [feedback widget](/feedback-widget) (`widget.js`), which adds intent, rating and page context. ### Troubleshooting | Symptom | Cause and fix | | --- | --- | | The `div` stays empty | Wrong form id (`404` in the Network tab), the form is unpublished, or a CSP blocks `api.contactusiq.com`. | | Submit returns `200` but nothing arrives | Origin mismatch: the page is not on a verified domain of the form. Test on the real domain or add the staging domain to the workspace. | | Turnstile fails inside the embed | The Turnstile widget in Cloudflare does not list this domain, or the key on the form is wrong. | ### Provide a fallback Add a `noscript` paragraph with an email address or a link to a plain HTML version for visitors without JavaScript, or use the [plain HTML form](/integrations/html-form) instead, which needs none. --- # JSON fetch > Post the form as JSON from the browser, keep the visitor on the page and handle 200, 400, 413 and 429 explicitly. Section: Integrations. URL: https://developers.contactusiq.com/integrations/json-fetch. Raw: https://developers.contactusiq.com/md/integrations/json-fetch.md Sample: [`samples/json-fetch`](/samples/json-fetch/README.md) (`contact-form.js`, an ES module exporting `mountContactForm`, plus `index.html`). ### The snippet ```js const res = await fetch('https://api.contactusiq.com/s/au_xxxxxxx', { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify({ name, email, message, _honeypot: '', _page: location.href, 'cf-turnstile-response': token, // omit if the page has no Turnstile }), }); if (res.status === 200) { const { id } = await res.json(); // { ok: true, id: "sub_..." } } else if (res.status === 400) { const { error } = await res.json(); // { ok: false, error: "..." } } else if (res.status === 429) { const wait = res.headers.get('Retry-After'); // seconds } else if (res.status === 413) { // body over 64 KB } ``` ### How it works - `Content-Type: application/json` makes the request cross-origin from the browser's point of view, so the intake API answers the `OPTIONS` preflight with CORS headers for the form's verified domains only. Serve the page from a verified domain. - `Accept: application/json` switches the success response from the HTML thank-you page to `{ok, id}`. - `_page` is optional; it tells the inbox which page the message came from. - `cf-turnstile-response` is the token from the Turnstile widget. The sample renders Turnstile with the explicit API (`?render=explicit`) so the token is always available and the widget is reset after each attempt. - Optional `Idempotency-Key` header or `_idempotency` field de-duplicates double clicks for 10 minutes. The sample module, `mountContactForm(form, { formId, turnstileSiteKey, onSuccess })`, serialises the form with `FormData`, posts it, and maps each status to a message in a `role="status"` element. Network or CORS failures show "could not reach the server". ### Steps 1. Copy `contact-form.js` next to your page. 2. Use a `form` with inputs named `name`, `email`, `message` and an empty `_honeypot`, plus a `div` with `data-turnstile` and a `p` with `data-status` (the module creates them if missing). 3. Call `mountContactForm(document.querySelector('#contact'), { formId: 'au_xxxxxxx', turnstileSiteKey: '0x4AAAAAAA_PLACEHOLDER' })`. Omit `turnstileSiteKey` to skip Turnstile. 4. Deploy on the verified domain. ### How to test Network tab: `OPTIONS /s/au_xxxxxxx` returns `204`, then `POST` returns `200` with `{"ok":true,"id":"sub_..."}`. Submit six times within ten minutes to see the `429` path. ### Troubleshooting | Symptom | Cause and fix | | --- | --- | | CORS error, no response | The page origin is not a verified domain, so the preflight was refused. Serve from the verified domain, or allow any origin on the form for development. | | `200` but nothing in the inbox | Silent origin or spam rejection. Check the domain is verified and that the honeypot is empty (autofill extensions sometimes fill it; the `autocomplete="off"` and off-screen position minimise this). | | Turnstile never renders | Wrong site key, domain missing from the Turnstile widget, or CSP blocking `challenges.cloudflare.com` in `script-src` and `frame-src`. | --- # React > A hooks-only React 19 component that posts JSON straight from the browser, with idle, sending, sent and error states and Turnstile via the explicit render API. Section: Integrations. URL: https://developers.contactusiq.com/integrations/react. Raw: https://developers.contactusiq.com/md/integrations/react.md Sample: [`samples/react`](/samples/react/README.md) (`ContactForm.tsx`, README). Works on React 18 too; no dependencies beyond React. ### The snippet ```tsx import ContactForm from './ContactForm'; export function ContactPage() { return ( console.log('sent', id)} /> ); } ``` ### What the component does - **State machine**: `status` is `idle`, `sending`, `sent` (with the submission id) or `error` (with a message and, for `429`, `retryAfter`). While sending, the inputs and button are disabled and `aria-busy` is set. - **Submit**: `FormData` becomes a plain object, plus `_page` (current URL), optional `_subject`, and `cf-turnstile-response` from the Turnstile callback (falling back to `turnstile.getResponse`). Then `fetch` to `https://api.contactusiq.com/s/{formId}` with `Content-Type: application/json` and `Accept: application/json`. - **Responses**: `200` sets `sent`; `400` shows the server's `error` string; `429` shows the `Retry-After` seconds; `413` says the message is too long; anything else or a network failure shows a generic error. Turnstile is reset after every attempt. - **Turnstile**: the script is injected once with `?render=explicit`; a `useEffect` renders the widget into a `ref` on mount and removes it on unmount, so it survives strict-mode double mounting and route changes. Omit `turnstileSiteKey` to submit without Turnstile. - **Honeypot**: `_honeypot` is a real text input positioned off-screen with `tabIndex={-1}` and `autoComplete="off"`. - **Markup**: plain `label`, `input`, `textarea`, `button` and `p[role=alert]` elements with no styles, so your CSS applies. The core of the submit handler: ```tsx const res = await fetch(`https://api.contactusiq.com/s/${encodeURIComponent(formId)}`, { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify(fields), }); if (res.status === 200) { const data = (await res.json()) as { id?: string }; setStatus({ state: 'sent', id: data.id }); } else if (res.status === 429) { const retryAfter = Number(res.headers.get('Retry-After')) || 60; setStatus({ state: 'error', message: `Try again in ${retryAfter} seconds.`, retryAfter }); } ``` ### Steps 1. Copy `ContactForm.tsx` into your components folder. 2. Render it with your form id and Turnstile site key. 3. Deploy on the verified domain: JSON posts are cross-origin, and the CORS preflight is answered for verified domains only. `localhost` is never verified. ### Troubleshooting | Symptom | Cause and fix | | --- | --- | | CORS error, request blocked | Origin not verified on the form. Verify the domain or allow any origin for development. | | `200` but nothing in the inbox | Silent origin or spam rejection. Check the domain and that the honeypot is empty. | | Turnstile does not render | Wrong site key, domain not listed on the Turnstile widget, or CSP blocking `https://challenges.cloudflare.com`. | For a server component page with a client form, see [Next.js](/integrations/nextjs). --- # Next.js > An App Router page whose client component posts JSON directly from the browser, plus an optional pass-through route for sites that want to keep a server URL. Section: Integrations. URL: https://developers.contactusiq.com/integrations/nextjs. Raw: https://developers.contactusiq.com/md/integrations/nextjs.md Sample: [`samples/nextjs`](/samples/nextjs/README.md) (`app/contact/page.tsx`, `app/contact/ContactForm.tsx`, optional `app/api/enquiry/route.ts`, README). Next.js 14 or 15, React 18 or 19. ### The snippet ```tsx // app/contact/page.tsx (server component) import ContactForm from './ContactForm'; export default function ContactPage() { return ( ); } ``` `ContactForm.tsx` is a `'use client'` component: `idle`, `sending`, `sent` and `error` states; `next/script` loads Turnstile with `?render=explicit` and the widget is rendered into a `ref` once the script reports `onLoad`; the honeypot is an off-screen text input; the submit `fetch`es `https://api.contactusiq.com/s/{formId}` with `Content-Type: application/json` and `Accept: application/json`; `200` shows the thank-you with the id, `400` the server's `error`, `429` the `Retry-After` seconds. Turnstile is reset after every attempt. Because the browser posts directly, the page works with static export and edge caching and involves no API route, server action or secret. ### Steps 1. Copy `app/contact/page.tsx` and `app/contact/ContactForm.tsx` into your `app/` folder. 2. Set `NEXT_PUBLIC_CONTACTUSIQ_FORM_ID=au_xxxxxxx` and `NEXT_PUBLIC_TURNSTILE_SITE_KEY=0x4AAAAAAA_PLACEHOLDER` in `.env.local`, or hard-code them. Leave the Turnstile key unset to submit without Turnstile. 3. Deploy and visit `/contact` on the verified domain. ### Optional: keep a server route Sites that already post to their own URL (an existing `/api/enquiry` route, for example) can keep it as a pass-through. The sample's `route.ts` is an edge route that forwards the body and content type to the intake URL and returns the upstream status, body and `Retry-After` unchanged: ```ts // app/api/enquiry/route.ts import { NextRequest, NextResponse } from 'next/server'; export const runtime = 'edge'; export async function POST(request: NextRequest) { const formId = process.env.CONTACTUSIQ_FORM_ID ?? 'au_xxxxxxx'; const upstream = await fetch(`https://api.contactusiq.com/s/${encodeURIComponent(formId)}`, { method: 'POST', headers: { 'Content-Type': request.headers.get('content-type') ?? 'application/json', Accept: 'application/json', Origin: request.headers.get('origin') ?? new URL(request.url).origin, 'X-Forwarded-For': request.headers.get('x-forwarded-for') ?? '', 'User-Agent': request.headers.get('user-agent') ?? '', }, body: request.body, ...({ duplex: 'half' } as Record), }); return new NextResponse(upstream.body, { status: upstream.status, headers: { 'Content-Type': upstream.headers.get('content-type') ?? 'application/json', ...(upstream.headers.get('retry-after') ? { 'Retry-After': upstream.headers.get('retry-after')! } : {}), }, }); } ``` Then point the component at `/api/enquiry` instead of the intake URL. Same-origin requests need no CORS preflight, which makes local development easier. Note that the intake API takes the client IP from its own trusted edge header, never from user-supplied headers, so behind a proxy the per-IP rate limit applies to your server's IP; the direct browser flow is preferred in production. ### Troubleshooting | Symptom | Cause and fix | | --- | --- | | CORS error in the browser | The page origin is not verified. Verify the domain, allow any origin on the form for development, or use the proxy route locally. | | `200` but nothing in the inbox | Silent origin or spam rejection. With the proxy, confirm `Origin` is forwarded and is a verified domain. | | Turnstile does not appear | Check the site key and that the domain is listed on the Turnstile widget in Cloudflare. | --- # Astro > A .astro page with the plain HTML form and a redirect to /thanks, or the hosted embed with is:inline. Zero client JavaScript apart from Turnstile. Section: Integrations. URL: https://developers.contactusiq.com/integrations/astro. Raw: https://developers.contactusiq.com/md/integrations/astro.md Sample: [`samples/astro`](/samples/astro/README.md) (`src/pages/contact.astro`, `contact-embed.astro`, `thanks.astro`, README). Any adapter; static output is fine. ### The snippet ```astro --- const formId = import.meta.env.PUBLIC_CONTACTUSIQ_FORM_ID ?? 'au_xxxxxxx'; const turnstileSiteKey = import.meta.env.PUBLIC_TURNSTILE_SITE_KEY ?? '0x4AAAAAAA_PLACEHOLDER'; const thanksUrl = new URL('/thanks', Astro.site ?? 'https://example.com').href; ---
``` The hosted embed alternative: ```astro
``` `is:inline` is required on both external scripts; without it Astro tries to bundle them. ### Steps 1. Copy the `.astro` files into `src/pages/`. 2. Add `PUBLIC_CONTACTUSIQ_FORM_ID=au_xxxxxxx` and `PUBLIC_TURNSTILE_SITE_KEY=0x4AAAAAAA_PLACEHOLDER` to `.env`, or edit the defaults at the top of each file. 3. Set `site` in `astro.config.mjs` (for example `site: 'https://www.example.com'`) so `_redirect` becomes an absolute URL; otherwise hard-code it. 4. Build and deploy on the verified domain. Visit `/contact` or `/contact-embed`. ### How to test `/contact`: a `303` redirect to `/thanks`. `/contact-embed`: the form renders in the `div` and a submit returns `200` with `{"ok":true,"id":"..."}`. ### Troubleshooting | Symptom | Cause and fix | | --- | --- | | Redirect goes to the wrong host | `_redirect` must be absolute. Check `site` in `astro.config.mjs`. | | Redirected but nothing in the inbox | Origin mismatch: `astro dev` on `localhost` is not a verified domain. Test on the deployed site. | | Embed script `404` or missing | The script tag lacks `is:inline`, or the form id is wrong or unpublished. | --- # WordPress > The ContactUsIQ plugin (Connect, block, shortcode, feedback widget, Contact Form 7 adapter) or a one-file shortcode. Both post from the browser, so caching plugins never break the form. Section: Integrations. URL: https://developers.contactusiq.com/integrations/wordpress. Raw: https://developers.contactusiq.com/md/integrations/wordpress.md Two routes: the full plugin ([download the zip](/samples/contactusiq-wp-plugin.zip), [README](/samples/wp-plugin/README.md)), or the single-file shortcode under [`samples/wordpress-shortcode`](/samples/wordpress-shortcode/README.md). Both need WordPress 6.4+ on PHP 8.1+. Forms post straight from the visitor's browser to `api.contactusiq.com`, so page caching (WP Rocket, LiteSpeed, Cloudflare), `admin-ajax` and nonces are never involved and nothing runs server-side on submit. ### The plugin **Status: the plugin source is in the repository; directory listing on wordpress.org is part of Phase 3.** #### Connect flow 1. Install and activate the plugin (slug `contactusiq`). 2. Settings, then ContactUsIQ, then **Connect**. A popup at `app.contactusiq.com` signs you in, picks a workspace and approves the site; ContactUsIQ issues a site-scoped API key and returns it to the plugin. No key is typed by hand. 3. The plugin prints `` in the site head and calls the verify endpoint, so the domain verifies without touching DNS. TXT verification remains available. 4. The site's admin email is registered as a recipient (confirmation by email applies from Phase 2). 5. A default "Contact" form is created and ready to place. Until the Connect page exists you can paste a form id and Turnstile site key into the same settings screen. #### Placing a form Block editor: add the **ContactUsIQ Form** block, pick the form, choose HTML or embed mode. Fields and labels come from the form definition. Shortcode, for the classic editor, page builders and widget areas: ```text [contactusiq form="au_xxxxxxx" mode="html"] [contactusiq form="au_xxxxxxx" mode="embed"] [contactusiq] ``` Attributes: `form`, `mode` (`html` or `embed`), `sitekey`, `redirect` (absolute URL for the `303`), `subject`, `button`. The bare `[contactusiq]` uses the default form id from settings. HTML mode renders a `form` with `action="https://api.contactusiq.com/s/au_xxxxxxx"`, an off-screen empty `_honeypot`, hidden `_redirect`, `_subject` and `_page`, and the Turnstile `div` when a site key is known. Embed mode renders the `div` and `embed.js` script tag. #### Feedback widget One switch places the [feedback widget](/feedback-widget) on every page or only on selected post types, and can pass the logged-in WordPress user (`data-user-id`, `data-user-name`, `data-user-email`) when the owner allows it. It is never printed in admin, feeds or embeds. #### Contact Form 7 adapter Tick an existing Contact Form 7 form in the settings and its submissions are forwarded as JSON to the intake URL instead of WordPress mail, with the field map `your-name` to `name`, `your-email` to `email`, `your-message` to `message`, `your-subject` to `_subject` and `your-phone` to `phone`. Because this forward is server-to-server, the intake API sees the WordPress server's IP as the client and per-IP rate limits apply to the server. WPForms, Gravity Forms and Fluent Forms adapters are later. #### Hooks `contactusiq_intake_url`, `contactusiq_form_fields`, `contactusiq_show_widget`, `contactusiq_widget_attributes`, `contactusiq_cf7_enabled`, `contactusiq_cf7_form_id`, `contactusiq_cf7_field_map` and the action `contactusiq_cf7_forwarded`. Example, add a phone field: ```php add_filter( 'contactusiq_form_fields', function ( array $fields ) { $fields[] = array( 'name' => 'phone', 'label' => 'Phone', 'type' => 'tel', 'required' => false ); return $fields; } ); ``` Site Health gains a "ContactUsIQ connection" test showing connection, verification and last delivery. Full developer notes: the plugin's [README](/samples/wp-plugin/README.md). ### The one-file shortcode For sites that want the form without the plugin, copy `contactusiq-shortcode.php` to `wp-content/mu-plugins/` (it loads automatically) and insert: ```text [contactusiq_form id="au_xxxxxxx" sitekey="0x4AAAAAAA_PLACEHOLDER" redirect="https://www.example.com/thanks/" subject="Website enquiry"] ``` Attributes: `id` (required), `sitekey`, `redirect`, `subject`, `button`. It outputs the same plain HTML form as the plugin's HTML mode, escaped with `esc_url`, `esc_attr` and `esc_html`, and enqueues the Turnstile script once when a `sitekey` is given. ### Troubleshooting | Symptom | Cause and fix | | --- | --- | | The shortcode text shows on the page | The file is not in `wp-content/mu-plugins/`, or the shortcode name is misspelled. | | Redirect works but nothing in the inbox | The site's domain is not verified, or you are testing on a staging hostname. The meta tag method suits WordPress well. | | Turnstile does not render | Wrong `sitekey`, domain not on the Turnstile widget, or another plugin already loads Turnstile under a different handle. | | `429` | 5 per IP per form per 10 minutes. | --- # Webflow, Squarespace and Wix Status: Guide only > Guide only. Paste the plain HTML form or the embed script into the builder's custom-code block; the intake URL does the rest. Section: Integrations. URL: https://developers.contactusiq.com/integrations/site-builders. Raw: https://developers.contactusiq.com/md/integrations/site-builders.md These builders let you insert custom HTML into a page. Because ContactUsIQ needs nothing but a form posting to one URL, that is enough. Screenshots and builder-specific walkthroughs are planned for Phase 3; the steps below are the general shape and there is no sample folder for them yet. ### What to paste Either the [plain HTML form](/integrations/html-form): ```html
``` or the [JavaScript embed](/integrations/js-embed), which renders the form with your dashboard theme and needs no Turnstile key in the page: ```html
``` ### Per builder | Builder | Where the code goes | Notes | | --- | --- | --- | | Webflow | An **Embed** element on the page, or set a native Webflow form's action to the intake URL (the spec lists a form action override for Webflow) | Native Webflow forms can keep their styling; add the hidden `_honeypot` input inside them. | | Squarespace | A **Code** block on the page | Available on plans that allow custom code. Turnstile needs the script tag in the same block or in the page header injection. | | Wix | An **Embed HTML** element | Wix renders embeds inside an iframe, so the page's `Origin` seen by ContactUsIQ may be the embed frame's origin; verify the site's domain and test on the live site. | | Carrd | An **Embed** element with the HTML form | Same as plain HTML. | ### Domain verification on a builder Verify the domain with the DNS TXT record at your registrar, or, where the builder lets you edit the site head, with the meta tag. The well-known file method needs a public folder, which most builders do not expose. See [Domain verification](/domain-verification). ### Test on the published site Builder previews run on the builder's own hostnames, which are not verified, so submissions from a preview return `200` and are silently dropped. Publish and test on the real domain. Shopify (an app that adds the form and widget to the theme editor) and Framer and Ghost embed guides are planned for Phase 4. --- # curl > Form-encoded, JSON, multipart, redirect and idempotency-key requests from the command line, plus the honeypot negative test. The reference for any HTTP client. Section: Integrations. URL: https://developers.contactusiq.com/integrations/curl. Raw: https://developers.contactusiq.com/md/integrations/curl.md Sample: [`samples/curl`](/samples/curl/README.md) (`examples.sh`, README). Set `CONTACTUSIQ_FORM_ID` and `CONTACTUSIQ_ORIGIN` (a verified domain) and run the script. Every request needs an `Origin` (or `Referer`) header matching a domain verified on the form; without one the API returns `200` and silently drops the submission. There is no Turnstile from the command line, so the request runs at stricter heuristics; use a form configured for testing. ### Form-encoded What a plain HTML form sends. Expect `200` and an HTML thank-you page. ```sh curl -i https://api.contactusiq.com/s/au_xxxxxxx \ -H "Origin: https://www.example.com" \ --data-urlencode "name=Test Person" \ --data-urlencode "email=test@example.com" \ --data-urlencode "message=Hello" \ --data-urlencode "_honeypot=" ``` ### With a redirect Expect `303` and a `Location` header. ```sh curl -i https://api.contactusiq.com/s/au_xxxxxxx \ -H "Origin: https://www.example.com" \ --data-urlencode "name=Test Person" --data-urlencode "email=test@example.com" \ --data-urlencode "message=Hello" --data-urlencode "_honeypot=" \ --data-urlencode "_redirect=https://www.example.com/thanks.html" ``` ### JSON Expect `200` and `{"ok":true,"id":"sub_..."}`. ```sh 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":""}' ``` ### Multipart ```sh curl -i https://api.contactusiq.com/s/au_xxxxxxx \ -H "Origin: https://www.example.com" -H "Accept: application/json" \ -F "name=Test Person" -F "email=test@example.com" -F "message=Hello" -F "_honeypot=" ``` ### Idempotency key A repeat within 10 minutes returns the same id and creates nothing. `_idempotency` as a field works the same way. ```sh curl https://api.contactusiq.com/s/au_xxxxxxx \ -H "Origin: https://www.example.com" \ -H "Content-Type: application/json" -H "Accept: application/json" \ -H "Idempotency-Key: order-1234-contact" \ --data '{"name":"Test Person","email":"test@example.com","message":"Hello","_honeypot":""}' ``` ### Honeypot negative test Expect `200` and nothing in the inbox. ```sh curl -s -o /dev/null -w "%{http_code}\n" https://api.contactusiq.com/s/au_xxxxxxx \ -H "Origin: https://www.example.com" \ --data-urlencode "name=Bot" --data-urlencode "email=bot@example.com" \ --data-urlencode "message=spam" --data-urlencode "_honeypot=http://spam.example" ``` ### Form schema The field list and validation rules of a published form, no auth: ```sh curl https://api.contactusiq.com/f/au_xxxxxxx/schema ``` ### Expected results | Request | Result | | --- | --- | | Form-encoded | `200`, HTML body | | With `_redirect` | `303`, `location: https://www.example.com/thanks.html` | | JSON or multipart with `Accept: application/json` | `200`, `{"ok":true,"id":"sub_..."}` | | Idempotency key twice | one inbox entry, identical `id` | | Honeypot filled | `200`, nothing in the inbox | | Six requests in ten minutes from one IP | `429` with `retry-after: ` | | Wrong form id | `404` | | Missing required field | `400`, JSON body names the field when `Accept: application/json` | | Body over 64 KB | `413` | --- # Feedback widget > One script tag adds a floating icon that opens a panel to ask a question, give feedback, report a problem or suggest an idea, with page context captured automatically. Section: Guides. URL: https://developers.contactusiq.com/feedback-widget. Raw: https://developers.contactusiq.com/md/feedback-widget.md The feedback widget is a form delivered as a floating icon in the corner of an app page. A click opens a small panel; the visitor picks an intent, writes a message and sends without leaving the page. It is the same intake pipeline as every other form, so it inherits domain verification, CAPTCHA, spam screening, delivery, the inbox and analytics. What it adds is structured context about where the visitor was and what they meant. Sample: [`samples/js-embed/widget.html`](/samples/js-embed/README.md). ### The script tag ```html ``` Put it in the shared layout so it is on every page, or only on the pages you want. `au_xxxxxxx` must be the id of a form whose kind is **feedback widget** (Dashboard, Forms, New, Feedback widget). `GET /f/{formPublicId}/widget.js` is cached at the edge and posts to the same `POST /s/{formPublicId}` endpoint with intent, rating and page context added. ### Data attributes Any attribute you leave out falls back to the setting on the form, so the owner can change behaviour without a deploy. | Attribute | Value | Purpose | | --- | --- | --- | | `data-form` | form public id | Which form to post to. Shown for clarity; the id is also in the script URL. | | `data-position` | `bottom-right`, `bottom-left`, `inline` | Where the icon sits. `inline` means you render your own trigger (below). | | `data-intents` | comma-separated subset of `question,feedback,problem,idea` | Which intents the panel offers. | | `data-rating` | `none`, `thumbs`, `stars` | Rating control for the feedback intent. Thumbs-only is the "was this helpful?" mode, where the text field appears on thumbs down. | | `data-app-version` | any string | Your release identifier. Reported with problems so a bug digest can group identical page and version pairs. | | `data-user-id` | your user id | For signed-in users. Stored plain or hashed, per the form's identity setting. | | `data-user-name` | display name | Pre-fills the panel so the visitor does not retype it. | | `data-user-email` | email address | Pre-fills the panel. | ### Your own trigger Set `data-position="inline"` and give any element `data-contactusiq-open`, optionally with `data-contactusiq-intent`, to open the panel from your own button: ```html ``` ### Intents | Intent | `_intent` value | What it is for | | --- | --- | --- | | Ask a question | `question` | Support questions. With suggested answers on (Pro), the panel searches the owner's registered docs URL as the visitor types and shows up to three articles before the send button; answered questions count as deflections. | | Give feedback | `feedback` | Opinions and ratings. Offers the 1 to 5 or thumbs rating. | | Report a problem | `problem` | Bug reports. Carries browser, OS, page and app version so reports group into a bug digest. | | Suggest an idea | `idea` | Feature requests. | Each intent has its own field preset and can have its own recipients, auto-reply and subject prefix. A client that is not the widget can send `_intent` and `_rating` as ordinary fields; see [Reserved fields](/api/intake#reserved-fields). ### Page context captured Captured automatically and shown to the visitor before sending: page URL and title, referrer, viewport, browser and OS, locale, time on page, and the app version when `data-app-version` is set. The owner chooses which of these fields are captured and whether they are shown to the visitor. In the inbox a widget submission shows its intent as a badge, the rating, and the page it came from, and can be filtered by any of them ("problems reported on /pricing this week"). Analytics gains a per-page view: submissions by page, rating trend per page, question deflection rate and problems by app version. ### Consent and privacy notes - The widget sets no cookies of its own and loads deferred; it never blocks the host page if the script fails to load. - Signed-in identity is only passed when the host sets the `data-user-*` attributes, and the owner chooses whether the user id is stored plain or hashed. - Screenshots (later, Pro) are captured client-side only after the visitor agrees in the panel, stored as an attachment and never inlined in email. - The panel carries the one-click privacy line naming the owner and ContactUsIQ and linking to both policies. - Turnstile's own storage is strictly necessary for the challenge; see [Cookies and consent](/privacy#cookies-and-consent). ### Behaviour and quality bar - Keyboard reachable, focus trapped in the panel while open, labelled for screen readers, honours reduced motion. - Under 20 KB compressed. - Offline: if the intake API is unreachable the panel queues the submission in local storage and retries when the page is next online, so a bug report about an outage is not lost to the outage. - After sending: inline thank-you with the reference id, an optional "we usually reply within a day" line from the form settings, and an optional email confirmation to the visitor (Phase 2). ### Settings that live in the dashboard These are set on the form's Widget tab, not in code: | Setting | Options | Default | | --- | --- | --- | | Placement | bottom-right, bottom-left, inline trigger | bottom-right | | Intents shown | any subset of question, feedback, problem, idea | question, feedback | | Rating | none, thumbs, 1 to 5 stars | none for question, thumbs for feedback | | Identity | ask name and email, use host-provided identity, anonymous allowed | ask | | Context | which context fields to capture; whether to show them to the visitor | all, shown | | Suggested answers | off, on with docs URL | off | | Screenshot | off, on with consent prompt | off | | Routing | recipients per intent | form's recipients | | Appearance | accent colour, icon (chat, question, lightbulb, bug), label text, dark mode auto | chat icon, "Feedback" | ### Where it is used ContactUsIQ's own dashboard shows the widget on every screen with the current screen name pre-filled as context, and this docs site is meant to run the "was this helpful?" mode on every article (it is switched on once the founder workspace's widget form exists). --- # Domain verification > Prove ownership of a domain with a DNS TXT record, an HTML meta tag or a well-known file. Re-checked daily; subdomains inherit. Section: Guides. URL: https://developers.contactusiq.com/domain-verification. Raw: https://developers.contactusiq.com/md/domain-verification.md Ownership verification answers one question: may this workspace receive enquiries from forms on this domain? It is required for every domain. It is separate from **sending authority** (may ContactUsIQ send email as this domain?), which is optional and covered in [Email and deliverability](/email-deliverability). A form can only be published on a verified domain, and the intake API only accepts submissions whose `Origin` or `Referer` matches a verified domain of the form. ### The three methods The wizard issues one token per domain: 32 random bytes, shown once, rotated on request. Only a hash is stored. | Method | Record or file | Best for | Re-checked | | --- | --- | --- | --- | | DNS TXT (recommended) | Host `_contactusiq.example.com`, type `TXT`, value `contactusiq-verify=` | Anyone with registrar access; survives site rebuilds | Every 24 h | | HTML meta tag | `` in the head of the home page | Static sites where DNS is managed by someone else; WordPress (the plugin writes it) | Every 24 h, fetched over HTTPS | | Well-known file | `https://example.com/.well-known/contactusiq.txt` containing the token | Sites with a public folder and no head access | Every 24 h | #### DNS TXT ```text Host: _contactusiq.example.com Type: TXT Value: contactusiq-verify=a1b2c3d4e5f6... ``` Some registrars want only the label in the host field (`_contactusiq`) and append the domain themselves; others want the full name. Leave the TTL at the default. The wizard shows registrar-specific instructions. #### HTML meta tag ```html ``` The tag must be on the home page of the exact hostname being verified and reachable over HTTPS. #### Well-known file ```text https://example.com/.well-known/contactusiq.txt ``` The file body is the token, and nothing else. ### How the check works - Lookups go over DNS over HTTPS to two public resolvers (Cloudflare and Google), and both must agree. A stale cache on the wizard's side cannot produce a false positive. - The wizard polls every 30 seconds for 15 minutes after you add the record, then backs off to the daily check. - Each attempt is stored with the resolver, the records seen and the outcome, which is what feeds the plain-language messages such as "we found 2 TXT records at `_contactusiq`, neither matches". - The management API exposes the same actions: `POST /v1/domains/{id}/verify` triggers a check now and `GET /v1/domains/{id}/records` returns the records to add (see [Management API](/api/management), planned). ### Re-check cadence Every verified domain is re-checked every 24 hours. If the check fails on 3 consecutive days the domain drops to **unverified**, its forms pause, and the owner is emailed. Restoring the record restores the domain on the next check, or immediately with **Recheck now** in the dashboard. ### Subdomain inheritance `www.example.com`, `app.example.com` and any other child of a verified domain inherit the parent's verification. Inheritance applies only to children of a verified apex, so verifying `app.example.com` does not verify `example.com`. Verify the apex once and every subdomain is covered. ### Common errors and fixes | What the wizard says or what you see | Likely cause | Fix | | --- | --- | --- | | "No TXT record found at `_contactusiq.example.com`" | The record was added under the wrong host, for example `_contactusiq.example.com.example.com` because the registrar appends the domain, or the record has not propagated yet | Check the host field in the registrar; wait a few minutes and let the 30-second poll catch it | | "We found N TXT records, none match" | An old token from a previous attempt, a typo, or quotes copied into the value | Replace the value with the current token exactly as shown; remove stale records | | Meta tag not found | The tag is on a different page than the home page, a redirect (for example apex to `www`) serves a different hostname, or the tag is injected by JavaScript after load | Put the tag in the server-rendered head of the exact hostname; verify the hostname the redirect lands on, or verify the apex and rely on inheritance | | Well-known file not found | The hosting platform blocks or rewrites paths under `/.well-known/`, or the file is served with a redirect | Confirm the URL returns `200` with the token as the body; on platforms with a routing layer, add an explicit route for the file | | Domain dropped to unverified after being verified | The record was removed in a DNS clean-up, the site was rebuilt without the tag, or a CDN now serves a cached page without it | Restore the record or tag; prefer the TXT method, which survives site rebuilds | | Submissions return `200` but never arrive | The page is served from an unverified hostname (a preview URL, `localhost`, a staging domain) | Test on the verified domain or add the staging domain to the workspace; the form can also be set to allow any origin for development | ### Trust boundaries Verification proves control of the website, and (from Phase 2) recipient double opt-in proves control of the inbox. Together they mean nobody can receive mail through ContactUsIQ without proving both, which is what stops the free tier being used to relay spam to strangers. --- # Email and deliverability Status: Phase 2 > Sending modes, the DNS records for own-domain sending through Amazon SES, the deliverability doctor, the visitor acknowledgement and reachability, and what is never done. Section: Guides. URL: https://developers.contactusiq.com/email-deliverability. Raw: https://developers.contactusiq.com/md/email-deliverability.md **Everything on this page is Phase 2.** Phase 1 is portal-only: no email leaves the system, and no mail sub-processor exists. When email arrives it is sent through Amazon SES in ContactUsIQ's own AWS account, in the same region as the workspace's cell. ### Sending modes | Mode | From header | Reply-To | DNS the owner adds | Deliverability | | --- | --- | --- | --- | --- | | Portal only (Phase 1, and later for owners who want no email) | none: nothing is sent | none | none | Not applicable. Enquiries are read in the inbox with Web Push and unread badges. | | Managed sender (default from Phase 2, Free) | `Example enquiries ` | visitor's address | none | Good. ContactUsIQ owns SPF, DKIM and DMARC for `mail.contactusiq.com` and its reputation. | | Own domain (Pro) | `Example enquiries ` | visitor's address | the records below | Best. Mail aligns with the recipient's own domain, so corporate filters trust it. | The From name is the workspace name; the form name goes in the subject. On the Free plan the email footer carries "Sent via ContactUsIQ". Email is sent by a worker, never inside the intake request. Every submission is stored first, so an SES outage becomes a retry, not a lost lead. Delivery attempts per notification are capped at 6 with exponential backoff over 24 hours. ### Records for own-domain sending The wizard shows these with copy buttons and registrar-specific screenshots (Cloudflare, GoDaddy, Route 53, Namecheap, VentraIP, Crazy Domains). | Purpose | Type | Host | Value | | --- | --- | --- | --- | | DKIM signing key, 1 of 3 | CNAME | `._domainkey.example.com` | issued by SES Easy DKIM for your domain | | DKIM signing key, 2 of 3 | CNAME | `._domainkey.example.com` | issued by SES Easy DKIM | | DKIM signing key, 3 of 3 | CNAME | `._domainkey.example.com` | issued by SES Easy DKIM | | SPF authorisation | TXT | `example.com`, or a dedicated subdomain such as `mail.example.com` | `v=spf1 include:amazonses.com include:_spf.contactusiq.com ~all` | | DMARC policy | TXT | `_dmarc.example.com` | `v=DMARC1; p=quarantine; rua=mailto:dmarc@contactusiq.com; pct=100` | | Custom bounce domain (optional) | MX | `mail.example.com` | provider bounce host | SES Easy DKIM issues three CNAMEs per domain; the selectors and targets are shown in the wizard and are unique to your domain. The private key never leaves SES; the CNAMEs delegate it. #### Use a dedicated sending subdomain The wizard recommends sending from `mail.example.com` or `enquiries.example.com` rather than the apex. Two reasons: a customer's existing SPF record is often already near the 10-lookup limit and stays untouched, and a bad day for ContactUsIQ cannot hurt the main domain's reputation. If the domain already has a DMARC record, the wizard reads it and only suggests adding ContactUsIQ's `rua` address rather than replacing the policy. #### Management API `/v1/sending-domain` (get, create, `POST /verify`, `POST /test-send`) mirrors the wizard. See [Management API](/api/management) (planned). ### The deliverability doctor After any DNS change, one click sends a test enquiry to the owner and shows the parsed `Authentication-Results` header: - SPF: pass or fail - DKIM: pass or fail, with the selector that signed - DMARC: alignment result - a plain-language fix for each failure, for example the exact `_dmarc` TXT record to add and why Gmail and Outlook quarantine mail without one The same check runs daily. If a previously passing record breaks, the owner is alerted. The `SendingDomainHealthChanged` event feeds this. ### Visitor acknowledgement and reachability Every accepted enquiry sends a short acknowledgement to the visitor's address. That email doubles as a live check that the address exists, and the result sets the submission's reachability. | Outcome | Set by | Effect in the product | | --- | --- | --- | | Reachable | acknowledgement delivered | Green badge "email confirmed by delivery"; normal inbox; reply draft prepared; the answer bot may act | | Unreachable | no MX record, disposable domain, hard bounce, or complaint | Auto-tag "Unreachable: address bounced"; moved to the Unreachable view; no draft; excluded from response-time metrics; one line in the digest; the owner can override with "treat as reachable" if a phone number is present | | Unconfirmed | soft bounce still failing after 24 h, or acknowledgements turned off | Grey badge; normal inbox; draft prepared; flagged in the digest if unanswered | | Engaged (later) | visitor replies to the acknowledgement or clicks the reference link | Raised in the inbox order; counted as a warm lead | Flow: address checks (syntax, MX lookup, disposable-domain list); no MX or disposable means unreachable with no acknowledgement sent. Otherwise the acknowledgement goes out from the workspace sender; delivered means reachable; a hard bounce (5xx, no such user) means unreachable; a soft bounce (mailbox full, greylisted) retries for up to 24 hours then becomes unconfirmed; a complaint suppresses the address and marks it unreachable. #### Rules for the acknowledgement - On by default per form, with an owner-editable template: reference id, what happens next, the owner's expected reply time, and "if this was not you, ignore this email". Sent from the workspace's sending domain or the managed sender, with Reply-To set to the form's first recipient so a visitor reply lands with the owner and is threaded onto the enquiry. - **Never echoes the visitor's message body.** Echoing user text in an automatic reply turns the form into a backscatter spam tool (an attacker submits spam text with a victim's address). At most the form name and the reference id appear. - Sent only for accepted submissions, never for spam-hidden or rejected ones, and never more than one per address per hour and three per day across a workspace, so a bot cannot use the acknowledgement to flood a third party. - The JavaScript embed and the widget also run the syntax and MX check while the visitor types and offer a typo fix ("did you mean gmail.com?"), which removes most bounces before they happen. - The acknowledgement and the answer bot share one outbound channel per enquiry: when the bot answers in auto-reply mode its answer is the acknowledgement, so the visitor never receives two emails. - Recipient-side bounces are handled separately: if the owner's own recipient address bounces, that recipient is paused, the owner is alerted on every channel available, and the enquiry stays visible in the inbox so nothing is lost. In the data model this is `reachability` (reachable, unreachable, unconfirmed, engaged) and `reachability_reason` on submissions, a `visitor_ack` channel on notifications, and the events `VisitorAckDelivered`, `VisitorAckBounced` and `SubmissionMarkedUnreachable`. ### Recipients A recipient is an email address in a workspace, shared by any number of forms. Adding one sends a confirmation email (double opt-in); email flows only after the link is clicked. A recipient can be paused per recipient. Plan limits: 2 recipients per form on Free, 10 on Pro, unlimited on Business. The management API: `/v1/recipients` (list, create, delete, `POST /{id}/resend-confirmation`). ### What is never done - The visitor's address is never the From header. It is always Reply-To. Sending as the visitor would fail their domain's DMARC policy and train spam filters against the owner. - No email leaves for a recipient who has not confirmed, even on a verified domain. Both the recipient's confirmation and the domain's verification are checked at delivery time, not just at setup. - No DKIM private key is ever shown to the customer; SES holds it and the CNAMEs delegate it. - No tracking pixels in emails on any plan. - The acknowledgement never contains the visitor's own message text. ### Inbound events SES delivery, bounce and complaint notifications arrive through SNS and update the notification's status after the SNS signature is verified. This is the platform's inbound webhook; customers do not configure anything for it. --- # API overview > Two APIs on two hostnames. The public intake API is unauthenticated by design; the management API needs a workspace API key. Section: API reference. URL: https://developers.contactusiq.com/api. Raw: https://developers.contactusiq.com/md/api/index.md | API | Base URL | Authentication | Status | | --- | --- | --- | --- | | [Public intake API](/api/intake) | `https://api.contactusiq.com` | None. Protected by domain verification, origin checks, CAPTCHA and rate limits. | Phase 1 contract | | [Management API](/api/management) | `https://app.contactusiq.com/v1` | `Authorization: Bearer ` or a dashboard session | Planned | | [Webhooks](/api/webhooks) | your URL | Events signed with HMAC-SHA256 and a timestamp | Planned (Phase 2) | The machine-readable contract is [openapi.yaml](/openapi.yaml) (OpenAPI 3.1). Operations that are not yet live carry `x-status: planned`. ### Why the intake API has no key A form on a static site has nowhere to hide a secret. Instead of a key, a submission is accepted only when the `Origin` or `Referer` matches a verified domain of the form, the honeypot is empty, the Turnstile token verifies server-side, and the request is within rate limits. A request that fails any of these still gets a success-looking `200`, so a bot learns nothing; the true outcome is in the inbox. ### Conventions - Hostnames: `api.contactusiq.com` for intake, `app.contactusiq.com` for the dashboard and management API. Per-cell intake hostnames such as `api.eu.contactusiq.com` exist for firewall allow-lists. - The form public id carries the cell prefix (`au_`, `eu_`, `us_`) and the global edge routes on it without a lookup. - Responses are JSON when the request carries `Accept: application/json`; otherwise the intake API answers with HTML. - Rate-limited responses are `429` with a `Retry-After` header in seconds. - Idempotency: an optional `Idempotency-Key` header or `_idempotency` field de-duplicates double clicks for 10 minutes. - The client IP is taken from the platform's trusted edge header, never from user-supplied headers. ### Rate limits | Scope | Limit | | --- | --- | | Per IP per form | 5 per 10 minutes | | Per form | 60 per minute | | Per workspace | daily ceiling by plan | Plan quotas count accepted submissions only, so a bot flood never spends the customer's monthly allowance. ### Plans and API access | Plan | Webhooks and API | | --- | --- | | Free | none | | Pro | 3 webhooks, API read | | Business | unlimited webhooks, API read and write | The intake API is available on every plan. --- # Public intake API > The one URL every site posts to, the related embed, widget and schema endpoints, reserved fields, response codes and request rules. Section: API reference. URL: https://developers.contactusiq.com/api/intake. Raw: https://developers.contactusiq.com/md/api/intake.md Base URL `https://api.contactusiq.com`. No authentication. This is the Phase 1 contract that every sample targets. ### Endpoints | Endpoint | Accepts | Returns | Notes | | --- | --- | --- | --- | | `POST /s/{formPublicId}` | `application/x-www-form-urlencoded`, `multipart/form-data`, `application/json` | HTML thank-you page, `303` redirect to the form's thank-you URL, or JSON `{ok, id}` when the request has `Accept: application/json` | The one URL every site uses. Field names are free-form; see reserved fields below. | | `OPTIONS /s/{formPublicId}` | preflight | CORS headers for the form's verified domains only | JSON submissions from browsers need this; HTML posts do not. | | `GET /f/{formPublicId}/embed.js` | none | JavaScript | Renders the form with the workspace's theme, loads Turnstile, submits by fetch, shows an inline thank-you. Cached at the edge. | | `GET /f/{formPublicId}/widget.js` | none | JavaScript | Floating feedback icon and panel. Posts to the same intake endpoint with intent, rating and page context added. Cached at the edge. | | `GET /f/{formPublicId}/schema` | none | JSON field list and validation rules | Lets a React site build its own UI while staying in sync with the form definition. | | `GET /f/{formPublicId}/answers?q=` | query text | JSON list of matching help articles | Pro. Powers the widget's suggested answers from the owner's registered docs URL. Planned. | ### Submit ```text POST https://api.contactusiq.com/s/au_xxxxxxx Origin: https://www.example.com Content-Type: application/json Accept: application/json {"name":"Test Person","email":"test@example.com","message":"Hello","_honeypot":""} ``` ```json { "ok": true, "id": "sub_..." } ``` Form-encoded and multipart bodies carry the same fields. Without `Accept: application/json` the success response is the hosted HTML thank-you page, or a `303` to `_redirect` when that field is set. #### Reserved fields | Field | Purpose | | --- | --- | | `_honeypot` | Hidden input that must stay empty. A filled value is silently rejected. | | `_redirect` | Optional absolute URL. When set, a successful submit answers `303 See Other` with `Location` set to it. | | `_subject` | Optional subject prefix for the notification. | | `_intent` | `question`, `feedback`, `problem` or `idea`. Set by the feedback widget; any client may send it. | | `_rating` | Optional rating: `1` to `5`, or `up` / `down`. | | `_page` | Optional URL of the page the form was on. The embed and widget set it automatically. | | `cf-turnstile-response` | The Cloudflare Turnstile token, verified server-side with the client IP. | | `_idempotency` | Optional key that de-duplicates repeats for 10 minutes. The `Idempotency-Key` header does the same. | Every other field name is yours (`name`, `email`, `phone`, `company`, ...). Required fields and maximum lengths come from the form definition and are enforced server-side. #### Response codes | Status | When | | --- | --- | | `200` | Accepted, or silently rejected (spam, origin, honeypot) so bots learn nothing. HTML thank-you page by default, or `{"ok":true,"id":"sub_..."}` with `Accept: application/json`. | | `303` | `_redirect` was set; `Location` is your thank-you URL. | | `400` | Malformed body or missing required field. `{"ok":false,"error":"..."}` with `Accept: application/json`. | | `404` | Unknown or unpublished form id. | | `413` | Body over 64 KB (without attachments). | | `429` | Rate limited. `Retry-After` header in seconds. | #### Request rules - Body limit 64 KB without attachments. - `Origin` or `Referer` must match a verified domain of the form, unless the form explicitly allows any origin (for native apps and development). Subdomains of a verified domain count. - The Turnstile token is verified server-side. A form without the widget on the page runs at "strict" heuristics. - Rate limits: 5 per IP per form per 10 minutes; 60 per form per minute; a per-workspace daily ceiling by plan. - The client IP is taken from the platform's trusted header, never from `X-Forwarded-For` supplied by the caller. - The published form definition is cached at the edge for 60 seconds, so a change in the dashboard can take up to a minute to apply. #### What is stored Payload, IP (full for 30 days, then a salted hash), country and city, user agent, referrer, UTM parameters, timestamp, spam score, verdict, rejection reason and status, plus intent, rating and page context for widget submissions. See [Concepts](/concepts#submissions-and-client-context). ### Embed script ```html
``` `data-target` is a CSS selector for the element to render into; omit it to render where the script sits. Served with Subresource Integrity hashes. See [JavaScript embed](/integrations/js-embed). ### Widget script ```html ``` Attributes: `data-form`, `data-position`, `data-intents`, `data-rating`, `data-app-version`, `data-user-id`, `data-user-name`, `data-user-email`. See [Feedback widget](/feedback-widget). ### Schema ```sh curl https://api.contactusiq.com/f/au_xxxxxxx/schema ``` Returns the form's field list and validation rules as JSON. The exact shape is published with the form builder; use it to render your own UI and stay in sync with the dashboard. ### CORS `OPTIONS /s/{formPublicId}` answers with CORS headers only for the form's verified domains. A JSON `fetch` from an unverified origin fails at the preflight; an HTML `form` post is not subject to CORS and is instead silently dropped on the origin check. --- # Management API Status: Planned > Workspace-scoped resources behind a Bearer API key at app.contactusiq.com/v1. Planned; the resources and operations below are the ones the spec lists. Section: API reference. URL: https://developers.contactusiq.com/api/management. Raw: https://developers.contactusiq.com/md/api/management.md **Status: planned.** The management API is not live. This page lists the resources and operations exactly as the product spec defines them so integrations can be designed against them. Request and response bodies are not yet specified; [openapi.yaml](/openapi.yaml) carries each operation with `x-status: planned`. ### Authentication ```text GET https://app.contactusiq.com/v1/forms Authorization: Bearer ``` An API key is scoped to one workspace, stored hashed, and carries a visible prefix for identification. Keys can be rotated without downtime. The dashboard session works for the same endpoints; the management API and the dashboard share one service layer, so nothing is reachable from the dashboard that is not also reachable with a key. Plan access: none on Free; API read on Pro; API read and write on Business. ### Resources HTTP verbs below follow REST conventions for the operation names in the spec (list `GET` on the collection, create `POST`, get `GET /{id}`, update `PATCH /{id}`, delete `DELETE /{id}`, named actions `POST /{id}/{action}`). #### `/v1/domains` | Operation | Request | | --- | --- | | list | `GET /v1/domains` | | create | `POST /v1/domains` | | get | `GET /v1/domains/{id}` | | delete | `DELETE /v1/domains/{id}` | | verify (trigger a check now) | `POST /v1/domains/{id}/verify` | | records (the DNS records to add) | `GET /v1/domains/{id}/records` | #### `/v1/recipients` (Phase 2) | Operation | Request | | --- | --- | | list | `GET /v1/recipients` | | create (sends confirmation) | `POST /v1/recipients` | | delete | `DELETE /v1/recipients/{id}` | | resend confirmation | `POST /v1/recipients/{id}/resend-confirmation` | #### `/v1/forms` | Operation | Request | | --- | --- | | list | `GET /v1/forms` | | create | `POST /v1/forms` | | get | `GET /v1/forms/{id}` | | update | `PATCH /v1/forms/{id}` | | publish | `POST /v1/forms/{id}/publish` | | archive | `POST /v1/forms/{id}/archive` | | snippet | `GET /v1/forms/{id}/snippet` | #### `/v1/submissions` | Operation | Request | | --- | --- | | list with filters (form, domain, status, date range, spam) | `GET /v1/submissions` | | get | `GET /v1/submissions/{id}` | | mark read | `POST /v1/submissions/{id}/read` | | archive | `POST /v1/submissions/{id}/archive` | | mark spam | `POST /v1/submissions/{id}/spam` | | mark not spam | `POST /v1/submissions/{id}/not-spam` | | export CSV | `GET /v1/submissions/export` | #### `/v1/notifications` (Phase 2) | Operation | Request | | --- | --- | | list per submission | `GET /v1/notifications?submission={id}` | | retry | `POST /v1/notifications/{id}/retry` | #### `/v1/sending-domain` (Phase 2) | Operation | Request | | --- | --- | | get | `GET /v1/sending-domain` | | create | `POST /v1/sending-domain` | | verify | `POST /v1/sending-domain/verify` | | test send | `POST /v1/sending-domain/test-send` | One sending domain per workspace. #### `/v1/webhooks` (Phase 2) | Operation | Request | | --- | --- | | list | `GET /v1/webhooks` | | create | `POST /v1/webhooks` | | delete | `DELETE /v1/webhooks/{id}` | | test | `POST /v1/webhooks/{id}/test` | Events are signed with HMAC-SHA256 and retried 6 times. See [Webhooks](/api/webhooks). #### `/v1/usage` | Operation | Request | | --- | --- | | current period counts against plan limits | `GET /v1/usage` | #### `/v1/admin/*` (platform admins only) Workspaces, domains, suspensions, plan overrides, provider health and the audit log. Requires the platform role; every action is written to the audit log with the acting account and persona. Not available to workspace API keys. ### Inbound webhooks the platform receives These are not customer-facing but explain what updates the resources above: | Source | Purpose | | --- | --- | | Amazon SES via SNS (Phase 2) | delivery, bounce and complaint notifications update notifications | | Stripe | subscription created, updated, cancelled, payment failed update subscriptions | | Turnstile | none; verification is a synchronous call from the intake function | ### WordPress plugin usage The WordPress plugin already calls `POST /v1/domains/{id}/verify` with its site-scoped key and a JSON body `{"method":"meta","site":""}`, and expects a `status` and `message` in the response. The site-scoped key type and the Connect page are `TODO(spec)` on the server side. --- # Webhooks Status: Planned > Outbound events to your URL, signed with HMAC-SHA256 and a timestamp and retried 6 times. Planned for Phase 2. Section: API reference. URL: https://developers.contactusiq.com/api/webhooks. Raw: https://developers.contactusiq.com/md/api/webhooks.md **Status: planned (Phase 2).** Webhooks are how enquiries reach a CRM, a helpdesk, Slack or Zapier, Make and n8n. ContactUsIQ is not a CRM or a helpdesk; it forwards. ### Registering Managed through `/v1/webhooks` (list, create, delete, `POST /{id}/test`) or the dashboard. A webhook has a customer URL, an HMAC secret, an event filter and a dead-letter counter. Plan limits: none on Free, 3 on Pro, unlimited on Business. ### Events The event catalogue is published with the Phase 2 release. The domain events in the spec are the candidates, and the Zapier, Make and n8n triggers named in the spec are "new enquiry", "new theme" and "recommendation accepted": | Domain event | Raised when | | --- | --- | | `SubmissionReceived`, `SubmissionAccepted`, `SubmissionRejected` | a submission is received, accepted or rejected | | `NotificationScheduled`, `NotificationDelivered`, `NotificationBounced`, `NotificationComplained` | delivery progresses | | `VisitorAckDelivered`, `VisitorAckBounced`, `SubmissionMarkedUnreachable` | the visitor acknowledgement resolves | | `DomainVerified`, `DomainVerificationFailed` | a verification check completes | | `SendingDomainHealthChanged` | a DKIM, SPF or DMARC check changes result | | `QuotaWarning`, `QuotaExceeded` | usage reaches 80% or 100% of the plan | Which of these are exposed to webhooks, and the payload shapes, are `TODO(spec)`. ### Signature Every delivery is signed with HMAC-SHA256 over a timestamp and the raw request body, using the webhook's secret, and the timestamp is sent alongside the signature so a captured request cannot be replayed later. To verify: 1. Read the timestamp and signature from the request headers. 2. Reject the request if the timestamp is older than your tolerance (five minutes is usual). 3. Compute `HMAC_SHA256(secret, timestamp + "." + rawBody)` and compare it to the signature with a constant-time comparison. 4. Only then parse the body. The header names and the exact signed string are `TODO(spec)` and will be fixed in openapi.yaml when the feature ships; the pattern above (timestamp plus raw body, constant-time comparison, replay window) is the design. Node.js sketch: ```js import { createHmac, timingSafeEqual } from 'node:crypto'; export function verify(secret, timestamp, rawBody, signature) { const ageSeconds = Math.abs(Date.now() / 1000 - Number(timestamp)); if (!Number.isFinite(ageSeconds) || ageSeconds > 300) return false; const expected = createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex'); const a = Buffer.from(expected, 'hex'); const b = Buffer.from(String(signature), 'hex'); return a.length === b.length && timingSafeEqual(a, b); } ``` Always verify against the raw body bytes, before any JSON parsing or re-serialisation. ### Retries A delivery that does not get a `2xx` is retried 6 times. A webhook that keeps failing increments its dead-letter counter, and the dashboard shows it. Make your handler idempotent on the event id: retries can deliver the same event more than once. ### Respond fast Return `2xx` as soon as the event is stored and do the work afterwards. Slow handlers hit the delivery timeout and are retried, which duplicates work. --- # Spam and security > Eight defence layers cheapest first, the honeypot rules, server-side Turnstile verification, rate limits, origin checks and why rejections look like success. Section: Trust. URL: https://developers.contactusiq.com/spam-and-security. Raw: https://developers.contactusiq.com/md/spam-and-security.md The biggest risk for a free form relay is not spam reaching the owner; it is strangers using the service to send spam to people who never asked for it. Domain verification plus (from Phase 2) recipient double opt-in closes that: nobody can receive mail through ContactUsIQ without proving control of both the website and the inbox. The layers below deal with the spam that still arrives at a legitimate form. ### The eight layers, cheapest first | Layer | Check | Cost | Outcome | | --- | --- | --- | --- | | 1 Edge | Body size, content type, known bad user agents, missing `Origin` on JSON | none | drop | | 2 Honeypot | Hidden field filled | none | silent reject | | 3 Origin | `Origin` or `Referer` not on the form's verified domains | none | silent reject | | 4 Rate limit | Per IP per form: 5 per 10 minutes; per form: 60 per minute; per workspace daily ceiling by plan | Redis call | `429` or silent reject | | 5 CAPTCHA | Turnstile token verified server-side with the client IP | one HTTPS call | reject on failure; forms without the widget run at "strict" heuristics | | 6 Heuristics | Link count, URL-only messages, disposable-email domains, repeated payload hash, language mismatch with the site, per-form block list | in-process | score 0 to 1 | | 7 AI verdict (Pro) | A language model classifies spam, scam, sales pitch or genuine and explains why | one API call, only when the score is in the grey zone | score refined, category and urgency attached | | 8 Owner feedback | Mark spam or not spam in the inbox | none | trains the per-workspace threshold and the shared reputation list | The **sensitivity** setting per form (Relaxed, Normal, Strict) moves the threshold at which a scored submission is hidden as spam rather than delivered. Hidden submissions are still stored for 30 days so a false positive can be rescued from the inbox. ### Honeypot rules - The field is named `_honeypot` and must arrive empty. A filled value is a silent reject. - Hide it with CSS (off-screen or `display:none`), not with `type="hidden"`: bots that fill every text input will then fill it too. Add `tabindex="-1"`, `autocomplete="off"` and `aria-hidden="true"` on the wrapper so real visitors and screen readers skip it. - Autofill extensions occasionally fill hidden inputs. The off-screen position and `autocomplete="off"` make that rare; if a real visitor reports a lost message, that is the first thing to check. - The embed and widget scripts add their own honeypot; you only need one in hand-written forms. ### Turnstile, verified server-side The Turnstile site key is public and goes in the page. The secret never leaves the intake function, which calls Cloudflare's `siteverify` with the token and the client IP. The token arrives as the `cf-turnstile-response` field, which the managed widget injects into the form automatically. Clients that render Turnstile with the explicit API pass the token themselves and should reset the widget after every attempt so a retry gets a fresh token. Turnstile is invisible for most humans and needs no cookie banner in most jurisdictions: it sets no ContactUsIQ cookies, and its own storage is strictly necessary for the challenge. If Turnstile is unreachable the intake API falls back to heuristics-only mode rather than failing closed, so an outage at Cloudflare never loses a lead. hCaptcha can be added as a second adapter for customers who ask; Turnstile is the only CAPTCHA until then. ### Rate limits | Scope | Limit | Behaviour | | --- | --- | --- | | Per IP per form | 5 per 10 minutes | `429` with `Retry-After` in seconds | | Per form | 60 per minute | `429` | | Per workspace | daily ceiling by plan | silent reject beyond the ceiling | Counters live in Redis and are allowed to be approximate. Plan quotas that matter for billing count accepted submissions only and are recomputed from Postgres nightly, so a bot attack cannot exhaust a customer's allowance. At 100% on Free, submissions are still stored and shown in the inbox; only email delivery pauses. ### Origin checks The `Origin` header (or `Referer` for HTML posts) must match a verified domain of the form or one of its subdomains. JSON requests from browsers also hit the `OPTIONS` preflight, which returns CORS headers for verified domains only. A form can be set to allow any origin for native apps and development. The client IP used everywhere is the one from the platform's trusted edge header; caller-supplied `X-Forwarded-For` is ignored. ### Silent rejects A rejected submission (honeypot, origin, spam score above the threshold, over the workspace ceiling) returns the same success-looking `200`, thank-you page or `303` as an accepted one. Bots learn nothing from the response. The rejection and its reason are recorded, shown in the analytics and, for spam-scored messages, kept 30 days in the hidden view. The only non-success responses are `400` (malformed), `404` (no such form), `413` (too large) and `429` (rate limited). ### Security controls - Tenant isolation by Postgres Row Level Security on `workspace_id`; the service role key is used only by the intake function and the worker, never by the browser. - API keys and verification tokens are stored hashed. Keys carry a visible prefix and can be rotated without downtime. - The Turnstile secret, a least-privilege IAM credential for SES and the Stripe secret live in environment variables scoped to production; previews use test keys. - Webhooks out are signed with HMAC-SHA256 and a timestamp; webhooks in (SES via SNS, Stripe) are verified with the provider's signature before any database write. - A Content Security Policy and standard security headers are applied to the dashboard. The embed script is served with Subresource Integrity hashes. - Admin actions require the platform role, are logged to the audit log with the acting account and persona, and impersonation is read-only. - Attachments (later) are scanned, size-capped, served through signed URLs and never inlined in email. ### Your side of the contract - Keep the honeypot and never pre-fill it. - If you set a CSP, allow `https://api.contactusiq.com` in `script-src` and `connect-src` and `https://challenges.cloudflare.com` in `script-src` and `frame-src`. - Do not proxy submissions through your server unless you must; it makes every visitor share your server's IP for rate limits. - Add the privacy line under the form. See [Privacy](/privacy). --- # Privacy, GDPR and data residency > Who is controller and processor, what is kept for how long, erasure and export, the sub-processor list, and how data residency cells keep enquiries in one region. Section: Trust. URL: https://developers.contactusiq.com/privacy. Raw: https://developers.contactusiq.com/md/privacy.md ### Roles The visitor's data is processed to deliver their enquiry to the site owner. For enquiry data the **site owner is the controller and ContactUsIQ is the processor**. For account, billing and platform-admin data ContactUsIQ is the controller. A short Data Processing Addendum (GDPR Art. 28) is accepted by clicking at sign-up and is downloadable from Settings; it is published for Pro customers. The owner's lawful basis for enquiries is usually legitimate interest or contract; ContactUsIQ's basis for account data is contract; marketing emails to owners need consent and no opt-in is pre-ticked. ### Compliance posture Australian Privacy Act principles first, and GDPR from day one, because a single EU visitor submitting a form on any customer's site brings it into scope. Australia has no EU adequacy decision, so storing EU enquiries in Australia is an international transfer that needs a legal basis, which is the strongest reason the EU cell exists. The UK GDPR mirrors these rules for UK visitors. ### Transparency Visitors must be told who processes their message and where. A one-click privacy line under every form and in the widget names the owner and ContactUsIQ and links to both policies. Owners add their privacy-policy link on the form footer in one click. ### Retention | Data | Retention | | --- | --- | | Full IP address | 30 days for abuse investigation, then nulled. A salted hash and the country stay for analytics. Pro owners can shorten this. | | Submissions | 30 days on Free, 12 months on Pro, 3 years and configurable on Business. Unlimited on the internal Founder plan. | | Spam-hidden submissions | 30 days, then deleted. | | Rejected submissions | Kept for analytics, hidden from the inbox by default. | | Workspace deletion | Purges the cell's data within 30 days, including backups on a documented rotation. | Deletion is real deletion, and export is available first. Page context fields captured by the widget are switchable per form (data minimisation). ### Data subject rights: erasure and export Access, rectification, erasure, restriction and portability for visitors are answered within one month using tooling in the dashboard: - **Search by email** across all forms in a workspace. - **One-click export** of a visitor's submissions. - **One-click erasure** that also purges embeddings, drafts, attachments and delivery logs, and writes a tombstone so backups are purged on rotation. These mechanisms are built in Phase 2 alongside the retention jobs. CSV export of submissions is also available through `/v1/submissions` (export CSV) on the management API (planned). ### Automated decisions Spam verdicts and auto-replies are automated. They must not produce legal or similarly significant effects, and visitors can always reach a human: auto-replies are signed as automated with a "still need help?" escalation, spam-hidden messages are kept 30 days and rescuable, and there is no profiling beyond the enquiry. ### Cookies and consent - The plain HTML embed sets no cookies. The embed script and the widget set no ContactUsIQ cookies. - Turnstile may set a cookie for challenge state. Its storage is strictly necessary for the challenge. Suggested sentence for your cookie notice: "Our contact form uses Cloudflare Turnstile to block automated abuse; Turnstile may store a strictly necessary token in your browser for the duration of the check." - No tracking pixels in emails on any plan. ### Breach notification The controller is notified without undue delay so they can meet their own 72-hour duty: an incident runbook, an owner alert by email and in-app within 24 hours of confirmation, with the affected submission ids. ### Sub-processors Published with regions; 30 days' notice by email before a new one is added. Where a sub-processor is outside the EU (Turnstile verification, model calls) the DPA carries Standard Contractual Clauses and a transfer assessment. | Sub-processor | Purpose | Region | | --- | --- | --- | | Vercel | Web runtime for the dashboard, docs and intake API; functions pinned per cell | per cell (Australia by default) | | Supabase | Postgres, auth, realtime, storage; one project per cell | per cell (Australia by default) | | Cloudflare (Turnstile) | CAPTCHA verification | global | | Upstash | Redis for rate limits and quotas | per cell | | Amazon Web Services (SES) | Email sending, from Phase 2 | same region as the cell (ap-southeast-2 for Australia, eu-central-1 for the EU) | | Stripe | Billing | global | | Model provider | AI verdicts, categories, drafted replies (Pro) | provider region closest to the cell where offered; prompts carry message text and page context only | Resend is not used. ### Data residency cells A workspace is pinned to one **cell** for life. A cell is a complete data plane in one region: a Supabase project, Vercel functions pinned to that region, a Redis instance and the email provider's matching region. Australia is the default and the only cell at launch; a customer can ask for another region at sign-up or later. | Rule | Detail | | --- | --- | | Choosing a cell | Sign-up asks "Where should your data live?" with Australia preselected. Free: Australia only. Pro: may request EU or US. Business: any listed cell, and a new cell can be stood up for a contract. | | Provisioning | A runbook, not a click. The first customer in a new region waits at most one business day. A cell is created only when a paying customer asks. | | What stays global (Australian control plane) | Account email and OAuth identities, workspace name and cell id, plan and Stripe customer id, audit log entries (actions, not enquiry content). Disclosed at sign-up and in the DPA. | | What never leaves the cell | Submissions, page context, attachments, embeddings and themes, knowledge items, reply drafts and sent replies, delivery logs, database backups. | | Routing | The form public id carries the cell prefix (`au_`, `eu_`, `us_`); the global edge routes on it with no cross-region call. Per-cell hostnames such as `api.eu.contactusiq.com` exist for firewall allow-lists. | | Moving a workspace | Business plan: an export-freeze-import job between cells with a short write freeze; form ids are reissued with the new prefix and the old ids redirect for 90 days. | | Analytics and AI | Run inside the cell; model calls go to the provider's region closest to the cell where one is offered. | | Email | The delivery worker sends through SES in the same AWS region as the cell, so email content never leaves the region. | | Platform admin | Admin reads of enquiry content go through the cell's own API and are logged in the global audit log. | An EU representative (Art. 27) is appointed when the EU cell is provisioned. A DPO is not required at this scale and is revisited at 50 business customers. --- # 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. Section: Agents. URL: https://developers.contactusiq.com/for-ai-agents. Raw: https://developers.contactusiq.com/md/for-ai-agents.md 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](/llms.txt) | An index of this site's pages with one-line summaries and links to the raw markdown. | | [/llms-full.txt](/llms-full.txt) | Every page of this site concatenated in reading order, with headings. One fetch, whole contract. | | [/openapi.yaml](/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](/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 ```text 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 minute ``` ### Procedure 1. **Identify the stack** of the site you are editing and pick the matching sample folder under [samples/](/samples/README.md): `html-form`, `js-embed`, `json-fetch`, `react`, `nextjs`, `astro`, `wordpress-shortcode` (or `apps/wp-plugin`), `curl`. Each has a README with numbered steps and a "For AI agents" paragraph. 2. **Ask for, or locate, the form public id** (`au_xxxxxxx` in 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. 3. **Replace `au_xxxxxxx`** everywhere in the copied files. The prefix is part of the id; keep whatever prefix the real id has (`au_`, `eu_`, `us_`). 4. **Keep the honeypot.** A text input named `_honeypot`, empty, hidden with CSS (not `type="hidden"`), `tabindex="-1"`, `autocomplete="off"`. Do not remove it and do not pre-fill it. 5. **Add Turnstile** where the sample has it: the `div.cf-turnstile` with the site key and the `https://challenges.cloudflare.com/turnstile/v0/api.js` script 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. 6. **Set `_redirect`** to 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. 7. **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-For` and `User-Agent` and pass the upstream status and `Retry-After` through unchanged (see the Next.js sample's `route.ts`). 8. **Confirm the domain is verified.** If it is not, tell the owner which record to add: TXT at `_contactusiq.` with value `contactusiq-verify=`, or the meta tag, or the well-known file. See [Domain verification](/domain-verification). 9. **Test with curl** from a shell, using a verified domain as `Origin`: ```sh 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 it `type="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 to `POST /v1/domains/{id}/verify` is the one documented client and its server side is `TODO(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": ```html ``` Add `data-user-id`, `data-user-name` and `data-user-email` from the session for signed-in users. Details: [Feedback widget](/feedback-widget).