# Formzed API reference (v1)

> Plain-text reference for developers and AI coding assistants (Claude, ChatGPT, Cursor, Copilot). Human-friendly version: https://www.formzed.com/api-docs. OpenAPI 3.1 spec: https://www.formzed.com/openapi.json. Create and manage API keys: https://www.formzed.com/dashboard/api-keys.

## Overview

The Formzed API lets your own code work with Formzed:

- **Forms**: list, read, create, edit, publish and copy forms.
- **Responses**: submit, import, read, edit and delete responses; erase one person's data by email.
- **Prefilled links**: links that open a form with answers already filled in.
- **Payments**: payments taken through your forms (read only).
- **AI**: ask questions about a form's responses and get summaries (uses AI credits).
- **AI Research**: studies, interviews, transcripts and summaries.
- **Webhooks**: Formzed POSTs a signed event to your URL when something happens.

**Base URL (API v1):** `https://api.formzed.com/v1`

Every path below (like `/v1/forms`) is relative to `https://api.formzed.com`. So `GET /v1/forms` is `GET https://api.formzed.com/v1/forms`. (Older function URLs still work; use api.formzed.com for anything new.)

### Three ways to connect

| Option | Runs in | API key | Use it for |
|---|---|---|---|
| 1. Server API (API v1) | Your server, scripts, no-code tools (Zapier, Make, n8n HTTP steps) | Yes, kept secret | Reading and writing forms, responses, payments and more from your own systems |
| 2. Your own website form: `POST https://api.formzed.com/forms/submit` | The visitor's browser, on your website | No | Your own HTML form, styled your way |
| 3. Embed the hosted form: `<iframe>` | An iframe on your page | No | Everything, including file uploads, payments and bookings |

**API keys are secret.** A key can read and change your forms and responses. Never put an API key in browser JavaScript, a web page or a mobile app: anyone can read the page source and use it. Keep keys on your server, for example in an environment variable named `FORMZED_API_KEY`. For forms on a website, use option 2 or 3.

## Quickstart

1. **Create an API key** in Dashboard → API (https://www.formzed.com/dashboard/api-keys) and choose its permissions (for this quickstart: Read only plus `responses:write`, or Full access). The full key is shown once, so copy it right away. Keys start with `fz_`.
2. **Find the form and its field ids.** `GET /v1/forms` lists your forms; `GET /v1/forms/:id` returns `fields`, and each field's `id` is the key for its answer. The form must be published to take responses.
3. **Submit a response** with `POST /v1/forms/:id/responses`. A `201` with an `id` means it is saved.

```bash
# 1. Your forms and their ids
curl "https://api.formzed.com/v1/forms?status=published" \
  -H "X-API-Key: $FORMZED_API_KEY"

# 2. One form's questions: use fields[].id as answer keys
curl "https://api.formzed.com/v1/forms/FORM_ID" \
  -H "X-API-Key: $FORMZED_API_KEY"

# 3. Submit a response
curl -X POST "https://api.formzed.com/v1/forms/FORM_ID/responses" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "data": { "field-1712345678901": "Jane Cooper", "field-1712345678902": "jane@example.com" } }'
```

### Node.js (18 or later)

```js
// Runs on your server. Never ship this code to a browser.
const API = "https://api.formzed.com/v1";

async function formzed(method, path, body) {
  const res = await fetch(API + path, {
    method,
    headers: {
      "X-API-Key": process.env.FORMZED_API_KEY,
      ...(body ? { "Content-Type": "application/json" } : {}),
    },
    body: body ? JSON.stringify(body) : undefined,
  });
  const json = await res.json();
  if (!res.ok) throw new Error(`Formzed ${res.status} ${json.code}: ${json.error}`);
  return json;
}

// 1. Find the form and its field ids
const { data: forms } = await formzed("GET", "/forms?status=published");
const { data: form } = await formzed("GET", `/forms/${forms[0].id}`);
console.log(form.fields.map((f) => `${f.id}: ${f.label}`));

// 2. Submit a response
const { data: saved } = await formzed("POST", `/forms/${form.id}/responses`, {
  data: { [form.fields[0].id]: "Jane Cooper" },
});
console.log("Saved response", saved.id);
```

### Python

```python
import os
import requests

API = "https://api.formzed.com/v1"
HEADERS = {"X-API-Key": os.environ["FORMZED_API_KEY"]}

def formzed(method, path, body=None):
    res = requests.request(method, API + path, headers=HEADERS, json=body, timeout=30)
    data = res.json()
    if not res.ok:
        raise RuntimeError(f"Formzed {res.status_code} {data.get('code')}: {data.get('error')}")
    return data

forms = formzed("GET", "/forms?status=published")["data"]
form = formzed("GET", f"/forms/{forms[0]['id']}")["data"]
saved = formzed("POST", f"/forms/{form['id']}/responses", {"data": {form["fields"][0]["id"]: "Jane Cooper"}})["data"]
print("Saved response", saved["id"])
```

## Authentication and keys

Send the key in a header on every API v1 request:

```
X-API-Key: fz_your_api_key
```

or, the same key as a Bearer token:

```
Authorization: Bearer fz_your_api_key
```

Formzed stores only a hash of each key, so a lost key can't be shown again: rotate it. If a key leaks, turn it off in Dashboard → API right away.

### What a key can reach

A key acts as the user who created it (the key owner).

- **Forms**: the owner's own forms and the team forms they can see in the dashboard. Other accounts' forms answer `404`, as if they didn't exist.
- **Changes** (editing a form, importing, editing or deleting responses, erasure, publishing) need edit rights, exactly as in the dashboard: a workspace owner or admin, or a workspace member for shared forms, or the form's owner while their access to its workspace is "edit". Team viewers, and everyone in an archived or read-only workspace, can only read (`403 FORBIDDEN`), even on forms they created. Only the form's owner can publish it.
- **AI Research**: studies of the owner and of everyone in their workspaces. **Webhooks**: the owner's own.
- A key **limited to one form** can only use that form: it can't create or copy forms (`403 KEY_FORM_RESTRICTED`), can't use AI Research (`403 KEY_RESTRICTED`), and its webhooks stay on that form.
- Plan, limits and AI credits are the owner's (for team plans, the workspace's).

### Permissions (scopes)

Each key has a set of scopes. A request without the needed scope answers `403 INSUFFICIENT_SCOPE` with `required_scope`. Keys made before API v1 have `responses:write` only.

| Scope | Allows | Endpoints |
|---|---|---|
| `responses:read` | Read responses and their uploaded files | `GET /v1/forms/:id/responses`, `GET /v1/responses/:id` |
| `responses:write` | Submit, import and edit responses | `POST /v1/forms/:id/responses`, `POST /v1/forms/:id/responses/import`, `PATCH /v1/responses/:id`, legacy `POST /submit-response` |
| `responses:delete` | Delete responses; erase one person's data by email | `DELETE /v1/responses/:id`, `POST /v1/erasure` |
| `forms:read` | List forms, read their questions and prefilled links | `GET /v1/forms`, `GET /v1/forms/:id`, `GET /v1/forms/:id/prefill-links` |
| `forms:write` | Create, edit, publish and copy forms; create and delete prefilled links | `POST /v1/forms`, `PATCH /v1/forms/:id`, `POST /v1/forms/:id/publish`, `POST /v1/forms/:id/duplicate`, `POST /v1/forms/:id/prefill-links`, `DELETE /v1/prefill-links/:token` |
| `payments:read` | See payments taken through your forms | `GET /v1/payments`, `GET /v1/payments/:id` |
| `ai` | Ask about responses and get summaries (uses AI credits) | `POST /v1/ai/ask`, `POST /v1/ai/summary` |
| `interviews:read` | See AI Research studies, interviews and transcripts | `GET /v1/studies`, `GET /v1/studies/:id`, `GET /v1/studies/:id/interviews`, `GET /v1/interviews/:id` |
| `interviews:write` | Create AI Research studies (drafts) | `POST /v1/studies` |
| `webhooks` | Add, change, test and remove webhook endpoints | every `/v1/webhooks` endpoint |

### Presets

| Preset | Scopes | Good for |
|---|---|---|
| Submit only | `responses:write` | Sending responses from a server or a no-code tool. Can't read anything back. |
| Read only | `responses:read`, `forms:read`, `payments:read`, `interviews:read` | Reporting, exports and syncs. Can't change anything. |
| Full access | all ten scopes | Everything, including deleting, AI and webhooks (the Zapier and Make apps need this). |
| Custom | any you pick | Exactly what one integration needs. |

### Key settings

| Setting | What it does |
|---|---|
| Name | A label so you know where the key is used. |
| Permissions | The scopes above. |
| Form access | All forms the owner can see, or one form. |
| IP allowlist | Optional. Exact IPv4 or IPv6 addresses, or IPv4 ranges in CIDR form (`203.0.113.0/24`). Other addresses get `403 IP_NOT_ALLOWED`. Empty means any IP. |
| Expiry | Never, 30 days, 90 days or 1 year. After it, the key gets `401 API_KEY_EXPIRED`. |
| Daily cap | 100 to 10,000 counted requests per day for this key. Resets at 00:00 UTC. When used up: `429 KEY_DAILY_LIMIT`. |

### Rotating a key

1. In Dashboard → API, rotate the key and choose a grace period: 1 hour, 24 hours or 7 days. You get a new key with the same permissions, form access, IP allowlist, daily cap and expiry.
2. Deploy the new key. Both keys work during the grace period.
3. After the grace period the old key answers `401 API_KEY_ROTATED`.

Good practice: one key per integration; only the scopes it needs; limit it to one form and add an IP allowlist when you can.

A person can have up to 25 active keys and connected apps (apps connected with Sign in with Formzed count; expired keys and rotated keys past their grace period don't). Turn one off or delete it before adding another.

## Conventions

| Topic | Rule |
|---|---|
| Format | JSON in and out. Send `Content-Type: application/json` with a body (2 MB at most). |
| Times | ISO 8601. Times Formzed returns are UTC, like `2026-10-13T18:02:45.123456+00:00`. |
| Ids | UUIDs, except field ids (like `field-1712345678901`) and prefilled link tokens. |
| One item | `{ "data": { ... } }`. Created items answer `201`. Deleted items answer `{ "data": { "id": "...", "deleted": true } }`. |
| Lists | `{ "data": [ ... ], "next_cursor": "..." \| null }`, newest first. `?limit=` 1 to 200 (default 50). Pass `next_cursor` as `?cursor=` for the next page; `null` means the last page. |
| Errors | `{ "error": "<message>", "code": "<CODE>", ...extra }` with an HTTP status. Branch on `code`, never on the message. |
| Request id | Every authenticated reply has an `X-Request-Id` header. Quote it when you contact support. |
| Retries | Send an `Idempotency-Key` header with every POST: a retry with the same key gets the first answer back instead of creating a second item (see below). |
| CORS | The API answers browsers too, but keys must still stay on servers. |
| Root | `GET /v1` (no key) returns `{ "name": "Formzed API", "version": "v1", "docs": "https://www.formzed.com/api-docs" }`. |

### Response headers

Accounts with unlimited API use don't get the limit headers.

| Header | Meaning |
|---|---|
| `X-Request-Id` | A unique id for this request. |
| `X-RateLimit-Limit` | Requests per minute per key on your plan. The whole account (all keys and connected apps together) gets twice that. |
| `X-Monthly-Limit` | This month's API requests: the plan's allowance plus unused API packs, for all keys. |
| `X-Monthly-Remaining` | API requests left this month after this one. |
| `Retry-After` | Seconds to wait. Sent with `RATE_LIMITED` and `ACCOUNT_RATE_LIMITED` (60), `KEY_DAILY_LIMIT` (until 00:00 UTC) and `MONTHLY_LIMIT` (until the 1st). |

### Retrying safely: Idempotency-Key

Zapier, Make and flaky networks retry requests. Add an `Idempotency-Key` header (any unique string up to 255 characters, like a UUID or your own order id) to a POST and Formzed runs it once: a repeat with the same key and the same body within 24 hours gets the first answer back, with the header `Idempotent-Replayed: true`, and doesn't count as a new request.

| Case | What you get |
|---|---|
| First request with a key | Runs normally. The answer is stored for 24 hours (server errors aren't, so those can be retried). |
| Same key, same request | The stored answer: same status and body, plus `Idempotent-Replayed: true`. |
| Same key, different body or endpoint | `422 IDEMPOTENCY_KEY_REUSED`: use a new key for each new request. |
| Same key while the first is still running | `409 IDEMPOTENCY_IN_PROGRESS` with `Retry-After: 2`. |
| Key over 255 characters | `400 INVALID_IDEMPOTENCY_KEY`. |

Keys belong to the API key that sent them. GET, PATCH and DELETE are already safe to repeat and ignore the header.

```bash
curl -X POST "https://api.formzed.com/v1/forms/FORM_ID/responses" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1001" \
  -d '{"data": {"field-1712345678901": "Ada Lovelace"}}'
```

### Paging through a list

```js
async function allResponses(formId) {
  const all = [];
  let cursor = null;
  do {
    const url = new URL(`https://api.formzed.com/v1/forms/${formId}/responses`);
    url.searchParams.set("limit", "200");
    if (cursor) url.searchParams.set("cursor", cursor);
    const res = await fetch(url, { headers: { "X-API-Key": process.env.FORMZED_API_KEY } });
    const body = await res.json();
    if (!res.ok) throw new Error(`Formzed ${res.status} ${body.code}: ${body.error}`);
    all.push(...body.data);
    cursor = body.next_cursor;
  } while (cursor);
  return all;
}
```

## Forms

| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | `/v1/forms` | `forms:read` | List forms |
| GET | `/v1/forms/:id` | `forms:read` | Get a form with its fields |
| POST | `/v1/forms` | `forms:write` | Create a draft form |
| PATCH | `/v1/forms/:id` | `forms:write` | Update a form's draft |
| POST | `/v1/forms/:id/publish` | `forms:write` | Publish a form |
| POST | `/v1/forms/:id/duplicate` | `forms:write` | Copy a form |

### The form object

| Field | Type | Description |
|---|---|---|
| `id` | uuid | The form id. |
| `title`, `description` | string | `description` may be null. |
| `status` | string | `published` or `draft`. |
| `slug`, `url` | string | The custom link name (or null) and the public form address. |
| `edit_url` | string | The form in the Formzed builder, to change its design, logic and other settings (opens for someone signed in who can edit it). |
| `created_at`, `updated_at`, `published_at` | ISO 8601 | `published_at` is null until the first publish. |
| `fields` | Field[] | Single form only. The published version (the draft if never published). Each field: `{ id, type, label, required, options?, description?, placeholder? }`. |
| `draft_fields` | Field[] | Single form only, when the draft has unpublished changes. |

### GET /v1/forms — list forms

Scope `forms:read`. The forms the key can use, newest first: the owner's own forms and the team forms they can see. A key limited to one form lists only that form.

Query: `status` (`published` or `draft`; leave out for both), `limit`, `cursor`.

```bash
curl "https://api.formzed.com/v1/forms?status=published&limit=20" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

