Course Builder API
POST /services/courses/v1/courses/lessons/save Auth

Create or update a lesson

Without `id` a lesson is added at the end of module `module_id` (draft unless `status` says otherwise); with `id` only the fields sent change, and `module_id` moves it to another module of the same course. The slug is unique in the course; without one it is made from the title. `content` is HTML (cleaned on save). `is_preview`: anyone may read it while the course is published. A published course keeps at least one published lesson. A quiz lesson (`type` quiz) takes `settings.pass_percent` (0 to 100, default 70) and `settings.max_attempts` (empty: unlimited), and is published once it has a question.

Request Body Required

FieldTypeRequiredDescriptionExample
id integer|null No
module_id integer Yes
title string
max: 191
Yes
slug string|null
max: 191
No
type string|null
text, video, download, quiz, embed,
No
content string|null
max: 2000000
No
video_url string|null (uri)
max: 2000
No
attachments array|null No
duration_minutes integer|null
min: 0 max: 100000
No
is_preview boolean|null No
status string|null
draft, published,
No
position integer|null
min: 0
No
settings object No

Responses

201
200
422
401
403
429
Resource created
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
message string
data object
data.lesson mixed[]
Successful response
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
message string
data object
data.lesson mixed[]
Validation error
FieldTypeDescription
message string Errors overview.
errors object A detailed description of each field that failed validation.
Unauthenticated โ€” missing or invalid Bearer token
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
message string
Forbidden โ€” insufficient permissions for this resource
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
message string
Too Many Requests โ€” rate limit exceeded
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
Retry-After integer Seconds until the rate limit resets 60
FieldTypeDescription
error boolean
message string
Base URL
https://api.wemasy.nl/api
Authentication

Request Sample
cURL
JS
PHP
Python
curl -X POST "https://api.wemasy.nl/api/services/courses/v1/courses/lessons/save" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "string",
    "module_id": 0,
    "title": "string",
    "slug": "string",
    "type": "string",
    "content": "string",
    "video_url": "string",
    "attachments": "string",
    "duration_minutes": "string",
    "is_preview": "string",
    "status": "string",
    "position": "string",
    "settings": "string"
}'
fetch('https://api.wemasy.nl/api/services/courses/v1/courses/lessons/save', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "id": "string",
    "module_id": 0,
    "title": "string",
    "slug": "string",
    "type": "string",
    "content": "string",
    "video_url": "string",
    "attachments": "string",
    "duration_minutes": "string",
    "is_preview": "string",
    "status": "string",
    "position": "string",
    "settings": "string"
})})
.then(r => r.json())
.then(data => console.log(data));
$response = Http::withToken('YOUR_API_TOKEN')
    ->accept('application/json')
    ->post('https://api.wemasy.nl/api/services/courses/v1/courses/lessons/save', {
    "id": "string",
    "module_id": 0,
    "title": "string",
    "slug": "string",
    "type": "string",
    "content": "string",
    "video_url": "string",
    "attachments": "string",
    "duration_minutes": "string",
    "is_preview": "string",
    "status": "string",
    "position": "string",
    "settings": "string"
});
$data = $response->json();
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = {
    "id": "string",
    "module_id": 0,
    "title": "string",
    "slug": "string",
    "type": "string",
    "content": "string",
    "video_url": "string",
    "attachments": "string",
    "duration_minutes": "string",
    "is_preview": "string",
    "status": "string",
    "position": "string",
    "settings": "string"
}
r = requests.post("https://api.wemasy.nl/api/services/courses/v1/courses/lessons/save", headers=headers, json=data)
print(r.json())
Response Example
{
    "error": true,
    "message": "string",
    "data": {
        "lesson": []
    }
}

Try It
Request Body Required

Export