create_form

Create a new form endpoint.

Parameters

Name Type Required Validation Description
name string Yes Min 2, max 120 chars Form display name
slug string Yes Min 2, max 80 chars, regex ^[a-z0-9-]+$ URL-safe identifier (lowercase alphanumeric and hyphens only)
allowedOrigins string[] No Default: [] List of allowed origin URLs. Empty array allows all origins
verifyCaptcha boolean No Default: false Require captcha verification on submissions
captchaSecret string No Required if verifyCaptcha is true Captcha provider secret key

Response Example

{
  "formId": "a1b2c3d4-...",
  "publicKey": "pk_abc123...",
  "name": "Contact Form",
  "slug": "contact",
  "allowedOrigins": ["https://acme.com"],
  "verifyCaptcha": false,
  "isEnabled": true
}

Error Cases

Error Cause
captchaSecret is required when verifyCaptcha is true verifyCaptcha set to true without providing captchaSecret
401 Unauthorized Invalid or expired secret key
Zod validation error name too short/long, slug contains invalid characters, etc.

Example Prompt

"Create a contact form with slug 'contact' that only accepts submissions from https://acme.com."

WARNING

The slug must be lowercase and can only contain letters, numbers, and hyphens. Uppercase letters and special characters will be rejected.

TIP

CLI equivalent: npx formdata-dev forms create (interactive prompts for the same fields).