# Create a lesson

`POST https://api.cademi.com.br/api/v3/products/{product_id}/lessons`

Operation ID: `lessons.create` · API v3

Creates a lesson in the product, optionally inside a module. New lessons are created as drafts.

The `Location` header of the response contains the URL of the new lesson. Lessons cannot be created in replicated products; such requests return `replica_readonly`.

Required permissions: `lessons.create`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `product_id` | path | string | yes |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `format` | string, one of `standard`, `quiz`, `live_youtube`, `live_vimeo` | yes |  |
| `module_id` | string or null | no |  |
| `name` | string | yes |  |
| `position` | integer | no |  |
| `summary` | string or null | no |  |

## Responses

### 201

Returns the newly created lesson.

Body: `data`: Lesson.

Fields of Lesson:

| Field | Type | Required | Description |
|---|---|---|---|
| `connection` | object | yes |  |
| `created_at` | string (date-time) | yes |  |
| `deleted` | boolean | yes |  |
| `exam_id` | string or null | yes | Public ID of the exam displayed in this lesson, or null when the lesson displays no exam. |
| `format` | string, one of `standard`, `quiz`, `live_youtube`, `live_vimeo` | yes |  |
| `id` | string | yes | Public ID, with the les_ prefix. |
| `image` | string or null | yes |  |
| `module_id` | string or null | yes | Public ID of the module that contains the lesson, or null in blog-format products. |
| `name` | string | yes |  |
| `object` | string, one of `lesson` | yes |  |
| `pinned` | boolean | yes |  |
| `position` | integer | yes |  |
| `product_id` | string | yes | Public ID, with the prd_ prefix. |
| `published_at` | string or null (date-time) | no |  |
| `revision` | string | yes |  |
| `settings` | object | yes | Lesson settings. Contains only supported keys; an empty object when no settings have been defined. |
| `status` | string, one of `published`, `draft` | yes |  |
| `summary` | string or null | yes |  |
| `updated_at` | string (date-time) | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The product was not found or is not accessible with the current credentials.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

Full schema: https://cademi.dev/openapi/v3.json
