Skip to main content

Enroll in Course

This endpoint enrolls the authenticated user in a course by inserting a row into the CourseTaker join table.

Endpoint

POST /api/course/:id/enroll

Authentication

Authentication is required. Any authenticated user can enroll themselves; there is no role gate.

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique identifier of the course to enroll in

Response

Success Response

  • Status Code: 200 OK
  • Content: The enrolled course ID
{
"courseId": 42
}

Error Responses

  • 401 Unauthorized — No authenticated user.
  • 404 Not Found — No course exists with the supplied ID.
  • 500 Internal Server Error — Unexpected server error.

Notes

  • Enrolling the same user multiple times is a no-op — the join row is upserted.
  • This endpoint does not enforce group membership; the caller is responsible for verifying the user has access to the underlying group (e.g. via Get My Groups) before allowing enrollment in the UI.

Example

curl -X POST "https://api.tribesocial.io/api/course/42/enroll" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"