# Create lesson

`POST https://api.tentary.com/v1/courses/{course_id}/lessons`

Source: https://tentary.com/de/help/api/create-lesson/
Area: Kurse
MCP tool: `create_lesson`. Changes data at once.

---

Adds a lesson with its content blocks to a module of a course. The lesson is a draft unless `draft` is `false`.

The answer is the lesson, as in [`GET /v1/lessons/{lesson_id}`](https://tentary.com/de/help/api/get-lesson/).

## Authorization

`Authorization: Bearer <API key>`

A personal API key (tnt_...). Create it in the Tentary app on the page AI & API.

## Path parameters

- `course_id` (integer, required, path): The id from list_courses or create_course. Limits: min 1.

## Request body

- `module_id` (integer, required): The module of the lesson (from create_module or get_course_outline). Limits: min 1.
- `title` (string, required): Title that buyers see. Limits: minLength 1, maxLength 255.
- `position` (integer): Place among the items of the same module: 1 = first. Default: last. Limits: min 1.
- `draft` (boolean): true = buyers do not see it. New items are drafts unless draft is false. draft true removes the release rule.
- `release` (object, can be null): When buyers get the item. null = at once (also left out on create; left out on update = no change). One rule: days or hours after purchase, a date, or after another lesson is done (only if the course tracks progress). Days and dates unlock at drip_release_hour of get_course_outline. Needs draft false. The answers add lesson_title and enforced to after_lesson (read only; enforced false = the course does not track progress, so the rule has no effect).
  - `type` (string, required) Allowed values: `days_after_purchase`, `hours_after_purchase`, `date`, `after_lesson`.
  - `days` (integer) Limits: min 1, max 9999.
  - `hours` (integer) Limits: min 1, max 9999.
  - `date` (string): Like 2026-12-01. Limits: pattern ^[0-9]{4}-[0-9]{2}-[0-9]{2}$.
  - `lesson_id` (integer): after_lesson: a lesson of the same course. Limits: min 1.
- `free_preview` (boolean): Everyone can watch this lesson as a free preview, also without purchase.
- `content` (array of object): What buyers see in the lesson, in order: the content blocks of products, without folders. Images, videos, audio and files come from upload_file. Replaces all content. Limits: maxItems 100.
  - `type` (string, required): text: formatted text. image: shows the image. video: an uploaded video in the player (streamed, converted some minutes after its first use). audio: an audio player. file: a download. video_embed: a YouTube, Vimeo or Loom video. button: a link button. image, video, audio and file need file_id. Type, name and description are stored with the file: one file shows the same way in every product and lesson. Allowed values: `text`, `image`, `video`, `audio`, `file`, `video_embed`, `button`.
  - `html` (string): text: the text as HTML (p, h1-h4, strong, em, ul, ol, li, a, img, blockquote). Placeholders for the buyer: %FIRST_NAME%, %FULL_NAME%, %EMAIL%, %PRODUCT_TITLE%, %VARIANT_TITLE%, %ORDER_ID%, %ACCESS_LINK[Text]%, %ACCESS_LINK_BUTTON[Text]%, %SELLER_NAME%, %SELLER_SUPPORT_EMAIL%; bookings also %ORDER_BOOKING_FROM%, %ORDER_BOOKING_TO%, %ORDER_BOOKING_ZOOM_LINK%. Limits: maxLength 65535.
  - `url` (string): video_embed: YouTube, Vimeo or Loom link. button: the link target. Limits: maxLength 2048.
  - `label` (string): button: the button text. Limits: maxLength 250.
  - `file_id` (integer): image, video, audio, file: a file from upload_file, or a file_id from get_product or get_lesson content. Limits: min 1.
  - `name` (string): image, video, audio, file: the name of the file (file: shown above the download). Limits: minLength 1, maxLength 250.
  - `description` (string): file: plain text under the download. audio: the title above the player. Limits: maxLength 65535.
  - `folder` (string, can be null): Optional folder name. Blocks with the same folder show together. Not in lessons. Limits: maxLength 250.

## Response

- `id` (integer): The ID.
- `course_id` (integer): The course of the lesson.
- `course_name` (string): The course name.
- `module_id` (integer, can be null): The module of the lesson.
- `title` (string): The title.
- `position` (integer): Place in its module, 1 = first.
- `draft` (boolean): true = buyers do not see it.
- `free_preview` (boolean): true = everyone can watch it as a free preview.
- `release` (object, can be null): When buyers get the item. null = at once.
  - One of:
    - Variant type: days_after_purchase:
      - `type` (string): The rule type. Allowed values: `days_after_purchase`.
      - `days` (integer): Days after the purchase.
    - Variant type: hours_after_purchase:
      - `type` (string): The rule type. Allowed values: `hours_after_purchase`.
      - `hours` (integer): Hours after the purchase.
    - Variant type: date:
      - `type` (string): The rule type. Allowed values: `date`.
      - `date` (string<date>): Like 2026-01-31.
    - Variant type: after_lesson:
      - `type` (string): The rule type. Allowed values: `after_lesson`.
      - `lesson_id` (integer): The lesson that the buyer must finish first.
      - `lesson_title` (string, can be null): The title of that lesson.
      - `enforced` (boolean): false = the course does not track progress, so the rule has no effect.
- `content` (array of object): Content blocks, in order.
  - One of:
    - Variant type: text:
      - `type` (string): The block type. Allowed values: `text`.
      - `html` (string): The text as HTML.
    - Variant type: image, video:
      - `type` (string): The block type. Allowed values: `image`, `video`.
      - `file_id` (integer): The file ID (from upload_file).
      - `name` (string): The name.
      - `file_type` (string): File extension, like pdf.
      - `size_bytes` (integer, can be null): File size in bytes.
    - Variant type: audio, file:
      - `type` (string): The block type. Allowed values: `audio`, `file`.
      - `file_id` (integer): The file ID (from upload_file).
      - `name` (string): The name.
      - `description` (string): file: text under the download. audio: title above the player.
      - `file_type` (string): File extension, like pdf.
      - `size_bytes` (integer, can be null): File size in bytes.
    - Variant type: video_embed:
      - `type` (string): The block type. Allowed values: `video_embed`.
      - `url` (string): YouTube, Vimeo or Loom link.
    - Variant type: button:
      - `type` (string): The block type. Allowed values: `button`.
      - `label` (string): The text that buyers see.
      - `url` (string): The link.
- `admin_url` (string<uri>): The page in the Tentary app.

## Example request

```bash
curl -X POST "https://api.tentary.com/v1/courses/202/lessons" \
  -H "Authorization: Bearer $TENTARY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "module_id": 308,
  "title": "Hip opener",
  "draft": false,
  "content": [
    {
      "type": "text",
      "html": "<p>Hold each pose for five breaths.</p>"
    },
    {
      "type": "video_embed",
      "url": "https://www.youtube.com/watch?v=demo7654321"
    }
  ]
}'
```

## Example response

```json
{
  "id": 309,
  "course_id": 202,
  "course_name": "Yoga for Runners",
  "module_id": 308,
  "title": "Hip opener",
  "position": 1,
  "draft": false,
  "free_preview": false,
  "release": null,
  "content": [
    {
      "type": "text",
      "html": "<p>Hold each pose for five breaths.</p>"
    },
    {
      "type": "video_embed",
      "url": "https://www.youtube.com/watch?v=demo7654321"
    }
  ],
  "admin_url": "https://app.tentary.com/courses/edit/202#l309"
}
```
