API Overview

The formdata.dev API has two surfaces:

Surface Base URL Auth Purpose
Ingestion POST /v1/f/:publicKey None (public key in URL) Accept form submissions
Admin /v1/admin/* x-tenant-key header Manage accounts, forms, destinations, keys

Base URL

https://api.formdata.dev

Or, if you created a subdomain during account setup:

https://<slug>.formdata.dev

Authentication

All admin endpoints (except account creation) require a tenant key passed in the x-tenant-key header:

curl https://api.formdata.dev/v1/admin/forms \
  -H "x-tenant-key: sk_live_abc123..."

The ingestion endpoint requires no authentication — the public key in the URL path identifies the form.

Response Format

Every response returns JSON with an ok boolean:

Success:

{
  "ok": true,
  ...
}

Error:

{
  "ok": false,
  "error": "Human-readable message"
}

Validation errors return a Zod flatten() structure:

{
  "ok": false,
  "error": {
    "formErrors": [],
    "fieldErrors": {
      "slug": ["String must contain at least 2 character(s)"]
    }
  }
}

Status Codes

Code Meaning
200 Success (reads, updates, deletes)
202 Accepted (submission queued for async delivery)
400 Invalid JSON or validation error
401 Missing or invalid x-tenant-key
403 Origin not allowed (ingestion CORS)
404 Resource not found or form disabled
409 Conflict (e.g. slug already taken)
413 Payload too large (max 128 KB)

Endpoint Reference

Ingestion

Method Path Description
POST /v1/f/:publicKey Submit form data

Admin — Accounts

Method Path Auth Description
POST /v1/admin/accounts None Create account + tenant key

Admin — Forms

Method Path Auth Description
GET /v1/admin/forms x-tenant-key List all forms
POST /v1/admin/forms x-tenant-key Create a form
GET /v1/admin/forms/:id x-tenant-key Get form + destinations
PUT /v1/admin/forms/:id x-tenant-key Update a form
DELETE /v1/admin/forms/:id x-tenant-key Delete a form

Admin — Destinations

Method Path Auth Description
POST /v1/admin/forms/:id/destinations x-tenant-key Add destination to form
DELETE /v1/admin/forms/:id/destinations/:destId x-tenant-key Remove destination

Admin — Keys

Method Path Auth Description
POST /v1/admin/keys/rotate x-tenant-key Rotate tenant key