```json
{
  "data": [
    {
      "id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
      "title": "Event sign-up",
      "description": "Register for the October meetup.",
      "status": "published",
      "slug": "event-sign-up",
      "url": "https://www.formzed.com/form/event-sign-up",
      "created_at": "2026-10-01T09:12:44.512345+00:00",
      "updated_at": "2026-10-02T16:03:10.118204+00:00",
      "published_at": "2026-10-02T16:03:10.118204+00:00"
    }
  ],
  "next_cursor": null
}
```

Errors: `BAD_REQUEST`.

### GET /v1/forms/:id — get a form

Scope `forms:read`. The form with its questions. `fields` is the published version (the draft if it was never published). When the draft has unpublished changes, `draft_fields` shows the draft too. Use the field ids as answer keys.

```bash
curl "https://api.formzed.com/v1/forms/FORM_ID" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

```json
{
  "data": {
    "id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
    "title": "Event sign-up",
    "description": "Register for the October meetup.",
    "status": "published",
    "slug": "event-sign-up",
    "url": "https://www.formzed.com/form/event-sign-up",
    "created_at": "2026-10-01T09:12:44.512345+00:00",
    "updated_at": "2026-10-02T16:03:10.118204+00:00",
    "published_at": "2026-10-02T16:03:10.118204+00:00",
    "fields": [
      { "id": "field-1712345678901", "type": "text", "label": "Name", "required": true, "placeholder": "Jane Cooper" },
      { "id": "field-1712345678902", "type": "email", "label": "Email", "required": true },
      { "id": "field-1712345678903", "type": "select", "label": "Ticket", "required": false, "options": ["Standard", "VIP"] }
    ]
  }
}
```

Errors: `FORM_NOT_FOUND`.

### POST /v1/forms — create a form

Scope `forms:write`. Creates a **draft** owned by the key's owner. Publish it to start taking responses.

Body:

| Field | Type | Required | Description |
|---|---|---|---|
| `title` | string | yes | Up to 200 characters. |
| `description` | string or null | no | Up to 5,000 characters. |
| `fields` | Field[] | no | The questions, in order. Up to 300. |

Field properties (others are dropped; payment, appointment and scheduling settings and styling are set in the builder):

| Property | Type | Notes |
|---|---|---|
| `id` | string | Optional. 1 to 64 letters, digits, `-` or `_`. Generated when left out (`field-<timestamp><n>`). |
| `type` | string | Required. `text`, `textarea`, `email`, `number`, `tel`, `date`, `select`, `radio`, `checkbox`, `image_choice`, `rating`, `single_checkbox`, `terms`, `signature`, `file`, `image`, `image_upload`, `video_answer`, `address`, `appointment`, `scheduling`, `table`, `calculated`, `nps`, `scale`, `matrix`, `likert`, `ranking`, `time`, `date_range`, `hidden`, and the display blocks `divider`, `statement`, `embed`, `video`. Payment fields can only be added in the builder. |
| `label` | string | The question. Required except for display blocks. Up to 1,000 characters. |
| `required` | boolean | Default false. |
| `placeholder`, `description` | string | Up to 300 and 2,000 characters. |
| `options` | string[] | Choice fields (`select`, `radio`, `checkbox`, `image_choice`) and `ranking` (the items to put in order): 1 to 200 unique options. Required for them. |
| `optionWeights` | object | Choice fields: option → points, for scores and calculated fields. |
| `images` | string[] | `image_choice`: one image URL per option. |
| `min`, `max` | number | Limits for number and similar fields. |
| `maxFileSize`, `allowedFileTypes` | number, string[] | Upload fields: size in MB (1 to 50); any of `pdf`, `docs`, `images`, `all`. |
| `videoMaxDurationSec` | number | `video_answer`: 15 to 300 seconds. |
| `embedUrl`, `videoUrl`, `videoCaption` | string | `embed` and `video` blocks. |
| `termsContent`, `termsFormat` | string | `terms`: the text, and `paragraph` or `list`. |
| `tableColumns` | object[] | `table`: up to 20 columns `{ id, name, type, options?, currencySymbol?, quantityColumnId?, priceColumnId? }`; type is `text`, `number`, `select`, `currency` or `line_total`. |
| `calc` | object | `calculated`: `{ expression, precision?, blank?, min?, max?, bands? }`. |
| `npsSettings` | object | `nps`: `{ lowLabel?, highLabel? }`, the labels under 0 and 10. |
| `scaleSettings` | object | `scale`: `{ min?, max?, step?, minLabel?, maxLabel?, style? }`; style is `buttons` or `slider` (more than 11 points is always a slider). |
| `matrixSettings` | object | `matrix`: `{ rows, columns, multiple? }`: up to 30 statements and 15 answers; `multiple` allows several answers per row. |
| `likertSettings` | object | `likert` (one statement on a labelled scale): `{ points?, preset?, labels?, neutral?, naOption?, naLabel? }`. `points` 5 or 7; `preset` `agreement`, `frequency`, `satisfaction`, `importance`, `likelihood` or `quality` sets the labels; `labels` overrides them, most negative first, one per point (4 or 6 when `neutral` is false, which drops the middle); `naOption` adds an N/A answer. GET shows the labels in use. |
| `timeSettings` | object | `time`: `{ format?, minuteStep? }`; format `12` or `24`. |
| `dateRangeSettings` | object | `date_range`: `{ minDate?, maxDate? }` as `YYYY-MM-DD`. |
| `hiddenKey` | string | `hidden`: the form-link parameter it fills from (`?ref=newsletter`); the label when left out. Never shown to respondents. |
| `conditions` | object[] | Show the field only when these match: `{ fieldId, operator, value?, logic? }`. Operators: `equals`, `not_equals`, `contains`, `not_contains`, `greater_than`, `less_than`, `is_empty`, `is_not_empty`. They must point at other fields of the form. |

```bash
curl -X POST "https://api.formzed.com/v1/forms" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Event sign-up",
    "description": "Register for the October meetup.",
    "fields": [
      { "type": "text", "label": "Name", "required": true },
      { "type": "email", "label": "Email", "required": true },
      { "type": "select", "label": "Ticket", "options": ["Standard", "VIP"] }
    ]
  }'
```

`201 Created`:

```json
{
  "data": {
    "id": "a7d3e9f1-2b4c-4d6e-8f0a-1b3c5d7e9f20",
    "title": "Event sign-up",
    "description": "Register for the October meetup.",
    "status": "draft",
    "slug": null,
    "url": "https://www.formzed.com/form/a7d3e9f1-2b4c-4d6e-8f0a-1b3c5d7e9f20",
    "created_at": "2026-10-14T10:15:02.331846+00:00",
    "updated_at": "2026-10-14T10:15:02.331846+00:00",
    "published_at": null,
    "fields": [
      { "id": "field-17604369023310", "type": "text", "label": "Name", "required": true },
      { "id": "field-17604369023311", "type": "email", "label": "Email", "required": true },
      { "id": "field-17604369023312", "type": "select", "label": "Ticket", "required": false, "options": ["Standard", "VIP"] }
    ]
  }
}
```

Invalid fields answer `400`:

```json
{
  "error": "Some fields aren't valid. See errors.",
  "code": "BAD_REQUEST",
  "errors": [
    { "index": 2, "field_id": "field-17604369023312", "message": "options needs at least one choice" }
  ]
}
```

Errors: `BAD_REQUEST`, `KEY_FORM_RESTRICTED`, `PLAN_LIMIT` (`limit`: `forms` or `questions`).

### PATCH /v1/forms/:id — update a form's draft

Scope `forms:write`. Changes the **draft only**; the live form keeps its published version until you publish again. Allowed for the form's owner and for teammates who can edit it (workspace owners and admins; members for shared forms).

Body (send at least one): `title` (string, up to 200), `description` (string or null, up to 5,000), `fields` (Field[]).

`fields` **replaces the draft's whole question list**, so send every field you want to keep. A field sent with the id and type of a saved field starts from the saved one: properties you leave out stay, `null` removes one, and builder-only settings (payment, styling) are kept.

A form can have only one Payment question. A form made before that rule can have more; a `fields` list that keeps more than one is refused (`422 VALIDATION_FAILED` with `errors: [{ field_id, message }]` for each extra one). Merge them in the builder ("Merge into one Payment question"), or leave the extra ones out to delete them.

```bash
curl -X PATCH "https://api.formzed.com/v1/forms/FORM_ID" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Event sign-up (October)",
    "fields": [
      { "id": "field-1712345678901", "type": "text", "label": "Full name", "required": true },
      { "id": "field-1712345678902", "type": "email", "label": "Email", "required": true },
      { "id": "field-1712345678903", "type": "select", "label": "Ticket", "options": ["Standard", "VIP", "Student"] }
    ]
  }'
```

`200 OK`: the form, with `fields` (still the published version) and `draft_fields` (your new draft):

```json
{
  "data": {
    "id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
    "title": "Event sign-up (October)",
    "status": "published",
    "...": "other form fields",
    "fields": [
      { "id": "field-1712345678901", "type": "text", "label": "Name", "required": true, "placeholder": "Jane Cooper" }
    ],
    "draft_fields": [
      { "id": "field-1712345678901", "type": "text", "label": "Full name", "required": true, "placeholder": "Jane Cooper" },
      { "id": "field-1712345678902", "type": "email", "label": "Email", "required": true },
      { "id": "field-1712345678903", "type": "select", "label": "Ticket", "required": false, "options": ["Standard", "VIP", "Student"] }
    ]
  }
}
```

Errors: `BAD_REQUEST`, `FORM_NOT_FOUND`, `FORBIDDEN`, `VALIDATION_FAILED`, `PLAN_LIMIT`.

### POST /v1/forms/:id/publish — publish a form

Scope `forms:write`. No body. Puts the current draft live as a new version. Only the form's **owner** can publish (`403 FORBIDDEN` otherwise). The form needs at least one field, valid calculated fields and at most one Payment question (`422 VALIDATION_FAILED` with `errors: [{ field_id, message }]`); a form that takes payments needs a priced item and the owner's connected Stripe account (`422 STRIPE_NOT_CONNECTED`).

```bash
curl -X POST "https://api.formzed.com/v1/forms/FORM_ID/publish" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

`200 OK`: the form (as in `GET /v1/forms/:id`), with `status: "published"` and a new `published_at`.

```json
{ "error": "Add at least one field before publishing.", "code": "VALIDATION_FAILED", "errors": [] }
```

Errors: `FORM_NOT_FOUND`, `FORBIDDEN`, `VALIDATION_FAILED`, `STRIPE_NOT_CONNECTED`.

### POST /v1/forms/:id/duplicate — copy a form

Scope `forms:write`. No body. Creates a new draft "Copy of <title>" from the source form's draft and theme, owned by the key's owner. `201 Created` with the new form (as in `GET /v1/forms/:id`). An older form with more than one Payment question has them merged into one in the copy; when they can't be merged safely (different currencies, for example), nothing is copied (`422 VALIDATION_FAILED`, with the reason).

```bash
curl -X POST "https://api.formzed.com/v1/forms/FORM_ID/duplicate" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

Errors: `FORM_NOT_FOUND`, `KEY_FORM_RESTRICTED`, `VALIDATION_FAILED`, `PLAN_LIMIT`.

## Responses

| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | `/v1/forms/:id/responses` | `responses:read` | List a form's responses |
| GET | `/v1/responses/:id` | `responses:read` | Get a response |
| POST | `/v1/forms/:id/responses` | `responses:write` | Submit a response |
| POST | `/v1/forms/:id/responses/import` | `responses:write` | Import up to 500 responses |
| PATCH | `/v1/responses/:id` | `responses:write` | Edit a response |
| DELETE | `/v1/responses/:id` | `responses:delete` | Delete a response |
| POST | `/v1/erasure` | `responses:delete` | Erase a person's data by email |

### The response object

| Field | Type | Description |
|---|---|---|
| `id`, `form_id` | uuid | The response and its form. |
| `submitted_at` | ISO 8601 | When it was submitted (the original time for imports). |
| `is_draft` | boolean | `true` for unfinished answers (only with `include_drafts=true`, on forms with "Collect unfinished answers" on). |
| `answers` | object | Answers keyed by field id. File answers are links that open for 24 hours. |
| `answers_by_label` | object | The same answers keyed by question label. Address and appointment answers become an object of their parts; a repeated label gets the field id added: `"Label (field-id)"`. |
| `computed` | object | Calculated fields: `{ "<field id>": { "value": 42, "band": "High" } }`. |
| `source` | string | `form` (hosted form or your website form), `api`, or `api_import`. |
| `payment_status` | string or null | `pending`, `paid`, `refunded`, or null. |
| `quality` | object | The response quality check: `{ checked, low_quality, flags: [{ kind, label, reason, field_id? }], seconds }`. `kind` is `speeder`, `bot`, `straight_line`, `gibberish` or `duplicate`; `seconds` is how long it took (null when unknown). |
| `excluded` | boolean | `true` when the form's team excluded it from results (it's kept, never deleted). `excluded_at` says when. |

### Answer format (for `data`)

Keys are **field ids** (not labels). Answers are checked exactly like the hosted form.

| Field type | Value to send |
|---|---|
| `text`, `textarea`, `email`, `tel` | String |
| `number`, `rating` | Number (rating 1 to 5) |
| `date` | String, `YYYY-MM-DD` |
| `select`, `radio`, `image_choice` | One of the field's options, spelled exactly as in the form |
| `checkbox` | Array of the field's options |
| `single_checkbox`, `terms` | `true` |
| `file`, `image`, `image_upload`, `video_answer`, `signature` | A link to the file (`https://...`); a signature may also be a `data:image/png;base64,...` image. The API does not upload files. Links into Formzed's own file storage aren't accepted (`422 VALIDATION_FAILED`), except, when editing a response, the links it already has. |
| `address`, `appointment` | One key per part, after the field id: `<id>-street`, `<id>-city`, `<id>-state`, `<id>-zip`, `<id>-country`; `<id>-date`, `<id>-time`. |
| `nps` | Whole number 0 to 10 |
| `scale` | Number inside the field's range |
| `matrix` | Object: row → one column (or an array of columns when `multiple`), e.g. `{"Speed": "Agree"}`. When required, every row needs an answer. |
| `likert` | One of the field's labels (or its N/A label when offered), spelled exactly, e.g. `"Agree"`. Stored as the label; its position comes from the field. |
| `ranking` | Array of the field's options in order, each once |
| `time` | String `HH:MM` (24-hour) |
| `date_range` | Object `{ "from": "YYYY-MM-DD", "to": "YYYY-MM-DD" }` |
| `hidden` | String, at most 500 characters |
| `calculated` | Don't send. Formzed works it out and returns it in `computed`. |
| `payment` | Can't be paid through the API. Use the hosted form. |

