Update Course
This endpoint updates an existing course and optionally resets the set of groups it is attached to.
Endpoint
PUT /api/course/:id
Authentication
Authentication is required. User must have the admin or creator role.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer | Yes | Unique identifier of the course to update |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
title | String | No | Display title of the course |
description | String | No | Rich text description (HTML allowed) |
image | String | No | Cover image filename. Original images are auto-resized to a 480px variant. |
publishedDate | Date | No | When the course should be considered published |
hidden | Boolean | No | When true, hides the course from non-admin listings |
groupIds | Array | No | Replaces the set of groups this course is attached to |
Any field omitted from the body is left unchanged. Supplying groupIds performs a full replacement of the course's group attachments — pass the complete desired array.
Response
Success Response
- Status Code: 200 OK
- Content: The updated course object
{
"id": 42,
"title": "Intro to Stoicism (Cohort 2)",
"description": "<p>Updated description.</p>",
"image": "1700000000000_tsf.png",
"publishedDate": "2025-02-01T00:00:00.000Z",
"hidden": false,
"PlatformId": 36,
"authorId": 9846,
"createdAt": "2025-01-10T19:24:52.000Z",
"updatedAt": "2025-02-01T12:00:00.000Z"
}
Error Responses
- 404 Not Found — No course exists with the supplied ID.
- 403 Forbidden — User does not have admin or creator privileges.
- 500 Internal Server Error — Unexpected server error.
Notes
- The course is mirrored to Firebase Firestore on every successful update so mobile clients stay in sync.
- If image transformation is enabled on the platform, a new
imageURL is downloaded, resized to 480px wide, and re-uploaded before being stored.
Example
curl -X PUT "https://api.tribesocial.io/api/course/42" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Intro to Stoicism (Cohort 2)",
"groupIds": [12, 34, 56]
}'