Browse and search developers

REST API

REST API quickstart: create a form and read responses

Create a form with questions, publish it and read its responses with the FormitAI REST API, step by step in cURL, Node.js and Python.

On this page
  1. 1. Find the block types
  2. 2. Create the form with its questions
  3. 3. Publish it
  4. 4. Read responses

This walkthrough creates a two-question feedback form, publishes it, and reads the responses it collects. You need a key with forms:read, forms:write and responses:read, created by an Owner or Admin (publishing needs the workspace publish permission).

1. Find the block types

Questions are blocks. GET /v1/block-types lists every type you can add, with its id, whether it needs options, and the settings it accepts. Use the id as the question type.

cURL
curl https://api.formitai.com/v1/block-types \
  -H "Authorization: Bearer $FORMIT_API_KEY"

2. Create the form with its questions

Send the questions with the form, or add them later with POST /v1/forms/{formId}/questions. The response is the whole form, including the question ids. Send an Idempotency-Key header so a retry after a network error does not create a second form.

curl https://api.formitai.com/v1/forms \
  -H "Authorization: Bearer $FORMIT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: feedback-form-2026-11-25" \
  -d '{
    "name": "Product feedback",
    "questions": [
      { "type": "email", "title": "Your work email", "required": true },
      { "type": "textarea", "title": "What should we improve?" }
    ]
  }'

3. Publish it

New forms are drafts. Publishing creates a version respondents can fill in. If the form uses a block your plan does not include, publishing fails with a plan_error naming the block, and nothing changes.

cURL
curl -X POST https://api.formitai.com/v1/forms/FORM_ID/publish \
  -H "Authorization: Bearer $FORMIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "versionLabel": "First version" }'

4. Read responses

Responses come newest first, 25 per page by default (up to 100 with limit). Partial responses are included and marked completed: false; pass completed=true to leave them out. Use since to fetch only new responses, for example in a nightly job.

curl "https://api.formitai.com/v1/forms/FORM_ID/responses?completed=true&since=2026-11-01T00:00:00Z" \
  -H "Authorization: Bearer $FORMIT_API_KEY"

Each response lists its answers with the question id, the question title at the time, the block type and the stored value. Multi-select answers are JSON-encoded arrays in value.

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.