Rules: the form must be published and open (past its close date or response limit you get `403` with `code: "FORM_CLOSED"`); required fields need an answer; fields hidden by conditional logic and keys that aren't field ids are dropped; values for calculated fields are ignored.

### GET /v1/forms/:id/responses — list responses

Scope `responses:read`. Submitted responses, newest first. Links to uploaded files are signed and open for 24 hours.

Query: `since` (ISO 8601, submitted at or after), `until` (ISO 8601, submitted at or before), `include_drafts` (`true` also returns unfinished answers on forms that collect them, Pro and up; default false), `include_excluded` (`true` also returns responses the team excluded from results; default false, like the app's exports), `limit`, `cursor`.

```bash
curl "https://api.formzed.com/v1/forms/FORM_ID/responses?since=2026-10-01T00:00:00Z&limit=100" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

```json
{
  "data": [
    {
      "id": "0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e",
      "form_id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
      "submitted_at": "2026-10-13T18:02:45.123456+00:00",
      "is_draft": false,
      "answers": {
        "field-1712345678901": "Jane Cooper",
        "field-1712345678902": "jane@example.com",
        "field-1712345678903": "VIP"
      },
      "answers_by_label": { "Name": "Jane Cooper", "Email": "jane@example.com", "Ticket": "VIP" },
      "computed": {},
      "source": "form",
      "payment_status": null
    }
  ],
  "next_cursor": "MjAyNi0xMC0xM1QxODowMjo0NS4xMjM0NTYrMDA6MDB8MGI5YzJmNGUtN2ExZC00YzNiLTllOGYtNWQ2YTdiOGM5ZDBl"
}
```

Errors: `BAD_REQUEST`, `FORM_NOT_FOUND`.

### GET /v1/responses/:id — get a response

Scope `responses:read`. One response, `{ "data": <response object> }`.

```bash
curl "https://api.formzed.com/v1/responses/RESPONSE_ID" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

Errors: `NOT_FOUND`.

### POST /v1/forms/:id/responses — submit a response

Scope `responses:write`. Saves a response to a published form. It runs the form's automations, sends `response.created` webhooks and counts toward the form owner's monthly responses.

Body: `data` (object, required): the answers keyed by field id.

```bash
curl -X POST "https://api.formzed.com/v1/forms/FORM_ID/responses" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "field-1712345678901": "Jane Cooper",
      "field-1712345678902": "jane@example.com",
      "field-1712345678903": "VIP"
    }
  }'
```

`201 Created` (`computed` holds calculated field results; empty when the form has none):

```json
{ "data": { "id": "0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e", "computed": {} } }
```

`422`:

```json
{
  "error": "Validation failed",
  "code": "VALIDATION_FAILED",
  "errors": [
    { "field_id": "field-1712345678902", "message": "\"Email\" is required" },
    { "field_id": "field-1712345678903", "message": "\"Ticket\" has an option this form does not offer" }
  ]
}
```

Errors: `BAD_REQUEST`, `FORM_NOT_FOUND`, `FORM_NOT_PUBLISHED`, `VALIDATION_FAILED`, `RESPONSE_LIMIT`.

### POST /v1/forms/:id/responses/import — import responses

Scope `responses:write`. Saves up to 500 responses in one request, for example history from another tool. Each row is checked like a normal submission; rows that fail are reported and the rest are saved. The whole call counts as **one** API request, but every saved row counts toward the form owner's monthly responses (in the month you import it). The form must be published.

Body:

| Field | Type | Required | Description |
|---|---|---|---|
| `responses` | object[] | yes | 1 to 500 rows: `{ "data": {...}, "submitted_at"?: "<ISO date>" }`. `submitted_at` keeps the original time and can't be in the future. |
| `run_automations` | boolean | no | Default `false`: imported rows run no automations and send no webhooks. `true` treats each row like a new submission. |

```bash
curl -X POST "https://api.formzed.com/v1/forms/FORM_ID/responses/import" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "responses": [
      { "data": { "field-1712345678901": "Ann Lee", "field-1712345678902": "ann@example.com" }, "submitted_at": "2026-09-01T10:00:00Z" },
      { "data": { "field-1712345678901": "Bob Stone", "field-1712345678902": "bob@example.com" } },
      { "data": { "field-1712345678901": "Cy Park" } }
    ],
    "run_automations": false
  }'
```

`200 OK`:

```json
{
  "data": {
    "imported": 2,
    "ids": ["0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e", "c4d5e6f7-8a9b-4c0d-9e1f-2a3b4c5d6e7f"],
    "failed": [
      {
        "index": 2,
        "code": "VALIDATION_FAILED",
        "error": "Validation failed",
        "errors": [{ "field_id": "field-1712345678902", "message": "\"Email\" is required" }]
      }
    ]
  }
}
```

If the monthly response limit is reached mid-import, the call stops and answers `403 RESPONSE_LIMIT` with what was saved; `stopped_at` is the first row that wasn't imported:

```json
{
  "error": "This form has reached its monthly response limit. 2 row(s) were imported; rows from index 2 on were not.",
  "code": "RESPONSE_LIMIT",
  "imported": 2,
  "ids": ["0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e", "c4d5e6f7-8a9b-4c0d-9e1f-2a3b4c5d6e7f"],
  "failed": [],
  "stopped_at": 2
}
```

Errors: `BAD_REQUEST`, `FORM_NOT_FOUND`, `FORM_NOT_PUBLISHED`, `RESPONSE_LIMIT`.

### PATCH /v1/responses/:id — edit a response

Scope `responses:write`. Merges new answers into a submitted response, then checks the whole response again against the published form (`422 VALIDATION_FAILED` if it no longer passes). Sends `response.updated` webhooks when answers change. Unfinished drafts can't be edited (`400`). Needs edit rights on the form (`403 FORBIDDEN`).

Body: `data` (object, required): answers to change, keyed by field id. `null` clears an answer.

```bash
curl -X PATCH "https://api.formzed.com/v1/responses/RESPONSE_ID" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "data": { "field-1712345678903": "Standard" } }'
```

`200 OK`: `{ "data": <the updated response object> }`.

Errors: `BAD_REQUEST`, `NOT_FOUND`, `FORBIDDEN`, `VALIDATION_FAILED`.

### DELETE /v1/responses/:id — delete a response

Scope `responses:delete`. Deletes the response and its uploaded files. Sends `response.deleted` webhooks. Can't be undone. Needs edit rights on the form (`403 FORBIDDEN`).

```bash
curl -X DELETE "https://api.formzed.com/v1/responses/RESPONSE_ID" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

```json
{ "data": { "id": "0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e", "deleted": true } }
```

Errors: `NOT_FOUND`, `FORBIDDEN`.

### POST /v1/erasure — erase a person's data by email

Scope `responses:delete`. For privacy requests (GDPR, CCPA). On every form the key can change, deletes each response (submitted or draft) and prefilled link that has an answer equal to this email (ignoring case and surrounding spaces), with their uploaded files, and removes the email from payments. Can't be undone.

Body: `email` (string, required).

```bash
curl -X POST "https://api.formzed.com/v1/erasure" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "email": "jane@example.com" }'
```

```json
{
  "data": {
    "deleted": 2,
    "response_ids": ["0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e", "c4d5e6f7-8a9b-4c0d-9e1f-2a3b4c5d6e7f"],
    "payments_redacted": 1,
    "prefill_links_deleted": 0
  }
}
```

Errors: `BAD_REQUEST`.

## Prefilled links

A prefilled link opens your form with answers already filled in, like the person's name and email. The link looks like `https://www.formzed.com/form/<slug or id>?prefill=<token>`. The answers stay on Formzed (the link carries only a random token), and the respondent can still change them. Each time the form opens with the link counts as one use; an expired or used-up link opens the form empty. With the embed, add `&prefill=<token>` to the iframe `src`.

| Method | Path | Scope | What it does |
|---|---|---|---|
| POST | `/v1/forms/:id/prefill-links` | `forms:write` | Create a prefilled link |
| GET | `/v1/forms/:id/prefill-links` | `forms:read` | List prefilled links |
| DELETE | `/v1/prefill-links/:token` | `forms:write` | Delete a prefilled link |

### POST /v1/forms/:id/prefill-links — create a prefilled link

Body:

| Field | Type | Required | Description |
|---|---|---|---|
| `answers` | object | yes | Field id → value, for fields of the published form. Allowed types: `text`, `textarea`, `email`, `tel`, `date` (`YYYY-MM-DD`), `number`, `select`, `radio`, `image_choice`, `checkbox` (a list), `rating` (1 to 5), `single_checkbox` (true or false), `nps`, `scale`, `matrix`, `likert`, `ranking`, `time`, `date_range` (same values as when submitting). Never files, signatures, payments, terms or calculated fields. |
| `label` | string | no | Your own note, up to 120 characters. |
| `expires_in_days` | integer | no | 1 to 365. Default 30. |
| `max_uses` | integer or null | no | 1 to 1,000,000. Default null (no limit). |

```bash
curl -X POST "https://api.formzed.com/v1/forms/FORM_ID/prefill-links" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "answers": {
      "field-1712345678901": "Jane Cooper",
      "field-1712345678902": "jane@example.com",
      "field-1712345678903": "VIP"
    },
    "label": "Jane - VIP invite",
    "expires_in_days": 14,
    "max_uses": 1
  }'
```

`201 Created`:

```json
{
  "data": {
    "token": "4f9a1c2b3d4e5f60718293a4b5c6d7e8",
    "url": "https://www.formzed.com/form/event-sign-up?prefill=4f9a1c2b3d4e5f60718293a4b5c6d7e8",
    "label": "Jane - VIP invite",
    "answers": {
      "field-1712345678901": "Jane Cooper",
      "field-1712345678902": "jane@example.com",
      "field-1712345678903": "VIP"
    },
    "expires_at": "2026-10-28T10:30:00.000+00:00",
    "max_uses": 1,
    "uses": 0,
    "created_at": "2026-10-14T10:30:00.112233+00:00"
  }
}
```

Answers that can't be used answer `400`:

```json
{
  "error": "Some answers can't be prefilled. See errors.",
  "code": "BAD_REQUEST",
  "errors": [{ "field_id": "field-1712345678903", "message": "must be one of the field's options" }]
}
```

Errors: `BAD_REQUEST`, `FORM_NOT_FOUND`.

### GET /v1/forms/:id/prefill-links — list prefilled links

A form's links, newest first: `{ "data": [<link>], "next_cursor": ... }`. Query: `limit`, `cursor`. Errors: `BAD_REQUEST`, `FORM_NOT_FOUND`.

### DELETE /v1/prefill-links/:token — delete a prefilled link

The link stops filling in answers right away. If the key's owner can only view the form, they can delete only links they made.

```bash
curl -X DELETE "https://api.formzed.com/v1/prefill-links/4f9a1c2b3d4e5f60718293a4b5c6d7e8" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

```json
{ "data": { "id": "4f9a1c2b3d4e5f60718293a4b5c6d7e8", "token": "4f9a1c2b3d4e5f60718293a4b5c6d7e8", "deleted": true } }
```

Errors: `NOT_FOUND`, `FORBIDDEN`.

## Payments

Payments taken by your forms through Stripe (Checkout after submit). Read only. Stripe ids and stored file paths are never returned.

| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | `/v1/payments` | `payments:read` | List payments |
| GET | `/v1/payments/:id` | `payments:read` | Get a payment |

### The payment object

| Field | Type | Description |
|---|---|---|
| `id`, `form_id`, `response_id` | uuid | `response_id` may be null. |
| `status` | string | `pending`, `paid` or `refunded`. |
| `amount`, `discount` | number | In the currency's main unit (`49.5` means 49.50). |
| `currency` | string | Lower-case code, like `usd`. |
| `mode` | string | `live` or `test` (Stripe test mode). |
| `items` | object[] | `{ product_id, name, unit_amount, quantity, subtotal, file }`; `file` is `{ name, size }` for digital products, else null. |
| `coupon_code`, `payer_email`, `receipt_url` | string or null | The coupon used, the payer's email and Stripe's receipt link. |
| `created_at`, `paid_at` | ISO 8601 | `paid_at` is null until paid. |

### GET /v1/payments — list payments

Payments on forms the key can use, newest first. Query: `form_id`, `status` (`paid`, `pending`, `refunded`), `mode` (`live`, `test`), `since` and `until` (creation time, both inclusive), `limit`, `cursor`.

```bash
curl "https://api.formzed.com/v1/payments?status=paid&mode=live&limit=50" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

