publ betaReference (MCP guide)
Open publ console

course_lessons_apply

# course_lessons_apply

Creates text or live-coaching lessons, edits, publishes or deletes lessons, or saves the lesson editor in the Course app (pApp C00007). Video lessons are uploaded with course_videos_apply. Called without confirmToken it previews and returns a confirmToken; repeating the same input with it executes once.

## Inputs

| Field | Required here | Contract |
| --- | --- | --- |
| `action` | Yes | one of: `course-editor`, `create-text`, `create-coaching`, `edit`, `publication`, `delete` (by `kind`) |
| `action.postId` | Yes | When `action.kind` is `course-editor`: integer; greater than 0 |
| `action.change` | Yes | When `action.kind` is `course-editor`: one of: `edit`, `restore-assets` (by `kind`) |
| `action.change.fields` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: object |
| `action.change.fields.title` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; min length 1; max length 100 |
| `action.change.fields.description` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; max length 5000 |
| `action.change.fields.introduction` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; max length 250 |
| `action.change.fields.contentHtml` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; min length 2; max length 30000 |
| `action.change.fields.ageRating` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: integer; minimum 0; maximum 10000000 |
| `action.change.fields.coaching` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: object |
| `action.change.fields.coaching.link` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; max length 4096; format `uri` |
| `action.change.fields.coaching.startsAt` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; pattern `^(?:(?:\d\d[2468][048]\|\d\d[13579][26]\|\d\d0[48]\|[02468][048]00\|[13579][26]00)-02-29\|\d{4}-(?:(?:0[13578]\|1[02])-(?:0[1-9]\|[12]\d\|3[01])\|(?:0[469]\|11)-(?:0[1-9]\|[12]\d\|30)\|(?:02)-(?:0[1-9]\|1\d\|2[0-8])))T(?:(?:[01]\d\|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z\|([+-](?:[01]\d\|2[0-3]):[0-5]\d)))$`; format `date-time` |
| `action.change.fields.coaching.durationMinutes` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: integer; greater than 0 |
| `action.change.fields.alerts` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: object |
| `action.change.fields.alerts.beforeStart` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: boolean |
| `action.change.fields.alerts.atStart` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: boolean |
| `action.change.fields.attachments` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: object |
| `action.change.fields.attachments.keepIndices` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: array; items: integer; minimum 0; maximum 9; max items 10 |
| `action.change.fields.attachments.addUploadTaskIds` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: array; items: string; pattern `^[A-Za-z0-9_-]{8,80}$`; max items 10; default `[]` |
| `action.change.fields.thumbnailImageTaskId` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; pattern `^[A-Za-z0-9_-]{8,80}$` |
| `action.change.fields.inlineImages` | No | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: array; min items 1; max items 100 |
| `action.change.fields.inlineImages[].token` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; pattern `^[A-Za-z][A-Za-z0-9_-]{0,39}$` |
| `action.change.fields.inlineImages[].imageTaskId` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `edit`: string; pattern `^[A-Za-z0-9_-]{8,80}$` |
| `action.change.sourceTaskId` | Yes | When `action.kind` is `course-editor` and `action.change.kind` is `restore-assets`: string; pattern `^[A-Za-z0-9_-]{8,80}$` |
| `action.title` | Yes | When `action.kind` is `create-text`: string; min length 1; max length 100 |
| `action.introduction` | No | When `action.kind` is `create-text`: string; max length 250; default `` |
| `action.contentHtml` | Yes | When `action.kind` is `create-text`: string; min length 2; max length 30000 |
| `action.ageRating` | No | When `action.kind` is `create-text`: integer; minimum 0; maximum 10000000; default `0` |
| `action.title` | Yes | When `action.kind` is `create-coaching`: string; min length 1; max length 100 |
| `action.ageRating` | No | When `action.kind` is `create-coaching`: integer; minimum 0; maximum 10000000; default `0` |
| `action.coaching` | Yes | When `action.kind` is `create-coaching`: object |
| `action.coaching.link` | Yes | When `action.kind` is `create-coaching`: string; max length 4096; format `uri` |
| `action.coaching.startsAt` | Yes | When `action.kind` is `create-coaching`: string; pattern `^(?:(?:\d\d[2468][048]\|\d\d[13579][26]\|\d\d0[48]\|[02468][048]00\|[13579][26]00)-02-29\|\d{4}-(?:(?:0[13578]\|1[02])-(?:0[1-9]\|[12]\d\|3[01])\|(?:0[469]\|11)-(?:0[1-9]\|[12]\d\|30)\|(?:02)-(?:0[1-9]\|1\d\|2[0-8])))T(?:(?:[01]\d\|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z\|([+-](?:[01]\d\|2[0-3]):[0-5]\d)))$`; format `date-time` |
| `action.coaching.durationMinutes` | Yes | When `action.kind` is `create-coaching`: integer; greater than 0 |
| `action.notifications` | Yes | When `action.kind` is `create-coaching`: `none`; Create without scheduled alerts. Alert scheduling is a separate workflow. |
| `action.postId` | Yes | When `action.kind` is `edit`: integer; greater than 0 |
| `action.changes` | Yes | When `action.kind` is `edit`: object |
| `action.changes.title` | No | When `action.kind` is `edit`: string; min length 1; max length 100 |
| `action.changes.description` | No | When `action.kind` is `edit`: string; max length 5000 |
| `action.changes.introduction` | No | When `action.kind` is `edit`: string; max length 250 |
| `action.changes.contentHtml` | No | When `action.kind` is `edit`: string; min length 2; max length 30000 |
| `action.changes.ageRating` | No | When `action.kind` is `edit`: integer; minimum 0; maximum 10000000 |
| `action.changes.publishedAt` | No | When `action.kind` is `edit`: string; pattern `^(?:(?:\d\d[2468][048]\|\d\d[13579][26]\|\d\d0[48]\|[02468][048]00\|[13579][26]00)-02-29\|\d{4}-(?:(?:0[13578]\|1[02])-(?:0[1-9]\|[12]\d\|3[01])\|(?:0[469]\|11)-(?:0[1-9]\|[12]\d\|30)\|(?:02)-(?:0[1-9]\|1\d\|2[0-8])))T(?:(?:[01]\d\|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z\|([+-](?:[01]\d\|2[0-3]):[0-5]\d)))$`; format `date-time` |
| `action.changes.coaching` | No | When `action.kind` is `edit`: object |
| `action.changes.coaching.link` | Yes | When `action.kind` is `edit`: string; max length 4096; format `uri` |
| `action.changes.coaching.startsAt` | Yes | When `action.kind` is `edit`: string; pattern `^(?:(?:\d\d[2468][048]\|\d\d[13579][26]\|\d\d0[48]\|[02468][048]00\|[13579][26]00)-02-29\|\d{4}-(?:(?:0[13578]\|1[02])-(?:0[1-9]\|[12]\d\|3[01])\|(?:0[469]\|11)-(?:0[1-9]\|[12]\d\|30)\|(?:02)-(?:0[1-9]\|1\d\|2[0-8])))T(?:(?:[01]\d\|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z\|([+-](?:[01]\d\|2[0-3]):[0-5]\d)))$`; format `date-time` |
| `action.changes.coaching.durationMinutes` | Yes | When `action.kind` is `edit`: integer; greater than 0 |
| `action.postId` | Yes | When `action.kind` is `publication`: integer; greater than 0 |
| `action.isPublished` | Yes | When `action.kind` is `publication`: boolean |
| `action.postId` | Yes | When `action.kind` is `delete`: integer; greater than 0 |
| `action.confirmation` | Yes | When `action.kind` is `delete`: `DELETE_MEDIA_POST` |
| `confirmToken` | No | string; pattern `^ct[a-f\d]{32}$`; The confirmToken from this tool's preview result. Omit it to preview; repeat the same input with it to execute. |