Skip to main content

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

FieldTypeRequiredDescription
titleStringYesDisplay title of the course
descriptionStringNoRich text description (HTML allowed)
imageStringNoCover image filename. Original images are auto-resized to a 480px variant.
publishedDateDateNoWhen the course should be considered published
hiddenBooleanNoWhen true, hides the course from non-admin listings (defaults to false)
PlatformIdIntegerYesID of the platform this course belongs to
groupIdsArrayNoArray 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 groupIds is provided, the course is linked to each group via the GroupCourse join 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 image URL 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]
}'