Skip to main content

Create Lesson

Add a lesson to a course. type and name are required. The new lesson is placed after the highest order, or at 0 when the course has no lessons. Visitors see the lesson after you publish. See Lessons and Lesson Object.

Request​

POST /players/{id}/files

Path Parameters​

ParameterTypeRequiredDescription
idstringYesCourse UUID. See Identifiers.

Request Body​

ParameterTypeRequiredDescription
draft_versionintegerYesCurrent counter from Get Course. Minimum 1. Missing, not an integer, or below 1 is 422. A value that is not current is 409.
typestringYesvideo, audio, file, pdf, google, embed, text, image, or header
namestringYesName, 1–255 characters
descriptionstring|nullNoLonger description. Omit for null.
textstringNoBody text. Omit for "".
src_urlstringNoAddress of the lesson. Omit for "".
video_sourcestringNoyoutube, vimeo, wistia, bunny, or other. Omit for vimeo.
infostringNoShort note, maximum 255 characters. Omit for "".
is_freebooleanNoOmit for false.
is_hiddenbooleanNoOmit for false.
scheduleobject|nullNoSchedule Object. Omit for null.

Example Request​

curl -X POST "https://app.easy.tools/api/v1/players/8f3c1a62-d047-4e89-9b25-1c6a4d8e0f71/files" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"draft_version": 1,
"type": "video",
"name": "Welcome",
"description": "Start here.",
"src_url": "https://video.example.com/play/welcome",
"video_source": "bunny",
"is_free": true
}'

Response​

Success Response (201)​

{
"data": {
"id": "3a91c4e0-6b27-4f58-9d14-7e2b8c0a5f63",
"name": "Welcome",
"type": "video",
"description": "Start here.",
"text": "",
"src_url": "https://video.example.com/play/welcome",
"video_source": "bunny",
"info": "",
"is_free": true,
"is_hidden": false,
"order": 0,
"schedule": null,
"preview_url": "https://app.easy.tools/players/8f3c1a62-d047-4e89-9b25-1c6a4d8e0f71/preview?expires=1768478400&signature=7d2e9c41a6b85f03e1c7d94a2b6f80e35c1a9d7b4e2f60c8a3d5b1e9f7c2a046",
"draft_version": 2,
"draft_updated_at": "2026-01-15T11:05:00.000Z"
}
}

Response Fields​

See Lesson Object. preview_url on data is minted for this response. draft_version and draft_updated_at are on data as well.

Error Responses​

Not Found Error (404)​

See Identifiers.

{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Resource not found"
}
}

Conflict Error (409)​

draft_version is not the current counter. Read the course and retry with that value.

{
"error": {
"code": "CONFLICT",
"message": "The draft was edited elsewhere. GET the draft and retry with the current draft_version."
}
}

Validation Error (422 Unprocessable Entity)​

{
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid",
"details": {
"type": ["type must be one of the following values: video, audio, file, pdf, google, embed, text, image, header"]
}
}
}

Authentication, permission, and rate-limit errors are described in Authorization.