Server API
Classes & students
Read your classes and who's in them; enrol people from your own systems.
Each class has a public page at mercestack.com/classrooms/<workspace>/<class> where people pay to join. Paying students become customers in your CRM, tagged student. Use these endpoints to read the roster or give someone a seat — a scholarship, a corporate booking — without payment.
List classes
/v1/classroomsWith price, status and seats taken.
curl https://api.mercestack.com/v1/classrooms \
-H "Authorization: Bearer sk_test_…"{ "object": "list", "data": [ { "id": "c1…", "title": "Product Design Bootcamp", "status": "published", … } ], "hasMore": false, "nextCursor": null }Get a class
/v1/classrooms/:idSessions, resources and enrolments.
curl https://api.mercestack.com/v1/classrooms/CLASS_ID \
-H "Authorization: Bearer sk_test_…"{ "id": "c1…", "title": "Product Design Bootcamp", "sessions": [ … ], … }List students
/v1/classrooms/:id/enrollmentsEveryone enrolled, with status and what they paid.
Query parameters
searchstring- Name or email.
curl https://api.mercestack.com/v1/classrooms/CLASS_ID/enrollments \
-H "Authorization: Bearer sk_test_…"{
"object": "list",
"data": [
{
"id": "e1…",
"name": "Chidi Okeke",
"email": "[email protected]",
"status": "active",
"customerId": "7e1f…",
"amountMinor": "4500000",
"currency": "NGN",
"enrolledAt": "2026-09-01T10:00:00.000Z"
}
],
"hasMore": false,
"nextCursor": null
}Enrol someone
/v1/classrooms/:id/enrollmentsGives a seat without payment and emails them the class. Respects capacity.
Body
namestringrequired- Student's name.
emailstringrequired- Where the invitation goes.
curl -X POST https://api.mercestack.com/v1/classrooms/CLASS_ID/enrollments \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"name":"Ngozi Eze","email":"[email protected]"}'{ "id": "e2…", "status": "active", … }Create a class
/v1/classroomsA class with its offering. primaryInstructorMembershipId is a member of your workspace; the class starts as a draft until published.
Body
titlestringrequired- Shown on the class page.
enrollmentKind"paid" | "free" | "invite"required- How people get a seat.
primaryInstructorMembershipIduuidrequired- The member who teaches it.
pricestring- For paid classes, in major units.
capacitynumber- Seats. Omit for unlimited.
curl -X POST https://api.mercestack.com/v1/classrooms \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"title":"Product Design Bootcamp","enrollmentKind":"invite","primaryInstructorMembershipId":"MEMBERSHIP_ID"}'{ "id": "c1…", "status": "draft", … }Schedule a live session
/v1/classrooms/:id/sessionsA live class on a date. Also GET to list, and PATCH / DELETE /sessions/:id to move or cancel one that has not started.
Body
titlestringrequired- Week 1 — Research.
startsAtISO 8601required- When it starts.
endsAtISO 8601required- When it ends.
curl -X POST https://api.mercestack.com/v1/classrooms/CLASS_ID/sessions \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"title":"Week 1","startsAt":"2026-10-05T09:00:00Z","endsAt":"2026-10-05T10:00:00Z"}'{ "id": "s1…", "status": "scheduled", … }Create a join link
/v1/sessions/:id/join-linksA link that puts one person into the live class — a learner on their enrollment, or a host who runs it — with no Mercestack account. Mint one per person on your server and send it from your own app; it works until it expires. A host joining starts the class. Guests can join only once it is live; before then the link says so and can be retried.
Body
role"host" | "learner"required- What they can do in the room.
enrollmentIduuid- Required for a learner.
namestring- How a host appears.
expiresInnumber- Seconds, 60–604800. Default 86400.
returnUrlhttps URL- Where Leave takes them on your site.
curl -X POST https://api.mercestack.com/v1/sessions/SESSION_ID/join-links \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"role":"learner","enrollmentId":"ENROLLMENT_ID"}'{ "url": "https://classroom.mercestack.com/live/s1…#handoff=…", "expiresAt": "2026-10-06T09:00:00.000Z" }Embed the live class in your own page with the join link: <div data-mercestack-classroom="JOIN_LINK" style="height:640px"></div> and <script src="https://classroom.mercestack.com/live/embed.js" async></script>. The frame gets camera, microphone and screen-share permission; nothing else on your page can reach into it.
List recordings
/v1/sessions/:id/recordingsRecordings a host made during the class (recording always starts by hand). playbackUrl streams the MP4 and works for a few hours — fetch it when you need it rather than storing it. Listen for the recording.ready webhook to know when one lands.
curl https://api.mercestack.com/v1/sessions/SESSION_ID/recordings \
-H "Authorization: Bearer sk_test_…"{ "object": "list", "data": [ { "id": "r1…", "status": "ready", "durationSeconds": 3540, "playbackUrl": "https://…/recordings/play/r1…?exp=…&sig=…" } ], … }Webhooks for classes: classroom.session.started, classroom.session.ended, classroom.enrollment.confirmed, classroom.enrollment.cancelled and recording.ready. Add an endpoint under Settings › Developers.