thincms_create_enrollment
Enroll an existing learner in a course without payment by providing their email or user ID.
Instructions
Enroll a learner in a course. The user must already exist — specify by email or userId. This bypasses payment requirements, effectively creating a free/invite enrollment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | Learner's email address (looks up existing user) | ||
| 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. | |
| source | No | Enrollment source label (default: invite) | |
| status | No | Enrollment status (default: active) | |
| userId | No | User ID (alternative to email) | |
| courseId | Yes | Course ID (required) | |
| 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. |