thincms_create_workbook
Create a fillable workbook form in a module. Define fields with a JSON array or use a local file for large specifications.
Instructions
Create a workbook inside a module. Workbooks are fillable forms that live alongside lessons and quizzes — use thincms_reorder_module_items to position them. The fields array defines the form spec. For large specs (>10KB), use fieldsFile instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | No | URL slug (auto-generated from title if omitted) | |
| title | Yes | Workbook title (required) | |
| fields | No | Ordered array of field definitions. Each field is an object with at minimum { fieldId, type, label }. v1 field types: short_text, long_text, number, rating, select, multi_select, date, prompt_display, markdown_display. Input fields may include `prefillFrom: { courseSlug, workbookSlug, fieldId }` for cross-workbook references. | |
| isFree | No | Make this workbook a free preview (default: false) | |
| 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. | |
| dripDate | No | ISO date when this workbook becomes available (scheduled drip mode) | |
| moduleId | Yes | Module ID (required) | |
| fieldsFile | No | Local file path containing a JSON array of field definitions — use for large workbook specs | |
| isUnlocked | No | Manually unlock regardless of drip settings | |
| description | No | HTML content shown above the form | |
| introContent | No | Optional additional HTML intro shown after the description | |
| requiredForCompletion | No | Whether marking the workbook complete is required for module completion (default: true) | |
| 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. | |
| allowExportBeforeComplete | No | Whether learners can export before marking complete (default: true) |