Browse and search developers

REST API

JavaScript and TypeScript SDK

Use @formitai/sdk for typed REST API calls with automatic retries and pagination, OAuth helpers and webhook verification.

The @formitai/sdk package wraps the REST API with one typed method per endpoint, generated from the same OpenAPI document as the API reference. It runs on Node.js 18 or later.

Install
npm install @formitai/sdk
TypeScript
import { FormitClient } from '@formitai/sdk';

const formit = new FormitClient({ token: process.env.FORMIT_API_KEY! });

const form = await formit.createForm({
  name: 'Product feedback',
  questions: [{ type: 'email', title: 'Your work email', required: true }],
});
await formit.publishForm({ formId: form.id });

for await (const response of formit.paginate((cursor) =>
  formit.listResponses({ formId: form.id }, { cursor, limit: 100 }),
)) {
  console.log(response.id, response.answers);
}
  • Retries: reads, deletes and creates are retried on 429 and 5xx (3 times by default, honouring Retry-After). Creates send an Idempotency-Key automatically, so a retry never creates a duplicate. Other writes are not retried.
  • Errors: failed calls throw FormitApiError with status, type, code, message and requestId.
  • Pagination: paginate() turns any list call into an async iterator over every item.
  • OAuth apps: FormitOAuth builds the authorize URL, exchanges codes (with createPkcePair() for PKCE), refreshes and revokes tokens.
  • Webhooks: verifyWebhook() from @formitai/sdk/webhooks checks the signature and timestamp and returns the parsed event.

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.