thincms_create_form
Create forms or surveys with field definitions or custom HTML. Use presets for quick setup and configure webhooks for submissions.
Instructions
Create a new form or survey. Use renderMode 'fields' for standard forms (with field definitions) or 'html' for custom HTML surveys served at /s/:slug. Use preset 'contact' or 'newsletter' for pre-configured field sets. For large HTML content (>10KB), use htmlContentFile instead of htmlContent to pass a local file path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Form name (required) | |
| slug | No | URL slug (auto-generated from name if omitted) | |
| fields | No | Field definitions (for renderMode 'fields') | |
| preset | No | Pre-configured field set | |
| siteId | No | Override the active site for this single call. Pass to target a specific tenant without mutating shared active-site state — the right pattern when running concurrent agent sessions managing different tenants. Must match a siteId from your THINCMS_SITES config (use thincms_list_sites to inspect). When omitted, the call uses the active site set by thincms_switch_site. | |
| enabled | No | Enable/disable form (default: true) | |
| renderMode | No | 'fields' for standard forms, 'html' for custom survey HTML (default: fields) | |
| webhookUrl | No | URL to receive submission payloads via POST | |
| description | No | Form description | |
| htmlContent | No | Custom HTML content (for renderMode 'html', served at /s/:slug) | |
| successMessage | No | Message shown after successful submission | |
| webhookUrlTest | No | Test webhook URL (auto-deactivates after one delivery) | |
| htmlContentFile | No | Local file path containing HTML content — use this instead of htmlContent for large surveys (>10KB). The file is read and sent as htmlContent. | |
| webhookTestMode | No | Enable test mode for webhook | |
| confirmProductionWrite | No | Acknowledge that this call may write to a configured production site (THINCMS_PRODUCTION_SITE_IDS env var). Required for any POST/PUT/PATCH/DELETE against a production-listed site; ignored otherwise. The error message lists which site triggered the requirement and recommends thincms_snapshot before any production write. |