Set up your institution, step by step. Start here.

Developer API Reference: Endpoints, Student Tokens, Errors & Limits

The /v1 HTTP API for any language: the X-Api-Key header, every endpoint and the permission it needs, student sign-in tokens, error codes and request limits.


Use this reference to call the Course37 API from any language: PHP, Python, a mobile app or your own server. In JavaScript, the Course37 SDK does all of this for you. Keys and modes are set up in Integrations → Developer API — see Set Up the Developer API.


Basics

  • Base URL: https://api.course37.com/v1
  • Authentication: your key in the X-Api-Key header, on every request.
  • Organization: decided by the key. Organization headers are ignored.
  • Format: JSON. A successful reply puts the result in data.
curl https://api.course37.com/v1/courses \
  -H "X-Api-Key: pk_live_..."
{ "data": [ … ], "count": 12 }
  • A publishable key (pk_live_…) works from a server, and from a browser on your Allowed websites — the API checks the browser's Origin.
  • A secret key (sk_live_…) works from a server only. Any request with an Origin header is refused.
  • From a browser, don't send cookies (credentials: 'omit').

Catalog Endpoints (Hybrid and Headless)

Method Path Permission Returns
GET /v1/org org:read Name, logo, contact details, theme, locale, mode, and studentPortalUrl — your Course37 site
GET /v1/courses courses:read Active courses, with count
GET /v1/courses/{idOrSlug} courses:read One course, with its syllabus and teachers
GET /v1/pages/{slug} pages:read A published website page and its sections. The home page is /v1/pages/home

Each course carries links.course and links.checkout: its page and its checkout on your Course37 site, for Enroll buttons in Hybrid mode.

These replies may be cached for 60 seconds (Cache-Control: private, max-age=60, varying by X-Api-Key and Origin). Every other reply is no-store.


Student Sign-In (Headless Only)

Each is a POST with a JSON body, and needs the students:auth permission.

Path Body Returns
/v1/auth/signup/send-otp identifier Sends a sign-up code. sentVia says how; expiresInSeconds is 300
/v1/auth/signup identifier, otp, password, name, deviceId? Creates the student account and signs in: a token pair
/v1/auth/signin identifier, password, deviceId? A token pair
/v1/auth/refresh refreshToken A new token pair
/v1/auth/signout refreshToken signedOut: true
/v1/auth/password/forgot identifier Sends a reset code
/v1/auth/password/verify-otp identifier, otp resetToken
/v1/auth/password/reset resetToken, password Sets the new password and signs the student out on every device
  • identifier is an email address or a mobile number. Codes are 4 to 8 digits.
  • deviceId is optional. When your server calls on behalf of visitors, send a stable id for each browser or app install (8 to 128 characters), so each one gets its own session.
  • A student who already has a Course37 account can sign in with it, and joins your organization, as on your Course37 site.

A token pair:

{
  "data": {
    "accessToken": "…",
    "tokenType": "Bearer",
    "expiresIn": 900,
    "refreshToken": "…",
    "refreshTokenExpiresAt": "2027-01-01T10:00:00.000Z"
  }
}
  • The access token lasts 15 minutes; expiresIn is in seconds.
  • The refresh token lasts 30 days and works once. Every refresh returns a new pair — always store the new refresh token.
  • If two requests refresh with the same token at once, one gets refresh_token_used: use the newest token. If an old refresh token comes back later, the session is signed out (refresh_token_reused), because the token may have been stolen.
  • Keep the refresh token on your server, for example in an HttpOnly cookie, if you can.

Student Learning (Headless Only)

Every /v1/me request needs the key and Authorization: Bearer <accessToken>, and the students:learn permission. A student only ever sees their own data.

Method Path Returns
GET /v1/me The student's profile
GET /v1/me/enrollments Enrolled courses and their modules
GET /v1/me/courses/{slug}/modules/{moduleId} Videos, PDFs, exams and live classes in a module. Locked items have no links
GET /v1/me/courses/{slug}/curriculum Self-paced lessons, with progress and locks
GET /v1/me/lessons/{lessonId} One self-paced lesson
POST /v1/me/lessons/{lessonId}/complete Marks the lesson complete
GET /v1/me/videos/{videoId}/progress The saved watch position
POST /v1/me/videos/{videoId}/progress Saves it. Body: positionSec, durationSec, completed?
GET /v1/me/payments/summary Paid, due and upcoming installments
GET /v1/me/sessions The devices the student is signed in on
DELETE /v1/me/sessions/{id} Signs one device out

Errors

Errors look like this:

{
  "statusCode": 403,
  "error": "origin_not_allowed",
  "message": "Origin https://acme.com is not in this organization's allowed origins."
}

Check error in your code; message is safe to show. Three kinds look different:

  • A body that fails validation answers 400 with "message": "Validation failed" and an errors list.
  • A course or page that doesn't exist answers 404 with "error": "Not Found".
  • A course the student isn't enrolled in answers 404 with "errorCode": "NOT_ENROLLED".

Key and setup

Status error Meaning
401 missing_api_key No X-Api-Key header
401 invalid_api_key A wrong, deleted or disabled key
403 organization_inactive The organization is not active
403 api_disabled The Developer API is Off
403 headless_mode_required Sign-in and learning need Headless mode
403 origin_not_allowed The browser's website isn't in Allowed websites
403 secret_key_in_browser A secret key was sent from a browser
403 insufficient_scope The key is missing a permission
429 rate_limited Too many requests — wait Retry-After seconds

Sign-in

Status error Meaning
400 invalid_identifier Not an email address or mobile number
400 invalid_otp, otp_expired A wrong code, or an expired one — request a new code
400 otp_not_sent The code couldn't be sent; message says why
401 invalid_credentials A wrong email, mobile number or password (the same answer for each)
403 not_a_student Only student accounts can sign in
403 device_limit_reached Signed in on the maximum number of devices; the reply includes maxDevices
403 registrations_closed New sign-ups are turned off
409 Conflict An account with this email or mobile number already exists — sign in instead

Student tokens

Status error Meaning
401 missing_student_token, invalid_student_token No access token, or an expired one — refresh it
401 refresh_token_used Another request just used this refresh token — use the newest one
401 invalid_refresh_token, refresh_token_expired, refresh_token_reused, session_ended Sign the student in again
403 not_in_organization The student isn't part of this organization

Learning

Status error Meaning
400 use_curriculum A self-paced module — use /v1/me/courses/{slug}/curriculum
403 lesson_locked Finish the earlier lessons first
404 not_found No such module, lesson or video

Request Limits

  • By default, a key can make 1,200 requests a minute, from all visitors and servers together, and each visitor's browser 120 a minute. The Connection panel in Developer API shows your current limits.
  • Replies carry X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (a Unix time in seconds).
  • Over a limit, the API answers 429 rate_limited with a Retry-After header, in seconds.
  • Sign-in attempts and code requests have their own, stricter limits, and also answer 429.

Related: Use the Course37 JavaScript SDK · Set Up the Developer API · Build Your Own Student Website

#api reference #rest api #x-api-key #endpoints #error codes #rate limits #access token #developer api