---
title: "Configure a form"
method: POST
path: "/sapi/project/{projectId}/forms/configure"
tags: ["Forms"]
---

# Configure a form

`POST /sapi/project/{projectId}/forms/configure`

## Request

- Base URL: `https://api.websitepublisher.ai`
- URL: `https://api.websitepublisher.ai/sapi/project/{projectId}/forms/configure`
- Auth: OAuth 2 (authorization code, authorization URL `https://api.websitepublisher.ai/dapi/oauth/authorize`, token URL `https://api.websitepublisher.ai/dapi/oauth/token`, scopes: `read`, `write`)

Create or update a form definition with required fields, submit action, and limits. Use listConfiguredIntegrations first to find services. IMPORTANT: use Safari ITP-proof pattern: store session_id in sessionStorage and send it as X-Session-Id header on the session GET and form submit calls.

## Path parameters

- `projectId` integer, required

## Request body

- FormConfig
  - `form_name` string, required: Unique form identifier (lowercase a-z, 0-9, underscore, max 64 chars)
  - `required_fields` string[], required: Field names the visitor must fill in
  - `allowed_action_json` string: JSON-encoded single action. Keys: type (iapi/webhook/none), service, endpoint, input_template ({{fields.xxx}} placeholders). Example: {"type":"iapi","service":"resend","endpoint":"send-email","input_template":{"from":"noreply@site.com","to":"info@site.com","subject":"{{fields.name}}","text":"{{fields.message}}"}}
  - `allowed_actions_json` string: JSON-encoded array of actions (max 3). Use instead of allowed_action_json when you need multiple actions (e.g. webhook + confirmation email). Actions execute in order. Example: [{"type":"webhook","url":"https://hooks.example.com/lead"},{"type":"iapi","service":"resend","endpoint":"send-email","input_template":{"from":"noreply@site.nl","to":"{{fields.email}}","subject":"Bevestiging","text":"Bedankt {{fields.naam}}"}}]
  - `max_submits_per_session` integer: Max submits per visitor session (default: 3, max: 100)

## Response `200`

Form updated

## Other responses

- `201`: Form created
- `422`: Validation error

---

[API](https://skmtc.dev/websitepublisher/apis/websitepublisher-ai-api.md) · [All operations](https://skmtc.dev/websitepublisher/apis/websitepublisher-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/websitepublisher/apis/websitepublisher-ai-api/revisions/e9df1ef10551?raw)