```json
{
  "data": [
    {
      "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
      "form_id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
      "response_id": "0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e",
      "status": "paid",
      "amount": 49,
      "currency": "usd",
      "mode": "live",
      "items": [
        { "product_id": "vip", "name": "VIP ticket", "unit_amount": 49, "quantity": 1, "subtotal": 49, "file": null }
      ],
      "coupon_code": null,
      "discount": 0,
      "payer_email": "jane@example.com",
      "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoV",
      "created_at": "2026-10-13T18:02:51.004812+00:00",
      "paid_at": "2026-10-13T18:03:40.551093+00:00"
    }
  ],
  "next_cursor": null
}
```

Errors: `BAD_REQUEST`, `FORM_NOT_FOUND` (for `form_id`).

### GET /v1/payments/:id — get a payment

`{ "data": <payment object> }`. Errors: `PAYMENT_NOT_FOUND`.

## AI

Ask questions about a form's responses and get summaries, powered by Claude.

| Method | Path | Scope | What it does |
|---|---|---|---|
| POST | `/v1/ai/ask` | `ai` | Ask a question about responses |
| POST | `/v1/ai/summary` | `ai` | Summarize responses |

- Calls use the key owner's **AI credits** (1 credit = 4,000 AI tokens). `credits_used` says how many. With no credits left: `402 CREDITS_EXHAUSTED`.
- The AI reads submitted responses (never drafts), newest first, up to about 120,000 characters. `responses_considered` is how many it read; `responses_total` is how many are in the period.
- Uploaded files appear to the AI by file name only. Respondent text is treated as data, never as instructions.
- With no responses in the period you get a plain answer and `credits_used: 0`. Calls can take up to a minute: use a generous timeout.
- When the model fails or declines: `502 AI_ERROR`.

### POST /v1/ai/ask

Body: `form_id` (uuid, required), `question` (string, required, up to 2,000 characters), `since`, `until` (ISO 8601, inclusive).

```bash
curl -X POST "https://api.formzed.com/v1/ai/ask" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "form_id": "FORM_ID", "question": "What do people say about the venue?", "since": "2026-10-01T00:00:00Z" }'
```

```json
{
  "data": {
    "answer": "Most people who mention the venue like it (14 of 52 responses): it was easy to reach and the room was big enough. 3 of 52 found it too warm.",
    "responses_considered": 52,
    "responses_total": 52,
    "credits_used": 1.284
  }
}
```

Errors: `BAD_REQUEST`, `FORM_NOT_FOUND`, `CREDITS_EXHAUSTED`, `AI_ERROR`.

### POST /v1/ai/summary

Body: `form_id` (uuid, required), `since`, `until` (ISO 8601, inclusive). Returns a summary and the most common themes, each with a count and an example quote copied word for word from a response (`""` when the quote couldn't be confirmed).

```bash
curl -X POST "https://api.formzed.com/v1/ai/summary" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "form_id": "FORM_ID", "since": "2026-10-01T00:00:00Z" }'
```

```json
{
  "data": {
    "summary": "52 people signed up for the October meetup. Most liked the venue (14 of 52), and VIP tickets drew the most questions (9 of 52).",
    "themes": [
      { "name": "Venue praise", "count": 14, "example": "The venue was easy to reach" },
      { "name": "VIP ticket value", "count": 9, "example": "VIP felt expensive for what it included" }
    ],
    "responses_considered": 52,
    "responses_total": 52,
    "credits_used": 1.912
  }
}
```

Errors: `BAD_REQUEST`, `FORM_NOT_FOUND`, `CREDITS_EXHAUSTED`, `AI_ERROR`.

## AI Research

Studies, interviews, transcripts and summaries from AI Research. This is a separate product from forms: these endpoints never touch form data. Keys limited to one form can't use them (`403 KEY_RESTRICTED`).

| Method | Path | Scope | What it does |
|---|---|---|---|
| GET | `/v1/studies` | `interviews:read` | List studies |
| GET | `/v1/studies/:id` | `interviews:read` | Get a study with its guide and screener |
| POST | `/v1/studies` | `interviews:write` | Create a draft study |
| GET | `/v1/studies/:id/interviews` | `interviews:read` | List a study's interviews |
| GET | `/v1/interviews/:id` | `interviews:read` | Get an interview with its transcript |

- Study `status`: `draft`, `live`, `paused` or `finished`. `recruitment`: `own` (your own link, in `public_url`) or `paid` (Paid Research: invite only, `public_url` is null).
- **Privacy**: participants' email, phone, CV and LinkedIn are never returned. Emails and phone numbers typed in answers are replaced with `[email removed]` and `[phone removed]`; name answers are shortened to first name and last initial; contact questions are left out of `screener_answers`.
- **Shared name and email**: in studies with Collect name and email on, a participant can choose to share both on the consent step. Then `participant_name` and `participant_email` are what they typed and `participant_consented_at` is when they agreed; all three are null for everyone else, and for Paid Research. The transcript and summary stay cleaned either way.
- Interview `status`: `active`, `completed`, `abandoned` or `ended_by_owner`. An interview idle for 10 minutes counts as ended: `completed` with at least 3 answers, otherwise `abandoned`.
- Interview `summary`: `{ headline, key_points, sentiment, notable_quotes: [{ quote, context, translation? }] }` (sentiment `positive`, `neutral`, `negative` or `mixed`), or null until the AI has summarized the interview. Quotes keep the respondent's words; quotes not in English also have a `translation`.
- `language` is the language the interview ran in: the one the respondent picked, or the one they switched to in a chat. It's null on interviews from before October 16, 2026, which ran in the study's language.

### GET /v1/studies — list studies

Studies of the key owner and of everyone who shares a workspace with them, newest first. Query: `limit`, `cursor`.

```bash
curl "https://api.formzed.com/v1/studies" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

```json
{
  "data": [
    {
      "id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
      "title": "Onboarding interviews",
      "status": "live",
      "modes": ["chat", "voice"],
      "recruitment": "own",
      "public_url": "https://www.formzed.com/i/k7m2p9qa",
      "created_at": "2026-10-05T11:20:03.918274+00:00",
      "interviews": 18,
      "completed": 15
    }
  ],
  "next_cursor": null
}
```

Errors: `BAD_REQUEST`, `KEY_RESTRICTED`.

### GET /v1/studies/:id — get a study

The list fields plus `idea`, `language`, `other_languages`, `max_minutes`, `updated_at`, `published_at`, `guide` and `screener`.

```json
{
  "data": {
    "id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
    "title": "Onboarding interviews",
    "status": "live",
    "modes": ["chat", "voice"],
    "recruitment": "own",
    "public_url": "https://www.formzed.com/i/k7m2p9qa",
    "created_at": "2026-10-05T11:20:03.918274+00:00",
    "interviews": 18,
    "completed": 15,
    "idea": "Learn what slows new customers down in their first week.",
    "language": "en",
    "other_languages": ["es"],
    "max_minutes": 15,
    "updated_at": "2026-10-06T08:41:19.552108+00:00",
    "published_at": "2026-10-06T08:41:19.552108+00:00",
    "guide": {
      "opening": "Thanks for taking the time to talk with us.",
      "closing": "That's everything I wanted to ask. Thank you!",
      "questions": [
        { "id": "q1", "text": "Walk me through your first day with the product.", "goal": "Find early friction", "probes": ["What did you expect to happen?"] }
      ]
    },
    "screener": {
      "title": "A few quick questions",
      "description": "",
      "questions": [
        { "id": "s1", "type": "radio", "label": "How long have you used the product?", "required": true, "options": ["Under a month", "1-6 months", "Longer"] }
      ]
    }
  }
}
```

Errors: `STUDY_NOT_FOUND`, `KEY_RESTRICTED`.

### POST /v1/studies — create a study

Scope `interviews:write`. Creates a **draft** study owned by the key's owner (15-minute interviews, ages 18 to 65). Review and publish it in the dashboard. Without `questions`, the AI drafts the guide and screener from the idea, which uses **research AI credits** (`402 CREDITS_EXHAUSTED`, `502 AI_ERROR`). With `questions`, English studies get a default opening and closing and the screener is empty.

| Field | Type | Required | Description |
|---|---|---|---|
| `title` | string | yes | Up to 200 characters. |
| `idea` | string | yes | What you want to learn, 10 to 4,000 characters. |
| `questions` | string[] | no | 1 to 12 interview questions, up to 500 characters each. |
| `modes` | string[] | no | Any of `chat`, `voice`, `voice_to_voice`, `video`. Default `["chat"]`. |
| `language` | string | no | The interview language: one of `en`, `es`, `pt`, `fr`, `de`, `it`, `nl`, `ja`, `ko`, `zh`, `hi`, `bn`, `ar`, `tr`, `id`, `ru`, `pl`, `uk`, `vi`, `th`. A regional code such as `pt-BR` is stored as `pt`. Default `en`. |
| `other_languages` | string[] | no | More languages respondents can pick on the first screen, from the same list (`en`, `es`, `pt`, `fr`, `de`, `it`, `nl`, `ja`, `ko`, `zh`, `hi`, `bn`, `ar`, `tr`, `id`, `ru`, `pl`, `uk`, `vi`, `th`). The opening, questions and screener are translated for them. Default `[]`. |

```bash
curl -X POST "https://api.formzed.com/v1/studies" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Onboarding interviews",
    "idea": "Learn what slows new customers down in their first week.",
    "questions": ["Walk me through your first day with the product.", "What almost made you give up?"],
    "modes": ["chat", "voice"]
  }'
```

`201 Created`: the study as in `GET /v1/studies/:id`, with `status: "draft"`, `interviews: 0`, `completed: 0`.

Errors: `BAD_REQUEST`, `KEY_RESTRICTED`, `CREDITS_EXHAUSTED`, `AI_ERROR`.

### GET /v1/studies/:id/interviews — list interviews

Newest first by start time. Query: `status` (`all` default, `completed`, `active`, `abandoned`, `ended_by_owner`), `since` and `until` (start time, inclusive), `limit`, `cursor`.

```bash
curl "https://api.formzed.com/v1/studies/STUDY_ID/interviews?status=completed&limit=20" \
  -H "X-API-Key: $FORMZED_API_KEY"
