← Back to API

Create a form

Generate a new form from a natural-language prompt.

POST /api/v1/forms/generate

Request

Headers

HeaderRequiredDescription
AuthorizationYesBearer {api_key}
Content-TypeYesapplication/json

Body

FieldTypeRequiredDescription
promptstringYesDescription of the form. Max 4,000 characters.
metadataobjectNoKey-value pairs stored with the form.

Response (success)

Status: 200 OK

{
  "success": true,
  "data": {
    "formId": "form_1739012345_abc123xyz",
    "formUrl": "https://www.chatterforms.com/forms/form_1739012345_abc123xyz",
    "formSchema": {
      "title": "Contact Form",
      "fields": [
        { "type": "text", "label": "Name", "required": true },
        { "type": "email", "label": "Email", "required": true }
      ]
    },
    "warnings": [],
    "settings_url": "https://www.chatterforms.com/settings"
  },
  "meta": { "request_id": null, "api_version": "2024-01-01" }
}

When payment or Calendly fields exist but accounts are not connected, warnings and settings_url are included.

Code examples

curl -X POST https://backend.chatterforms.com/api/v1/forms/generate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer cf_live_YOUR_API_KEY" \
  -d '{
    "prompt": "A contact form with name, email, and digital signature",
    "metadata": { "source": "api", "campaign": "summer-2025" }
  }'

Error responses

StatusCodeDescription
400PROMPT_REQUIREDMissing or empty prompt
400PROMPT_TOO_LONGPrompt exceeds 4,000 characters
401INVALID_API_KEYMissing or invalid API key
403UPGRADE_REQUIREDFeature requires higher plan
413FORM_GENERATION_FAILEDToken limit exceeded
415UNSUPPORTED_MEDIA_TYPEMust be application/json
500FORM_GENERATION_FAILEDInternal error

See Errors for details.