---
title: Public intake API
description: The one URL every site posts to, the related embed, widget and schema endpoints, reserved fields, response codes and request rules.
---

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
<div id="contactusiq-form"></div>
<script src="https://api.contactusiq.com/f/au_xxxxxxx/embed.js" data-target="#contactusiq-form" async defer></script>
```

`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
<script src="https://api.contactusiq.com/f/au_xxxxxxx/widget.js"
  data-form="au_xxxxxxx" data-position="bottom-right"
  data-intents="question,feedback,problem" data-app-version="1.0.0" async defer></script>
```

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.
