# Connect a lesson

`PUT https://api.cademi.com.br/api/v3/products/{product_id}/lessons/{lesson_id}/connection`

Operation ID: `lessons.connection.update` · API v3

Connects the lesson to the source lesson given by `source_lesson_id`. A connected lesson mirrors the content of its source lesson and takes on its format, name, summary, and thumbnail.

Requires the `lessons.connect` permission on the lesson being connected. The source lesson must be readable with the current credentials; otherwise the API returns `404 Not Found`. The source lesson must have the same format, must not be the lesson itself, and must not be connected to another lesson.

Send the lesson's current `ETag` in the `If-Match` header to avoid overwriting a newer version. Replicated lessons are read-only, and requests to change them return `replica_readonly`.

Required permissions: `lessons.connect`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `product_id` | path | string | yes |  |
| `lesson_id` | path | string | yes |  |
| `If-Match` | header | string | no |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `source_lesson_id` | string | yes |  |

## Responses

### 200

Returns the new lesson connection.

Body: `data`: LessonConnection.

Fields of LessonConnection:

| Field | Type | Required | Description |
|---|---|---|---|
| `connected` | boolean | yes |  |
| `connected_at` | string or null (date-time) | no |  |
| `object` | string, one of `lesson_connection` | yes |  |
| `source` | object or null | 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 lesson or the source lesson was not found or is not accessible with the current credentials.

Body: Error.

### 412

The lesson has changed since the revision supplied in If-Match.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

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