POST /api/v1/lessons/{lessonId}/resources/reorder
Sets the order of the resources of a lesson. The complete ordered list, never a
move: the ids you send must be exactly the resources of that lesson.
| Role in the organization | This endpoint |
|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Refused |
| Requirement | Rule for this endpoint |
|---|
| Business role | None — the order is set by whoever may edit the lesson |
| Resource scope | Lesson of the school attached to the API key |
| Resource state | An archived program or course answers 403 |
| Parameter | Type | Required | Description |
|---|
lessonId | UUID | yes | Lesson visible from the key's school |
| Header | Required | Description |
|---|
x-api-key | yes | API key created for this school |
Idempotency-Key | yes | Stable key for this ordering |
X-Correlation-Id | no | Caller correlation id, returned or generated |
Request body
| Field | Type | Required | Nullable | Description |
|---|
orderedResourceIds | array of UUID | yes | no | 1 to 500 ids, no duplicates, exactly the resources of this lesson |
curl -X POST "$COHORTE_API_BASE_URL/api/v1/lessons/$LESSON_ID/resources/reorder" \
-H "x-api-key: $COHORTE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H 'Content-Type: application/json' \
-d '{"orderedResourceIds":["'"$FIRST"'","'"$SECOND"'"]}'
200 OK — the ids, in their new order.
400 Bad Request — missing Idempotency-Key, invalid JSON, duplicates, or a set that is not exactly the resources of the lesson.
401 Unauthorized — the key is missing, invalid, or no longer attached to a member.
403 Forbidden — the bearer is not OWNER or ADMIN, or the program is archived.
404 Not Found — the lesson is unknown or belongs to another school.
| Field | Type | Nullable | Description |
|---|
success | boolean | no | true for a successful request |
data.lessonId | UUID | no | The lesson |
data.orderedResourceIds | array of UUID | no | The resources, in their new order |
correlationId | UUID | no | Correlation id for support |
{
"success": true,
"data": {
"lessonId": "5d9f3a60-1c2b-4e7d-8f4a-6b7c8d9e0f1a",
"orderedResourceIds": [
"b9d1e243-7f6a-4c8b-a3d9-9e0f1a2b3c4d",
"a2f4c681-3e5b-4d7c-9e18-8d9e0f1a2b3c"
]
},
"correlationId": "0f6b1d92-5c3e-4a8b-9d71-3e2f4a6b8c10"
}
With Idempotency-Key, retries of the identical target and payload do not write another mutation, audit or event. A different intention under that key returns 409. Results describe the currently authorized resource state.