```

```json
{
  "data": [
    {
      "id": "7e8f9a0b-1c2d-4e3f-9a4b-5c6d7e8f9a0b",
      "study_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
      "respondent_no": 12,
      "participant_name": null,
      "participant_email": null,
      "participant_consented_at": null,
      "status": "completed",
      "mode": "chat",
      "language": "en",
      "started_at": "2026-10-12T15:04:11.204511+00:00",
      "ended_at": "2026-10-12T15:16:52.880312+00:00",
      "answer_count": 7,
      "summary": {
        "headline": "Setup was quick, but inviting teammates was confusing.",
        "key_points": ["Finished setup in under ten minutes", "Could not find where to invite teammates"],
        "sentiment": "mixed",
        "notable_quotes": [{ "quote": "I looked for the invite button for a good five minutes", "context": "Inviting teammates" }]
      },
      "screener_answers": [
        { "label": "How long have you used the product?", "value": "1-6 months" },
        { "label": "First name", "value": "Sam K." }
      ]
    }
  ],
  "next_cursor": null
}
```

Errors: `BAD_REQUEST`, `STUDY_NOT_FOUND`, `KEY_RESTRICTED`.

### GET /v1/studies/:id/report — get a study's report

The study's latest report: `summary`, `themes` (each with `respondent_count`, checked against each person's own words, and `quotes`), `notable_quotes`, `sentiment` (interviews per overall attitude) and `exercises` (MaxDiff, concept-test and rating-scale results counted in code). Respondents appear by number only. `interviews_since_report`: interviews with answers newer than the report (update it in Formzed to include them). `interviews_removed_since_report`: interviews the report counted that were removed since (for example after Formzed's quality review). While it is above 0, `interview_count` and the theme counts leave them out, `summary` is a short note without figures, `sentiment` is all 0 and `exercises` is empty until the report is updated in Formzed.

A MaxDiff item's `score` is (times picked most − times picked least) ÷ times shown, from −100 to 100. A concept test's `preference` says whether the preference is statistically significant (exact binomial test for two concepts, chi-square for more). A rating scale (`kind: "likert"`) gives, per statement, how many picked each point (`distribution`, lowest first, and `percent` of those who picked a point), `dont_know`, the top-two and bottom-two counts and shares, and the `median` point (x.5 when it falls between two).

```json
{
  "data": {
    "study_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
    "report_updated_at": "2026-10-24T08:11:52.238+00:00",
    "interviews_since_report": 0,
    "interviews_removed_since_report": 0,
    "interview_count": 40,
    "summary": "Price is the main reason people cancel; those who stay value skipping a week.",
    "themes": [
      { "title": "Price feels too high for what's in the box", "description": "People compared the weekly price with buying the same ingredients.", "respondent_count": 24, "quotes": [{ "respondent_no": 7, "quote": "For two of us it's more than our normal shop." }] }
    ],
    "notable_quotes": [],
    "sentiment": { "positive": 9, "neutral": 6, "negative": 15, "mixed": 10 },
    "exercises": [
      { "kind": "maxdiff", "question": 4, "question_text": "Which of these matter most to you?", "best_label": "Most important", "worst_label": "Least important", "respondents": 38, "items": [{ "item": "Easy to skip a week", "shown": 114, "best": 52, "worst": 6, "score": 40 }] }
    ]
  }
}
```

Errors: `STUDY_NOT_FOUND`, `REPORT_NOT_FOUND` (no report yet: create it on the study's Report tab), `KEY_RESTRICTED`.

### GET /v1/interviews/:id — get an interview

The interview (as in the list) plus `transcript` (up to 1,000 turns). `role` is `ai` or `respondent`; `question_index` points into the guide's questions.

```json
{
  "data": {
    "id": "7e8f9a0b-1c2d-4e3f-9a4b-5c6d7e8f9a0b",
    "study_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
    "...": "other interview fields",
    "transcript": [
      { "role": "ai", "text": "Walk me through your first day with the product.", "created_at": "2026-10-12T15:04:30.110298+00:00", "question_index": 0, "is_followup": false },
      { "role": "respondent", "text": "Setup was quick, but I looked for the invite button for a good five minutes.", "created_at": "2026-10-12T15:05:41.920113+00:00", "question_index": 0, "is_followup": false }
    ]
  }
}
```

Errors: `INTERVIEW_NOT_FOUND`, `KEY_RESTRICTED`.

## Evaluations (AI Training)

Human evaluation of AI outputs, part of AI Research: create a study, upload files, add items, publish, share the `link` with your raters, then download the ratings as training data. Scopes: `interviews:read` and `interviews:write`. Keys limited to one form get `403 KEY_RESTRICTED`.

- Each rater session counts as one interview of the AI Research plan when the rater finishes all its items. Deleted items and studies still count toward their limits.
- Results hold only counted work: finished sessions that passed the gold and speed checks (or that you kept), from raters you didn't exclude. Every figure is counted in code.
- Raters appear as numbers only (`"rater": 7`): no names, contacts or devices.
- Evaluation studies aren't listed by `/v1/studies`, and their rater sessions aren't interviews (`/v1/interviews/:id` answers 404).

The evaluation object:

```json
{
  "id": "8a1b2c3d-4e5f-4a6b-9c7d-8e9f0a1b2c3d",
  "title": "Support bot: v2 vs v1",
  "task": "pairwise",
  "status": "live",
  "link": "https://www.formzed.com/e/k7m2p9qa",
  "raters_per_item": 3,
  "items_per_session": 30,
  "items": 1200,
  "items_complete": 840,
  "sessions_completed": 96,
  "created_at": "2026-11-24T09:12:44.512345+00:00",
  "updated_at": "2026-11-24T09:30:10.118204+00:00"
}
```

### GET /v1/evaluations — list evaluations

Evaluation studies the key owner can open, newest first. Query: `limit`, `cursor`. Returns `{data: [evaluation], next_cursor}`.

### POST /v1/evaluations — create an evaluation

A draft owned by the key's owner. `201 {data: evaluation}`; `403 PLAN_LIMIT` (`limit: "studies"`) when the free plan's studies are used up.

| Field | Type | Required | Description |
|---|---|---|---|
| `title` | string | yes | Up to 200 characters. |
| `task` | string | yes | `pairwise`, `rubric`, `write_edit`, `task_success`, `media_label`, `translation_check`, `model_chat`, `agent_review` (reviewers mark every step of your agent's recorded runs right, wrong or not needed) `battle` (raters chat with two versions of your model side by side, blind, and pick the better one) or `prompt_write` (raters write prompts from your brief, and the ideal answer when asked). |
| `instructions` | string | no | The rater guide (up to 20,000 characters). |
| `raters_per_item` | integer | no | 3, 4 or 5 (default 3). |
| `items_per_session` | integer | no | 1 to 50 (default by task). |
| `gold_per_session` | integer | no | 0 to 10 gold check items a session. |
| `criteria` | object[] | no | Rubric (required) or chat scores: `{id, label, description?}`. |
| `labels`, `multi_label`, `moments`, `boxes` | object[], boolean, boolean, boolean | no | Media labels `{id, label}`. `boxes: true`: raters draw a labelled box around each thing on images and video frames (several labels per item). |
| `allow_tie`, `reason_required` | boolean | no | Pairwise (both default true). |
| `write_mode`, `review_required` | string, boolean | no | `write` or `edit`; a second check on every answer (default true). |
| `categories`, `max_turns`, `content_warning` | object[], integer, string | no | Chat with your model. The model endpoint is set in the dashboard only; until then publishing answers `NOT_READY`. |
| `reply_scores`, `with_answer` | boolean | no | Chat with your model: raters score every reply 1-5. Write prompts: raters also write the ideal answer. |
| `coverage`, `target_raters` | string, integer | no | `per_item` (default): each item is rated by `raters_per_item` raters. `every_rater`: every rater rates every item in a shuffled order, until `target_raters` raters are counted (1-10,000; Paid Research up to 1,000). Up to 50 items and 60-minute sessions; not for `agent_review`. The item set can't change once the study is live or a rater has started. |
| `qualification` | object | no | `{on, items, pass_share}`: a check before a rater's first real item, on the study's gold items (3-10 of them, passed at 0.5-1). Failing ends the session, not counted or paid; Paid Research participants who pass join your rater pool and skip it in your later studies. |
| `battle_mode` | string | no | Battle: `one_shot` (one message, one vote), `chat` (default: each version keeps its own conversation, one vote at the end) or `every_turn` (a vote on every pair of replies; the picked reply carries on). Both versions (an OpenAI-compatible or Anthropic key with a model and system prompt, or your own endpoint) are connected and tested in the dashboard; keys are stored encrypted. |
| `languages` | string[] | no | Codes raters pick from, like `fr` or `pt-BR`. |

### GET /v1/evaluations/:id — get an evaluation

`{data: evaluation}`. Errors: `EVALUATION_NOT_FOUND` (also for an interview study's id), `KEY_RESTRICTED`.

### POST /v1/evaluations/:id/media — upload a file

Body `{name, mime, bytes, duration_ms?}`. Returns `201 {data: {media_id, name, upload: {method: "PUT", url, headers}, expires_at}}`: `PUT` the file to `upload.url` with the headers given within 2 hours, then complete it. The file must be exactly `bytes` long, and counts against the month's media allowance from the moment the slot is given. Images (png, jpeg, webp, gif) up to 10 MB, audio up to 100 MB, video up to 200 MB. Errors: `BAD_REQUEST`, `MEDIA_LIMIT` (the plan's monthly media allowance, or 10,000 files a study), `FORBIDDEN`, `UPLOAD_RATE_LIMITED`.

### POST /v1/evaluations/:id/media/:media_id/complete — finish an upload

`{data: {media_id, status: "ready"}}`. `409 MEDIA_NOT_UPLOADED` when the file isn't there, or is bigger than declared, than its kind allows or than this month's media allowance; `404 MEDIA_NOT_FOUND` when the evaluation has no file with this id.

### POST /v1/evaluations/:id/items — add items

Up to 1,000 items (2 MB) a request, all or nothing: JSONL with `Content-Type: application/x-ndjson` (the dashboard import's format: `id`, `prompt`, `output_a`/`model_a`/`output_b`/`model_b`, `output`/`model`, `draft`, `task`, `trajectory`, `language`, `gold`, `meta`), or JSON `{"items": [...]}`. Files are referred to by their uploaded name: `{"type": "image", "file": "cat_07.png"}`.

An `agent_review` item is one recorded run: the goal as `prompt`, an optional final answer as `output` (with `model`), and `trajectory`, up to 200 steps of `{kind, text, tool?, input?, output?, file?}` where `kind` is `message`, `thought`, `tool_call`, `tool_result`, `action` or `observation`; a tool call's `input` and a tool result's `output` may be text or JSON, and `file` is a screenshot among the uploaded images. Its `gold` is `{outcome: "done" | "partly" | "failed", first_error: <step> | null}`: a review passes with the same outcome and its first wrong step within one step.

Returns `201 {data: {added, first_seq, last_seq, total_items}}`. `422 VALIDATION_FAILED` with `errors: [{line, field, code, message}]` (nothing is added); `403 ITEM_LIMIT` (`limit: "items"`): a study holds 20,000 items, deleted ones included.

### POST /v1/evaluations/:id/publish — publish

`{data: evaluation}`, or `422 NOT_READY` with `problems: [...]`.

### GET /v1/evaluations/:id/summary — get the figures

`{data: {id, title, status, results}}`: the figures of the dashboard's Results tab, computed in code from counted sessions only. `results` has `totals` (items, gold items, finished items, sessions counted, held and excluded, raters, ratings), `coverage_by_language`, `agreement` (percent and Krippendorff's alpha, by criterion and label), and the block of the study's task, for example `pairwise` (each model's win rate with a 95% interval, head-to-head, first-position share), `rubric` (scores per criterion and per model), `write_edit`, `task_success`, `media_label`, `translation`, `model_chat`, `agent_review` or `battle` (each version's wins by your names for them, ties, both bad, a 95% interval, every_turn's single votes, and how often the left side won); the other tasks' blocks are `null`. Errors: `EVALUATION_NOT_FOUND`, `KEY_RESTRICTED`.

### GET /v1/evaluations/:id/results — get results

A dataset page as text (`application/x-ndjson` or `text/csv; charset=utf-8`), 5,000 rows a page (or `limit`), `X-Next-Cursor` when there's more, `Content-Disposition: attachment`.

| Query | Description |
|---|---|
| `format` | `jsonl` or `csv`. Default: JSONL when the dataset comes as JSONL (labels come as CSV). Steps pages hold 50 runs unless `limit` says otherwise. |
| `dataset` | `preference` (pairwise or battle, JSONL; battles in TRL's conversational format, with `scenario`, `chosen_version` and `rejected_version`), `ideal` (write or fix, JSONL, with `messages` and `prompt`/`completion` for fine-tuning), `prompts` (written prompts, JSONL, with the ideal answer as `completion` and `messages` when asked), `replies` (chats that score each reply: one line per reply with the conversation before it and its score), `labels` (media, CSV, with the boxes drawn), `steps` (agent runs, JSONL: each step with its mark, for process reward models), `matrix` (studies where every rater rates every item: one row per rater, one column per item, CSV or JSONL) or `full` (every rating, CSV or JSONL). Default: the task's first. |
| `min_agreement` | 0 to 1: only items whose raters agree at least this much. |
| `include_held` | `true` to add sessions held for review (default `false`). |
| `per` | Preference: `rating` (default, ties left out) or `item` (the majority pick). Steps: `rating` (default, one line per review) or `item` (one per run, each step's majority mark). |
| `limit` | 1 to 5,000 rows a page (default 5,000). |
| `cursor` | The previous page's `X-Next-Cursor`. |

```
{"prompt":"Summarise this email","chosen":"…","rejected":"…","reason":"Keeps the refund date.","item_id":"p1","chosen_model":"v2","rejected_model":"v1","agreement":1,"rater":3}
```

`409 RESULTS_CHANGED`: new ratings came in between pages; start again without a cursor. CSV cells that start like a formula get a leading apostrophe.

## Webhooks (endpoints)

Manage the endpoints Formzed sends events to. You can do the same in Dashboard → API → Webhooks. Events, payloads and signatures: see "Webhook events" below. All need scope `webhooks`.

| Method | Path | What it does |
|---|---|---|
| GET | `/v1/webhooks` | List webhooks |
| POST | `/v1/webhooks` | Create a webhook (the reply includes the signing secret) |
| GET | `/v1/webhooks/:id` | Get a webhook |
| PATCH | `/v1/webhooks/:id` | Update a webhook |
| DELETE | `/v1/webhooks/:id` | Delete a webhook and its delivery log |
| POST | `/v1/webhooks/:id/test` | Send a test event |
| GET | `/v1/webhooks/:id/deliveries` | List deliveries |

### The webhook object

| Field | Type | Description |
|---|---|---|
| `id` | uuid | The webhook id. |
| `url` | string | Where events are POSTed. |
| `events` | string[] | The events it receives. |
| `form_id` | uuid or null | Only this form's events, or null for every form. |
| `description` | string or null | Your note. |
| `is_active` | boolean | false when you or Formzed turned it off. |
| `disabled_reason` | string or null | Why Formzed turned it off: 50 failures in a row, or the plan no longer includes the API. |
| `consecutive_failures` | integer | Failed attempts in a row. |
| `last_delivery_at`, `last_status` | ISO 8601, integer | The last attempt and its HTTP status (null when there was no answer). |
| `created_at`, `updated_at` | ISO 8601 | |
| `secret` | string | Only in the create reply: `whsec_...`, the signing secret (also shown in the dashboard). |

### GET /v1/webhooks

The key owner's webhooks, newest first (a one-form key sees only that form's). Query: `limit`, `cursor`.

```json
{
  "data": [
    {
      "id": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e",
      "url": "https://hooks.example.com/formzed",
      "events": ["response.created", "payment.succeeded"],
      "form_id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
      "description": "CRM sync",
      "is_active": true,
      "disabled_reason": null,
      "consecutive_failures": 0,
      "last_delivery_at": "2026-10-13T18:03:12.441902+00:00",
      "last_status": 200,
      "created_at": "2026-10-03T08:00:00.120934+00:00",
      "updated_at": "2026-10-03T08:00:00.120934+00:00"
    }
  ],
  "next_cursor": null
}
```

### POST /v1/webhooks

Body:

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | string | yes | A public https URL, up to 2,000 characters. No private or local addresses (also checked by what the host name resolves to), no user name or password (`400 INVALID_URL`, also when the host name can't be checked right now). |
| `events` | string[] | yes | One or more of `response.created`, `response.updated`, `response.deleted`, `payment.succeeded`, `payment.refunded`, `interview.completed`. |
| `form_id` | uuid or null | no | Only this form's events. Leave out or null for every form the owner can see. `interview.completed` needs a webhook without `form_id`. A one-form key always uses its form. |
| `description` | string | no | Your note, up to 200 characters. |

Up to 20 webhooks per account (`403 WEBHOOK_LIMIT`).

```bash
curl -X POST "https://api.formzed.com/v1/webhooks" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.example.com/formzed",
    "events": ["response.created", "payment.succeeded"],
    "form_id": "FORM_ID",
    "description": "CRM sync"
  }'
