Browse and search developers

Get started

Authentication

How each FormitAI developer surface authenticates: API key bearer tokens and OAuth 2.1 for MCP, and HMAC signatures for inbound webhooks.

On this page
  1. MCP with OAuth (recommended)
  2. MCP with an API key
  3. Webhook signatures
  4. REST API and OAuth tokens

Each FormitAI surface uses one authentication method, chosen for who is calling. MCP clients authenticate to FormitAI with an OAuth access token or a workspace API key. Webhooks go the other way: FormitAI calls you and signs each request so you can check it. The embed SDK needs no credential because it only loads published forms.

SurfaceDirectionCredentialSent as
MCP serverYour client to FormitAIOAuth access token (scope mcp)Authorization: Bearer <token>
MCP serverYour client to FormitAIWorkspace API key (fmt_live_… or fmt_test_…)Authorization: Bearer <key>
WebhooksFormitAI to your endpointPer-endpoint signing secretX-Formit-Signature: t=<unix_seconds>,v1=<hex>
Embed SDKBrowser to FormitAINoneNot applicable

OAuth is the default for interactive clients such as Claude and Cursor. You configure only the URL https://api.formitai.com/api/v1/mcp. The first request has no token, so the server answers 401 with a WWW-Authenticate header that points to the protected resource metadata. The client then discovers the authorization server, registers itself, and opens a browser where the user signs in to FormitAI, picks a workspace and selects Allow.

HTTP
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="mcp", resource_metadata="https://api.formitai.com/.well-known/oauth-protected-resource"
Content-Type: application/json

{"error":"UNAUTHORIZED","message":"Provide a Formit API key or MCP OAuth access token"}

The access token is bound to the workspace the user picked. It lasts one hour and the client renews it with a refresh token, which lasts 30 days and is replaced on every use. On every request FormitAI checks that the user is still a member of that workspace, so removing someone from the workspace cuts off their MCP access. No secret ever sits in a config file.

MCP with an API key

Use a workspace API key for clients that only support static headers, and for headless agents, scripts and CI. Send it as a bearer token on every request. The key acts in the workspace where it was created, with the role of the person who created it.

curl -sS https://api.formitai.com/api/v1/mcp \
  -H "Authorization: Bearer fmt_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

The endpoint is stateless: every HTTP request is authenticated on its own and no session is kept on the server. Responses use the Streamable HTTP transport, so send an Accept header that allows both application/json and text/event-stream. Invalid, expired and revoked keys all get the same 401 response.

Webhook signatures

FormitAI signs each webhook delivery with the endpoint’s secret. It computes HMAC-SHA256 over the string <timestamp>.<raw body> and sends X-Formit-Signature: t=<unix_seconds>,v1=<hex>, along with X-Formit-Timestamp, X-Formit-Event and X-Formit-Delivery-Id. Your receiver should recompute the HMAC over the raw request body (not re-serialized JSON), compare it in constant time, and reject timestamps more than 300 seconds from your clock.

verify-formit-signature.js
import { createHmac, timingSafeEqual } from 'node:crypto';

export function verifyFormitSignature(rawBody, header, secret, toleranceSeconds = 300) {
  const parts = Object.fromEntries(header.split(',').map((p) => p.trim().split('=')));
  const timestamp = Number(parts.t);
  if (!Number.isFinite(timestamp) || !parts.v1) return false;
  if (Math.abs(Math.floor(Date.now() / 1000) - timestamp) > toleranceSeconds) return false;

  const expected = createHmac('sha256', secret).update(`${timestamp}.${rawBody}`, 'utf8').digest('hex');
  const a = Buffer.from(expected);
  const b = Buffer.from(parts.v1);
  return a.length === b.length && timingSafeEqual(a, b);
}

REST API and OAuth tokens

The REST API accepts workspace API keys as bearer tokens. The REST API also accepts access tokens from OAuth apps (fmt_oat_…). MCP OAuth tokens are separate and only work on the MCP endpoint.

Ready?

Build your first AI form in minutes.

No credit card. Generate from a prompt, enable follow-ups, and publish a link or embed the same day.