Create Course
This endpoint creates a new course on the authenticated user's platform and optionally attaches it to one or more groups.
Endpoint
POST /api/course
Authentication
Authentication is required. User must have the admin or creator role.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
title | String | Yes | 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 (defaults to false) |
PlatformId | Integer | Yes | ID of the platform this course belongs to |
groupIds | Array | No | Array of group IDs to attach this course to |
The authorId is set automatically from the authenticated user (or their TeamId if acting on behalf of a team) — it does not need to be supplied in the body.
Response
Success Response
- Status Code: 200 OK
- Content: The created course object
{
"id": 42,
"title": "Intro to Stoicism",
"description": "<p>A 6-week journey through the Stoic foundations.</p>",
"image": "1700000000000_tsf.png",
"publishedDate": "2025-01-15T00:00:00.000Z",
"hidden": false,
"PlatformId": 36,
"authorId": 9846,
"createdAt": "2025-01-10T19:24:52.000Z",
"updatedAt": "2025-01-10T19:24:52.000Z"
}
Error Responses
- 403 Forbidden — User does not have admin or creator privileges.
- 500 Internal Server Error — Unexpected server error.
Notes
- When
groupIdsis provided, the course is linked to each group via theGroupCoursejoin table. - The course is also mirrored to Firebase Firestore so it is immediately visible in the mobile app.
- If image transformation is enabled on the platform, the provided
imageURL is downloaded, resized to 480px wide, re-uploaded, and the transformed URL is stored on the course.
Example
curl -X POST "https://api.tribesocial.io/api/course" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Intro to Stoicism",
"description": "<p>A 6-week journey through the Stoic foundations.</p>",
"image": "https://cdn.tribesocial.io/cdn/stoicism-cover.png",
"PlatformId": 36,
"groupIds": [12, 34]
}'