```

`201 Created`: the webhook object plus `"secret": "whsec_0123456789abcdef0123456789abcdef0123456789abcdef"`. Store the secret to verify signatures.

Errors: `BAD_REQUEST`, `INVALID_URL`, `FORM_NOT_FOUND`, `WEBHOOK_LIMIT`.

### GET /v1/webhooks/:id

`{ "data": <webhook object> }` (no secret). Errors: `WEBHOOK_NOT_FOUND`.

### PATCH /v1/webhooks/:id

Send only what changes: `url`, `events` (replaces the list), `form_id` (uuid or null), `description`, `is_active` (false pauses deliveries; true turns the webhook back on). A new URL resets the failure count; turning a webhook back on clears its `disabled_reason`.

```bash
curl -X PATCH "https://api.formzed.com/v1/webhooks/WEBHOOK_ID" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "events": ["response.created", "response.updated"], "is_active": true }'
```

`200 OK`: `{ "data": <webhook object> }`. Errors: `BAD_REQUEST`, `INVALID_URL`, `FORM_NOT_FOUND`, `WEBHOOK_NOT_FOUND`.

### DELETE /v1/webhooks/:id

```json
{ "data": { "id": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e", "deleted": true } }
```

Errors: `WEBHOOK_NOT_FOUND`.

### POST /v1/webhooks/:id/test

No body. Queues a `webhook.test` delivery, sent within about a minute. Turned-off webhooks answer `409 WEBHOOK_DISABLED`. `201 Created` with the queued delivery:

```json
{
  "data": {
    "id": "9c8d7e6f-5a4b-4c3d-8e2f-1a0b9c8d7e6f",
    "webhook_id": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e",
    "event": "webhook.test",
    "event_id": "cc33dd44-ee55-4f66-8a77-112233445566",
    "status": "pending",
    "attempts": 0,
    "next_attempt_at": "2026-10-14T09:30:00.004821+00:00",
    "response_status": null,
    "last_error": null,
    "created_at": "2026-10-14T09:30:00.004821+00:00",
    "delivered_at": null,
    "payload": {
      "id": "cc33dd44-ee55-4f66-8a77-112233445566",
      "type": "webhook.test",
      "created_at": "2026-10-14T09:30:00.000Z",
      "data": { "message": "This is a test event from Formzed.", "webhook_id": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e" }
    }
  }
}
```

Errors: `WEBHOOK_NOT_FOUND`, `WEBHOOK_DISABLED`.

### GET /v1/webhooks/:id/deliveries

The delivery log, newest first, with the exact payload sent. Query: `status` (`pending` = waiting or retrying, `delivered`, `failed`), `limit`, `cursor`. Delivery fields: `id`, `webhook_id`, `event`, `event_id`, `status`, `attempts`, `next_attempt_at` (only while pending), `response_status`, `last_error`, `created_at`, `delivered_at`, `payload`. `last_error` is a short fixed reason (for example `HTTP 500`, `Connection failed.`, `Timed out after 10 seconds.`, `DNS lookup failed.`), never the network's own error text. Finished deliveries are kept for 30 days.

Errors: `BAD_REQUEST`, `WEBHOOK_NOT_FOUND`.

## Legacy submit endpoint

The original endpoint still works for existing integrations. It does the same as `POST /v1/forms/:id/responses`, with the form id in the body. New integrations should use API v1.

```
POST https://api.formzed.com/submit-response
```

Body: `form_id` (uuid, required), `data` (object, required, answers keyed by field id). Needs the `responses:write` scope (every key made before API v1 has it).

```bash
curl -X POST "https://api.formzed.com/submit-response" \
  -H "X-API-Key: $FORMZED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "form_id": "FORM_ID",
    "data": {
      "field-1712345678901": "Jane Cooper",
      "field-1712345678902": "jane@example.com"
    }
  }'
```

`200 OK`:

```json
{
  "success": true,
  "response_id": "0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e",
  "message": "Response submitted successfully"
}
```

Differences from API v1: success is `200` with `success`, `response_id` and `message`; a key limited to another form gets `403 FORM_NOT_ALLOWED`. Other errors, limits and headers are the same.

## Webhook events

Formzed POSTs a signed JSON event to your URL when something happens, so you don't have to poll.

### Set it up

1. Add an endpoint in Dashboard → API → Webhooks, or with `POST /v1/webhooks`. Pick the events and, optionally, one form. The URL must be public https.
2. Store the signing secret (`whsec_...`) on your server, like an API key.
3. Verify the `Formzed-Signature` header of every request and reject anything that doesn't match.
4. Answer any 2xx within 10 seconds; do slow work after replying. Anything else, including redirects (they aren't followed), counts as a failure and is retried.

### Envelope

Every event: `{ "id", "type", "created_at", "data" }`. `id` is the event id, the same on every retry.

### Events

| Event | When | `data` |
|---|---|---|
| `response.created` | A response is submitted: hosted form, your own website form, or the API. Also when an unfinished draft is submitted. Not sent for imports with `run_automations: false`. | `id`, `form_id`, `form_title`, `submitted_at`, `answers` (by field id), `computed`, `source`, `payment_status` |
| `response.updated` | The answers of a submitted response change (for example `PATCH /v1/responses/:id`). | Same as `response.created` |
| `response.deleted` | A submitted response is deleted: dashboard, API or erasure. | Ids only: `id`, `form_id`, `form_title`, `deleted_at`. Earlier deliveries that carried its answers are removed from the log. |
| `payment.succeeded` | A payment's status becomes `paid`. | `id`, `form_id`, `response_id`, `status`, `amount`, `currency`, `mode`, `items`, `coupon_code`, `discount`, `payer_email`, `receipt_url`, `created_at`, `paid_at` (same as `GET /v1/payments`) |
| `payment.refunded` | A payment's status becomes `refunded`. | Same as `payment.succeeded` |
| `interview.completed` | An AI interview finishes: it reached the end of the guide, or has at least 3 answers. Only sent to webhooks without a `form_id`. | `id`, `study_id`, `study_title`, `status`, `mode`, `started_at`, `ended_at`, `answer_count`, `summary`, `participant_name`, `participant_email`, `participant_consented_at`. The last three are set only when the participant chose to share their name and email (studies with Collect name and email on), otherwise null. No screener answers: emails and phone numbers typed into the summary are removed, as in `/v1`. |
| `webhook.test` | Send test in the dashboard, or `POST /v1/webhooks/:id/test`. | `message`, `webhook_id` |

Who gets what:

- A webhook with a `form_id` gets that form's events. Without one, it gets events for every form its owner can see: their own and their team's shared forms (private teammates' forms only for workspace owners and admins).
- `interview.completed` goes only to webhooks without a `form_id`, for studies of the owner and their workspaces. It's sent once per interview, as soon as the AI summary is saved (so `summary` is included), or within about 10 minutes of the interview ending or going idle if no summary is written. Interviews hidden from the study team (for example a Paid Research interview that failed the quality check) aren't sent, also when they're hidden after the event was queued.
- File links in response events are signed and open for 7 days.
- Webhook deliveries don't count as API requests.

### Example payloads

`response.created`:

```json
{
  "id": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b",
  "type": "response.created",
  "created_at": "2026-10-13T18:02:45.130Z",
  "data": {
    "id": "0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e",
    "form_id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
    "form_title": "Event sign-up",
    "submitted_at": "2026-10-13T18:02:45.123456+00:00",
    "answers": {
      "field-1712345678901": "Jane Cooper",
      "field-1712345678902": "jane@example.com",
      "field-1712345678903": "VIP"
    },
    "computed": {},
    "source": "form",
    "payment_status": null
  }
}
```

`response.deleted`:

```json
{
  "id": "f0e1d2c3-b4a5-4968-8776-655443322110",
  "type": "response.deleted",
  "created_at": "2026-10-14T07:45:00.512Z",
  "data": {
    "id": "0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e",
    "form_id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
    "form_title": "Event sign-up",
    "deleted_at": "2026-10-14T07:45:00.509871+00:00"
  }
}
```

`payment.succeeded`:

```json
{
  "id": "aa11bb22-cc33-4d44-8e55-ff6600778899",
  "type": "payment.succeeded",
  "created_at": "2026-10-13T18:03:40.560Z",
  "data": {
    "id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
    "form_id": "6f1c2b9e-3d4a-4e5f-8a7b-1c2d3e4f5a6b",
    "response_id": "0b9c2f4e-7a1d-4c3b-9e8f-5d6a7b8c9d0e",
    "status": "paid",
    "amount": 49,
    "currency": "usd",
    "mode": "live",
    "items": [{ "product_id": "vip", "name": "VIP ticket", "unit_amount": 49, "quantity": 1, "subtotal": 49, "file": null }],
    "payer_email": "jane@example.com",
    "paid_at": "2026-10-13T18:03:40.551093+00:00"
  }
}
```

`interview.completed`:

```json
{
  "id": "bb22cc33-dd44-4e55-9f66-007788990011",
  "type": "interview.completed",
  "created_at": "2026-10-12T15:16:52.901Z",
  "data": {
    "id": "7e8f9a0b-1c2d-4e3f-9a4b-5c6d7e8f9a0b",
    "study_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
    "study_title": "Onboarding interviews",
    "status": "completed",
    "mode": "chat",
    "started_at": "2026-10-12T15:04:11.204511+00:00",
    "ended_at": "2026-10-12T15:16:52.880312+00:00",
    "answer_count": 7,
    "summary": null
  }
}
```

### Request headers

| Header | Value |
|---|---|
| `Content-Type` | `application/json` |
| `User-Agent` | `Formzed-Webhooks/1.0` |
| `Formzed-Event` | The event type. |
| `Formzed-Delivery` | The delivery id. The same on every retry. |
| `Formzed-Signature` | `t=<unix seconds>,v1=<hex>`: HMAC-SHA256 of `` `${t}.${rawBody}` `` (the timestamp, a dot, and the raw request body) with the webhook's secret. |

### Verify the signature

Use the raw request body exactly as received (re-serialized JSON won't match), compare in constant time, and reject timestamps older than a few minutes.

Node.js (Express):

```js
import crypto from "node:crypto";
import express from "express";

// Formzed-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">
function verifyFormzed(rawBody, header, secret, toleranceSec = 300) {
  const parts = Object.fromEntries(
    String(header || "").split(",").map((kv) => {
      const i = kv.indexOf("=");
      return [kv.slice(0, i).trim(), kv.slice(i + 1).trim()];
    }),
  );
  const t = Number(parts.t);
  if (!t || !parts.v1 || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  const a = Buffer.from(expected);
  const b = Buffer.from(parts.v1);
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

const app = express();

// Keep the raw body: re-serialized JSON won't match the signature.
app.post("/formzed-webhook", express.raw({ type: "application/json" }), (req, res) => {
  const raw = req.body.toString("utf8");
  if (!verifyFormzed(raw, req.get("Formzed-Signature"), process.env.FORMZED_WEBHOOK_SECRET)) {
    return res.status(400).send("Bad signature");
  }
  const event = JSON.parse(raw);
  res.sendStatus(200); // answer within 10 seconds, then do the work
  handleEvent(event); // deliveries can repeat: skip event.id values you've already handled
});
```

Python (Flask):

```python
import hashlib
import hmac
import json
import os
import time

from flask import Flask, request

def verify_formzed(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
    parts = dict(p.strip().split("=", 1) for p in (header or "").split(",") if "=" in p)
    try:
        t = int(parts["t"])
    except (KeyError, ValueError):
        return False
    if abs(time.time() - t) > tolerance:
        return False
    expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts.get("v1", ""))

app = Flask(__name__)

@app.post("/formzed-webhook")
def formzed_webhook():
    raw = request.get_data()  # the raw bytes, exactly as received
    if not verify_formzed(raw, request.headers.get("Formzed-Signature"), os.environ["FORMZED_WEBHOOK_SECRET"]):
        return "Bad signature", 400
    event = json.loads(raw)
    if event["type"] == "response.created":
        answers = event["data"]["answers"]  # keyed by field id
    return "", 200
```

### Retries and failures

- Events are sent within about a minute. Each webhook gets its events oldest first.
- A delivery that doesn't get a 2xx is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 24 hours: 8 attempts in total, then it is marked `failed`.
- A delivery can arrive more than once. Use the event `id` (or the `Formzed-Delivery` header) to skip duplicates. The body of a retried response event can differ slightly, because file links are signed again.
- After 50 failed attempts in a row, Formzed turns the webhook off and sets `disabled_reason`. Fix the endpoint, then turn it back on (dashboard, or `PATCH` with `is_active: true`).
- If the owner's plan no longer includes the API, webhooks are paused with a reason and their pending deliveries are marked failed.
- Delivered and failed deliveries are kept for 30 days. When a response is deleted, earlier deliveries that carried its answers are removed too.

### Testing

- Click Send test next to the webhook in Dashboard → API → Webhooks, or call `POST /v1/webhooks/:id/test`. You get a `webhook.test` event.
- See each attempt, its HTTP status and error, and the exact payload in the dashboard or with `GET /v1/webhooks/:id/deliveries`. The dashboard can retry a delivery.
- To test locally, expose your server with a tunnel (for example ngrok or cloudflared): webhook URLs must be public https.

## Errors

Every error has this shape. Branch on `code`, not on the message text.

```json
{
  "error": "This key doesn't have the \"forms:write\" permission. Edit the key in Dashboard → API.",
  "code": "INSUFFICIENT_SCOPE",
  "required_scope": "forms:write"
}
```

Extra fields:

- `errors`: a list of problems, each `{ "field_id", "message" }` (form field checks also add `index`). The legacy submit endpoint and the website-form endpoint use `fieldId` instead, as they always have.
- `limit`: with `KEY_DAILY_LIMIT`, `RATE_LIMITED`, `ACCOUNT_RATE_LIMITED` and `MONTHLY_LIMIT` (a number), and `PLAN_LIMIT` (`forms` or `questions`).
- `required_scope`: with `INSUFFICIENT_SCOPE`.
- `imported`, `ids`, `failed`, `stopped_at`: with `RESPONSE_LIMIT` during an import.
- `docs`: with `NOT_FOUND` for an unknown path.

| Code | HTTP | Meaning | What to do |
|---|---|---|---|
| `BAD_REQUEST` | 400 | The request is malformed: body isn't a JSON object, a field is missing or has the wrong type, a date or cursor is invalid. Field problems come in `errors`. | Fix the request. The message says what's wrong. |
| `INVALID_URL` | 400 | The webhook URL isn't a public https address (private, local, has a user name or password, or doesn't parse). | Use a public https URL. |
| `MISSING_API_KEY` | 401 | No key was sent. | Send `X-API-Key: fz_...` or `Authorization: Bearer fz_...`. |
| `INVALID_API_KEY` | 401 | The key is wrong, deleted or turned off. | Check for typos and spaces. Turn the key back on, or create a new one. |
| `API_KEY_EXPIRED` | 401 | The key's expiry date has passed. | Create a new key. |
| `API_KEY_ROTATED` | 401 | The key was rotated and its grace period has ended. | Use the new key. |
| `CREDITS_EXHAUSTED` | 402 | No AI credits left this month, or too few for this request (a call needs room for its prompt and answer). For `POST /v1/studies` without questions: research AI credits. | Wait for the 1st, upgrade, or add a credit pack. |
| `IP_NOT_ALLOWED` | 403 | The request came from an IP address that isn't on the key's allowlist. | Add the IP or range to the key in Dashboard → API, or call from an allowed server. |
| `PLAN_FEATURE` | 403 | The key owner's plan has no API access (Free, Team Free). | Upgrade to a paid plan. |
| `INSUFFICIENT_SCOPE` | 403 | The key doesn't have the permission this endpoint needs. `required_scope` names it. | Edit the key's permissions in Dashboard → API, or use another key. |
| `KEY_FORM_RESTRICTED` | 403 | A key limited to one form can't create or copy forms. | Use a key with access to all forms. |
| `KEY_RESTRICTED` | 403 | A key limited to one form can't use AI Research. | Use a key with access to all forms. |
| `FORBIDDEN` | 403 | The key's owner can see this form but can't change it (team viewer), or isn't its owner (only the owner can publish). | Use a key that belongs to the form's owner or an editor. |
| `FORM_NOT_ALLOWED` | 403 | Legacy `/submit-response` only: the key is limited to another form. | Use a key for this form, or an all-forms key. |
| `FORM_NOT_PUBLISHED` | 403 | The form isn't published, so it can't take responses or imports. | Publish it (`POST /v1/forms/:id/publish`, or in the builder). |
| `RESPONSE_LIMIT` | 403 | The form owner's monthly responses are used up (plan plus response packs). | The owner can upgrade or buy a response pack. Imports tell you which rows were saved. |
| `PLAN_LIMIT` | 403 | The plan's number of forms, or questions per form, is reached. `limit` is `forms` or `questions`. | Upgrade, or remove forms or questions. |
| `ITEM_LIMIT` | 403 | An evaluation holds 20,000 items, deleted ones included. | Start a new evaluation for more items. |
| `MEDIA_LIMIT` | 403 | Over the month's media allowance, or 10,000 files in the evaluation. | Upgrade, upload smaller files, or wait for next month. |
| `WEBHOOK_LIMIT` | 403 | The account already has 20 webhooks. | Delete one you no longer use. |
| `NOT_FOUND` | 404 | No endpoint at this path, or the response or prefilled link doesn't exist or isn't reachable with this key. | Check the path and the id. |
| `FORM_NOT_FOUND` | 404 | No form with this id that this key can use. Other accounts' forms, and forms outside a one-form key, look the same. | Check the id with `GET /v1/forms`. |
| `PAYMENT_NOT_FOUND` | 404 | No payment with this id on a form this key can use. | Check the id with `GET /v1/payments`. |
| `STUDY_NOT_FOUND` | 404 | No study with this id that the key owner can see. | Check the id with `GET /v1/studies`. |
| `EVALUATION_NOT_FOUND` | 404 | No evaluation study with this id that the key owner can see. | Check the id with `GET /v1/evaluations`. |
| `MEDIA_NOT_FOUND` | 404 | No file with this id in this evaluation. | Use the `media_id` from `POST /v1/evaluations/:id/media`. |
| `INTERVIEW_NOT_FOUND` | 404 | No interview with this id in a study the key owner can see. | List interviews with `GET /v1/studies/:id/interviews`. |
| `WEBHOOK_NOT_FOUND` | 404 | No webhook with this id belongs to the key owner (or to the key's form). | Check the id with `GET /v1/webhooks`. |
| `METHOD_NOT_ALLOWED` | 405 | The path exists, but not with this HTTP method. | Check the method in this reference. |
| `WEBHOOK_DISABLED` | 409 | The webhook is turned off, so it can't send a test. | Turn it on first: `PATCH` with `{"is_active": true}`. |
| `MEDIA_NOT_UPLOADED` | 409 | The evaluation file isn't in its slot, or is bigger than declared, than its kind allows or than the month's media allowance. | Ask for a new slot and upload again. |
| `RESULTS_CHANGED` | 409 | New ratings came in between two pages of evaluation results. | Start again without a cursor. |
| `VALIDATION_FAILED` | 422 | Answers break the form's rules, or the form can't be published yet. `errors` lists each problem. | Fix each item in `errors` and send again. |
| `STRIPE_NOT_CONNECTED` | 422 | The form takes payments, but its owner hasn't connected Stripe. | Connect Stripe in Dashboard → Settings → Payments, then publish. |
| `NOT_READY` | 422 | The evaluation can't go live yet; `problems` lists why. | Fix each problem, then publish again. |
| `KEY_DAILY_LIMIT` | 429 | This key's own daily cap is used up. | Wait for 00:00 UTC (see `Retry-After`), or raise the key's cap. |
| `RATE_LIMITED` | 429 | Too many requests this minute for your plan (per key). | Wait `Retry-After` seconds (60), then retry. |
| `UPLOAD_RATE_LIMITED` | 429 | Over 400 evaluation upload slots in the last hour for this person (the dashboard's uploads included). | Wait, then ask for slots again; upload in fewer, larger batches from the dashboard. |
| `ACCOUNT_RATE_LIMITED` | 429 | Too many requests this minute from the whole account (all keys and connected apps together: twice the per-key limit). | Wait `Retry-After` seconds (60), then retry. Adding keys doesn't raise it. |
| `MONTHLY_LIMIT` | 429 | The plan's API requests for this month, plus any API packs, are used up. | Add an API pack, upgrade, or wait for the 1st, 00:00 UTC (see `Retry-After`). |
| `SERVER_ERROR` | 500 | Something failed on Formzed's side. | Retry with backoff. For POST requests, check first whether the item was created. |
| `AI_ERROR` | 502 | The AI model failed, declined, or returned nothing usable. | Retry after a short wait, or rephrase the question. |
| `LIMITS_UNAVAILABLE` | 503 | Formzed couldn't check the plan's limits just now, so nothing was done. Submitting a response is never refused for this. | Retry after a few seconds (see `Retry-After`). |

### Retrying (Node.js)

```js
// RATE_LIMITED and ACCOUNT_RATE_LIMITED clear within a minute: wait Retry-After, then try again.
// KEY_DAILY_LIMIT and MONTHLY_LIMIT last until the next day or month: don't loop on them.
// A 5xx is only retried for GET and DELETE, which can't create anything twice.
async function withRetry(method, url, init = {}, maxTries = 3) {
  for (let attempt = 1; ; attempt++) {
    const res = await fetch(url, { ...init, method });
    if (res.ok) return res.json();
    const body = await res.json().catch(() => ({}));
    const retryable =
      body.code === "RATE_LIMITED" || body.code === "ACCOUNT_RATE_LIMITED" || (res.status >= 500 && (method === "GET" || method === "DELETE"));
    if (!retryable || attempt >= maxTries) {
      throw new Error(`Formzed ${res.status} ${body.code}: ${body.error}`);
    }
    const seconds = Number(res.headers.get("Retry-After")) || 2 ** attempt;
    await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
  }
}
```

## Limits and pricing

The API is included in paid plans. Need more requests than your plan has? Add an API pack.

| Plan | Price | API requests per month | Requests per minute, per key |
|---|---|---|---|
| Free | Free | No API access | – |
| Team Free | Free | No API access | – |
| Starter | $35/mo | 5,000 | 60 |
| Pro | $39/mo | 25,000 | 120 |
| Growth | $110/mo | 100,000 | 300 |
| Team Pro | $25/mo per seat | 10,000 per seat | 120 |
| Team Growth | $75/mo per seat | 40,000 per seat | 300 |
| Team Scale | $125/mo per seat | 100,000 per seat | 600 |

### API packs

One-time purchases. They never expire and are used only after the month's allowance runs out. The workspace owner buys them in Dashboard → API (Buy more requests) or in Settings → Billing.

| Pack | Extra API requests | Price |
|---|---|---|
| 10,000 | 10,000 | $10 |
| 50,000 | 50,000 | $40 |
| 250,000 | 250,000 | $150 |

### Limits at a glance

| Limit | Applies to | Resets | When reached |
|---|---|---|---|
| Per minute | Each key. The number depends on the plan. | Every minute | `429 RATE_LIMITED` |
| Per minute, whole account | All keys and connected apps of the account together: twice the per-key number. | Every minute | `429 ACCOUNT_RATE_LIMITED` |
| Active keys | 25 keys and connected apps per person. | – | Refused when creating or turning on a key |
| Monthly API requests | All keys on the account plus API packs. Team plans share one pool (per-seat allowance × seats). | 1st of the month, 00:00 UTC | `429 MONTHLY_LIMIT` |
| Daily cap | One key, 100 to 10,000. You set it on the key. | Every day, 00:00 UTC | `429 KEY_DAILY_LIMIT` |
| Monthly responses | The form owner's plan, from every source, plus response packs. | 1st of the month | `403 RESPONSE_LIMIT` |
| Forms, questions per form | The plan's limits, for created and copied forms. | – | `403 PLAN_LIMIT` |
| AI credits | The key owner's monthly AI credits plus credit packs. | 1st of the month | `402 CREDITS_EXHAUSTED` |
| Webhooks | 20 per account. | – | `403 WEBHOOK_LIMIT` |
| Sizes | Body 2 MB; 500 rows per import; 200 items per page; 300 fields per form. | – | `400 BAD_REQUEST` |

### How requests are counted

- Every request made with a valid key counts toward the monthly API requests **and** the key's daily cap, including requests that fail (for example `VALIDATION_FAILED` or `FORM_NOT_FOUND`).
- These don't count: requests without a valid key, `API_KEY_EXPIRED`, `API_KEY_ROTATED`, `IP_NOT_ALLOWED`, `PLAN_FEATURE`, `INSUFFICIENT_SCOPE`, requests stopped by a limit (`KEY_DAILY_LIMIT`, `RATE_LIMITED`, `ACCOUNT_RATE_LIMITED`, `MONTHLY_LIMIT`), `LIMITS_UNAVAILABLE`, and unknown paths or methods.
- An import counts as one request, but every saved row counts toward the monthly responses.
- Monthly responses count by when Formzed received a response, so imported history counts in the month you import it.
- Formzed emails the account owner at 80% and 100% of the month's API requests.
- Webhook deliveries and your own website form (no key) don't use API requests.
- Usage, errors and response times per key are in Dashboard → API: https://www.formzed.com/dashboard/api-keys

## MCP server

Connect claude.ai, ChatGPT, Claude Code, Cursor or another MCP client to Formzed so it can read your AI Research studies, reports, interviews and forms, answer questions about them, and create studies and forms. An AI agent can also run evaluation studies (people rating AI outputs) from start to finish: create one, add items and files, publish it, share the rater link, then read the figures and export the ratings as training data.

- Server URL: `https://api.formzed.com/mcp` (Streamable HTTP, stateless).
- **claude.ai and ChatGPT:** in claude.ai, Settings → Connectors → Add custom connector; in ChatGPT, chatgpt.com/plugins → + → Add custom MCP server with OAuth. Paste that URL, sign in with Formzed, choose what the app may do and click Allow; nothing to copy. Manage or disconnect apps in Dashboard → API → Connected apps.
- **Desktop apps signing in** (Codex, Cursor, VS Code, Claude Code) return to this computer on any port (RFC 8252); older Cursor versions' cursor://anysphere.cursor-mcp/oauth/callback is accepted too.
- **Claude Code, Cursor and others:** also sign in with Formzed, or send a Formzed API key: `Authorization: Bearer fz_...` (or `X-API-Key`), with the key's permissions, IP allowlist and limits.
- It can never delete anything. Write tools create drafts, edit form drafts, add evaluation items and files, and publish forms and evaluation studies, only with the permission you allowed. Each tool call is one API request, counted and logged like any other.
- **Sign in with Formzed (OAuth 2.1):** metadata at `https://api.formzed.com/.well-known/oauth-protected-resource/mcp` and `/.well-known/oauth-authorization-server`; dynamic client registration at `/oauth/register`; PKCE (S256) required; access tokens 1 hour, refresh tokens 30 days and single use (reusing an old one ends the sign-in); tokens only work on the MCP server. Disconnecting stops a connection's tokens at once.
- Counts come from Formzed's checked reports (`get_study_report`); the server tells the AI to quote them rather than count transcripts itself.
- Give the key the read permissions you want to share: `interviews:read` for AI Research and evaluation studies (`interviews:write` to create and publish them), `forms:read` and `responses:read` for forms. Tools the key can't use aren't listed.

Claude Code:

```bash
claude mcp add --transport http formzed https://api.formzed.com/mcp --header "Authorization: Bearer $FORMZED_API_KEY"
```

Cursor and other clients (`mcp.json`):

```json
{ "mcpServers": { "formzed": { "url": "https://api.formzed.com/mcp", "headers": { "Authorization": "Bearer fz_your_key" } } } }
```

| Tool | Permission | Returns |
|---|---|---|
| `list_studies` | interviews:read | Studies with status and interview counts |
| `get_study` | interviews:read | A study's goal, interview guide and screener |
| `get_study_report` | interviews:read | The latest report: themes with checked counts and quotes, sentiment, MaxDiff and concept-test results, interviews newer than the report |
| `list_interviews` | interviews:read | A study's interviews with each one's AI summary and screener answers (filters: status, since, until; paging) |
| `get_interview` | interviews:read | One interview's full transcript |
| `list_forms` | forms:read | Forms with status and response counts |
| `get_form` | forms:read | A form's questions |
| `list_responses` | responses:read | A form's responses with their answers (since, until; paging) |
| `create_study` | interviews:write | A draft study from your questions, or AI-drafted from the idea (uses research credits) |
| `create_form` | forms:write | A draft form with its questions (fields as in POST /v1/forms); returns its public `url` and builder `edit_url` |
| `update_form` | forms:write | Changes a form's draft: title, description, or the full fields list |
| `publish_form` | forms:write | Puts the draft live (the AI is told to confirm with you first) |
| `duplicate_form` | forms:write | A draft copy of a form |
| `list_evaluations` | interviews:read | Evaluation studies with task, status, rater link and progress |
| `get_evaluation` | interviews:read | One evaluation study and its progress |
| `get_evaluation_results` | interviews:read | The figures from `GET /v1/evaluations/:id/summary`: agreement, win rates, scores, labels |
| `export_evaluation_data` | interviews:read | A page of ratings as training data from `GET /v1/evaluations/:id/results` (preference JSONL of prompt/chosen/rejected/reason, ideal, labels or full), 100 rows a page by default, with `next_cursor` |
| `create_evaluation` | interviews:write | A draft evaluation study: title, task and the settings `POST /v1/evaluations` takes |
| `add_evaluation_items` | interviews:write | Up to 1,000 items a call, in the shape `POST /v1/evaluations/:id/items` takes |
| `create_evaluation_media_upload` | interviews:write | An upload URL for one image, audio or video file (the agent PUTs the file to it) |
| `complete_evaluation_media_upload` | interviews:write | Checks an uploaded file and makes it usable in items |
| `publish_evaluation` | interviews:write | Opens the study to raters at its link (the AI is told to confirm with you first) |

The evaluation flow: `create_evaluation` → `add_evaluation_items` (files first, if items show any) → `publish_evaluation` → share the rater link with your raters, or order paid raters for the study in Formzed → `get_evaluation_results` → `export_evaluation_data`.

Errors come back as tool results with `isError: true` and the API's message and code (for example `Study not found [STUDY_NOT_FOUND]`). A missing or invalid key gets HTTP 401.

## Libraries and no-code

**Preview: not installable yet.** The JavaScript and Python libraries aren't on npm or PyPI yet, so the install commands and library code below won't run today; they show what's coming. The Zapier and Make apps are in review. Until they're out, call the REST API directly (every other example here works as is), or use your tool's HTTP step with a Formzed webhook.

### JavaScript / TypeScript: `@formzed/sdk` (coming soon to npm)

Node 18+, Deno, Bun and edge runtimes; no dependencies; full types. Retries rate limits and server errors, pages for you, and verifies webhook signatures. Refuses to run in a browser.

```js
// PREVIEW: @formzed/sdk isn't on npm yet, so this won't install today.
import { Formzed } from "@formzed/sdk";

const formzed = new Formzed({ apiKey: process.env.FORMZED_API_KEY });

const { data: forms } = await formzed.forms.list({ status: "published" });
const form = await formzed.forms.get(forms[0].id);

const created = await formzed.responses.create(form.id, {
  [form.fields[0].id]: "Ada Lovelace",
});

for await (const response of formzed.responses.iterate(form.id, { since: "2026-10-01T00:00:00Z" })) {
  console.log(response.submitted_at, response.answers_by_label);
}
```

### Python: `formzed` (coming soon to PyPI)

Python 3.9+, one dependency (`requests`). Retries, page iterators and webhook signature checks. Objects are plain dicts with the API's field names.

```python
# PREVIEW: formzed isn't on PyPI yet, so this won't install today.
import os
from formzed import Formzed

client = Formzed(api_key=os.environ["FORMZED_API_KEY"])

page = client.forms.list(status="published")
form = client.forms.get(page.data[0]["id"])

created = client.responses.create(form["id"], {form["fields"][0]["id"]: "Ada Lovelace"})

for response in client.responses.iterate(form["id"], since="2026-10-01T00:00:00Z"):
    print(response["submitted_at"], response["answers_by_label"])
```

### Zapier and Make (in review, coming soon)

| App | Triggers | Actions and searches |
|---|---|---|
| Zapier | New response, New payment, Interview completed (instant, through Formzed webhooks) | Create a response, Create a prefilled link, Find a response by email |
| Make | Watch new responses, Watch payments, Watch completed interviews (instant) | Create, update or delete a response; create a prefilled link; get a form; list responses, payments or interviews; make an API call |

Until then, use the tool's HTTP step (Webhooks by Zapier, Make's HTTP module, n8n's HTTP Request node):

| Setting | Value |
|---|---|
| Method | `POST` |
| URL | `https://api.formzed.com/v1/forms/YOUR_FORM_ID/responses` |
| Header | `Content-Type: application/json` |
| Header | `X-API-Key: <your key>` |
| Body (JSON) | `{"data": {"field-1712345678901": "..."}}` |

To start a Zap or scenario when something happens in Formzed, point a Formzed webhook at the tool's "catch hook" URL.

## Versioning and changelog

| Rule | What it means |
|---|---|
| v1 is stable | Everything under `https://api.formzed.com/v1` keeps working as documented. Breaking changes only come in a new version (`/v2`), never in v1. |
| Additive changes any time | New endpoints, optional parameters, reply fields, webhook event types and error codes can appear without notice. Ignore fields you don't know; branch on `code`, not the message. |
| Deprecation notice | Before anything is removed or a version retired, it's announced here and by email to account owners at least 6 months ahead, and its replies carry `Deprecation` and `Sunset` headers with the date. |
| Old addresses | The earlier `*.supabase.co/functions/v1/...` URLs still work and won't be switched off without the same notice. |

### Planned for v2

- One body shape everywhere: `data` and `field_id` (the website form endpoint already accepts `data` and returns `field_id` next to `fieldId`).
- `201` for every create (the website form and legacy endpoints answer `200` today).
- One body limit (2 MB) everywhere; the website form endpoint allows 1 MB today.
- The legacy submit endpoint retired in favour of `POST /v1/forms/:id/responses`.

### Changelog

| Date | Change |
|---|---|
| 2026-11-25 | Evaluations: `GET /v1/evaluations/:id/summary` for the figures (agreement, win rates, scores, labels), and `limit` on `GET /v1/evaluations/:id/results`. MCP server: 9 evaluation tools to create, fill, publish and export evaluation studies. |
| 2026-11-24 | Evaluations (AI Training): `/v1/evaluations` to create evaluation studies, upload files and items, publish, and download results as JSONL or CSV (pages with `X-Next-Cursor`). New errors `EVALUATION_NOT_FOUND`, `ITEM_LIMIT`, `MEDIA_LIMIT`, `MEDIA_NOT_FOUND`, `MEDIA_NOT_UPLOADED`, `NOT_READY`, `RESULTS_CHANGED`. `/v1/studies` lists interview studies only. |
| 2026-10-25 | Security fixes. Changes need edit rights exactly as in the dashboard (form creators who became viewers, and archived or read-only workspaces, get `403 FORBIDDEN`). New `429 ACCOUNT_RATE_LIMITED`: twice the per-key per-minute limit for the whole account. Up to 25 active keys and connected apps per person. Monthly requests are reserved up front, so parallel calls can't go past the limit. File answers can't link into Formzed's own storage. Webhooks connect only to the address that was checked, and `last_error` is a fixed short reason. `interview.completed` summaries lose typed contact details, and hidden interviews aren't sent. |
| 2026-10-19 | New address `https://api.formzed.com` (old URLs still work). `Idempotency-Key` on every POST. Website forms: spam trap field, allowed websites per form (`ORIGIN_NOT_ALLOWED`), `data` accepted for `answers`, `field_id` and `code: VALIDATION_FAILED` in 422 replies. |
| 2026-10-14 | API v1 launched: forms, responses, prefilled links, payments, AI, AI Research and webhooks, with scoped keys, IP allowlists and key rotation. |

## Your own website form (no API key)

Keep your own HTML form and send answers to Formzed from the visitor's browser. This endpoint needs no key and answers browsers on any website, unless you limit the form to your own sites (see Stopping spam). Answers are checked exactly like the hosted form: required fields and allowed options.

Fastest start: in Formzed, open Forms → ⋯ → Embed → "Your own HTML form". It gives a ready HTML version of the form. Its input names are the form's field ids.

```
POST https://api.formzed.com/forms/submit
```

| Field | Type | Required | Description |
|---|---|---|---|
| `form_id` | string (UUID) | yes | ID of a published form. |
| `answers` | object | yes | Field id → answer, in the same format as `data` in the server API (`data` works here too). |
| `_hp` | string | no | The spam trap: a hidden input people never fill in. When it isn't empty the reply looks normal, but nothing is saved or counted. |

```html
<form id="contact">
  <input name="field-1712345678901" placeholder="Name" required>
  <input name="field-1712345678902" type="email" placeholder="Email" required>
  <!-- Spam trap: hidden from people, bots fill it in. Keep it empty. -->
  <div style="position:absolute;left:-10000px" aria-hidden="true"><input type="text" name="_hp" tabindex="-1" autocomplete="off"></div>
  <button type="submit">Send</button>
  <p id="status" role="status"></p>
</form>

<script>
// No API key here: this endpoint is public.
document.getElementById("contact").addEventListener("submit", async (event) => {
  event.preventDefault();
  const form = event.target;
  const status = document.getElementById("status");
  const answers = Object.fromEntries(new FormData(form));
  status.textContent = "Sending...";
  const res = await fetch("https://api.formzed.com/forms/submit", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ form_id: "YOUR_FORM_ID", answers }),
  });
  const result = await res.json().catch(() => ({}));
  if (res.ok) {
    status.textContent = "Thanks! Your response was sent.";
    form.reset();
  } else {
    status.textContent = result.errors?.[0]?.message || result.error || "Something went wrong.";
  }
});
</script>
```

Responses:

| HTTP | Body | Meaning |
|---|---|---|
| 200 | `{"id": "<response uuid>", "computed": {...}}` | Saved. `computed` holds calculated field results (empty when the form has none). |
| 400 | `{"error": "Invalid JSON"}` or `{"error": "Invalid form_id"}` | The body isn't JSON, or `form_id` isn't a UUID. |
| 403 | `{"error": "...", "code": "RESPONSE_LIMIT"}` | The form owner's monthly responses are used up. |
| 403 | `{"error": "...", "code": "ORIGIN_NOT_ALLOWED"}` | The form only accepts responses from its allowed websites, and this page isn't one. |
| 404 | `{"error": "Form not found"}` | No such form, or it isn't published. |
| 413 | `{"error": "Request too large"}` | The body is over 1 MB. |
| 422 | `{"error": "Validation failed", "code": "VALIDATION_FAILED", "errors": [{"field_id": "...", "fieldId": "...", "message": "..."}]}` | Show each message next to its field. `field_id` and `fieldId` hold the same value. |
| 429 | `{"error": "...", "code": "RATE_LIMITED"}` | More than 100 submissions in an hour from one connection to one form. |
| 500 | `{"error": "..."}` | Try again later. |

### Stopping spam

| Protection | How |
|---|---|
| Spam trap | Keep the hidden `_hp` input from the ready-made HTML. Bots that fill it in get a normal-looking reply; nothing is saved, counted or sent to automations. |
| Allowed websites | Forms → ⋯ → Embed → "Your own HTML form" → Allowed websites. Browsers on any other site get `403 ORIGIN_NOT_ALLOWED`. Formzed's pages and custom form domains always work. |
| Rate limit | 100 submissions an hour from one connection to one form. |

Allowed websites stop other sites' pages; a script outside a browser can still send requests, which the spam trap and the rate limit catch. For the strongest protection, embed the hosted form.

Notes:

- It doesn't use API requests. Each submission counts toward the form owner's monthly responses, runs the form's automations and sends `response.created` webhooks, like the hosted form.
- File uploads, payments and bookings need the hosted form (next section).

## Embed the hosted form

Put the Formzed form itself on your page. Everything works, including file uploads, payments and bookings. Get the ready code in Forms → ⋯ → Embed → "Embed Widget".

```html
<iframe
  src="https://www.formzed.com/form/YOUR_FORM_SLUG?embed=true"
  width="100%"
  height="600"
  frameborder="0"
  title="Contact form"
  style="border: none;">
</iframe>
```

- `src`: the form's slug or ID, plus `?embed=true` for a layout made for iframes. Add `&prefill=<token>` to fill in answers from a prefilled link.
- `height`: in pixels. Use a taller value for long forms.

## Building with an AI assistant

Paste this into Claude, ChatGPT or your coding assistant:

> Read the Formzed API reference at https://www.formzed.com/api-docs.md. Build a server-side integration with the Formzed API v1 (base URL https://api.formzed.com/v1). I want to: [what it should do, for example send new sign-ups to my form, copy responses into my database, or react to new responses with a webhook]. My stack is: [your stack]. My form ID is [form ID]. Keep the API key in an environment variable named FORMZED_API_KEY, never in browser code. Handle errors by their "code" field, retry RATE_LIMITED after the Retry-After header, and verify webhook signatures.

Checklist for an assistant:

1. If the code runs in a browser, use the website form endpoint (`POST https://api.formzed.com/forms/submit`, no key) or the iframe. Never put an API key in browser code.
2. Server side: base URL `https://api.formzed.com/v1`; send `X-API-Key` from an environment variable, and `Content-Type: application/json` with a body.
3. Get field ids from `GET /v1/forms/:id` (`fields[].id`). Answers are keyed by field id, not label.
4. Submit with `POST /v1/forms/:id/responses` and `{ "data": { "<field id>": value } }`; `201` with `data.id` means saved.
5. Read single items from `body.data`; page lists with `next_cursor` until it is null.
6. Branch on `code`. Show `errors[].message` for `VALIDATION_FAILED`. Retry `RATE_LIMITED` after `Retry-After`. Don't loop on `KEY_DAILY_LIMIT` or `MONTHLY_LIMIT`. On `INSUFFICIENT_SCOPE`, tell the user which scope (`required_scope`) to add to the key.
7. Don't blindly retry POSTs: there's no idempotency key, so a repeat creates a duplicate.
8. Webhooks: verify `Formzed-Signature` (HMAC-SHA256 of `<t>.<raw body>` with the `whsec_` secret) on the raw body, answer 2xx within 10 seconds, and skip repeated event ids.

## Links

- Human-friendly docs: https://www.formzed.com/api-docs
- OpenAPI 3.1 spec: https://www.formzed.com/openapi.json
- Create or manage API keys, webhooks and usage: https://www.formzed.com/dashboard/api-keys
- Product overview for AI assistants: https://www.formzed.com/llms.txt
