Skip to content

Teacher lessons on a website

Lessons are booked inside the Mr Charles app — students have an account, pay there and get their lesson in their agenda. What a teacher’s website can do is show the offers and the times that are actually free, and send the student into the app with everything preselected.

import { createClient } from '@mrcharles/sdk';
const mc = createClient();
const profile = await mc.teachers.profile(instructorUserId); // name, bio, instruments, rating…
const offers = await mc.teachers.offers(instructorUserId); // published offers only

Each offer carries title, instrument, durationMinutes, priceCents/currency and mode (online, in_person). Only published offers are returned; a draft never leaks.

const slots = await mc.teachers.slots({ instructorUserId, offerId: offers[0].id, date: '2026-10-20', days: 7 });
// slots.days → [{ date: '2026-10-20', times: ['10:00', '11:00', '17:00'] }, …] in the teacher's zone

slots applies the offer’s duration, the teacher’s policy (notice, horizon, buffers) and existing lessons; windows gives the raw free windows if you want to draw a calendar yourself. Neither is cached: fetch when the student opens the picker.

const url = mc.links.bookLesson({ instructorId: instructorUserId, offerId: offers[0].id });
// https://app.mrcharles.app/bookings/book?instructorId=…&offerId=…

Record the booking as made on your website

Section titled “Record the booking as made on your website”

Create a publishable key in the app (Teaching → Profile → Your website) with your site’s exact address, for example https://www.yourname.com. Then ask for a hand-off token when the student clicks Book and put it on the link:

const mc = createClient({ publishableKey: 'pk_live_…' }); // safe in your page
const { attribution } = await mc.attribution.handoff(); // signed, valid 30 minutes
location.href = mc.links.bookLesson({ instructorId: instructorUserId, offerId, attribution });

The API only accepts the key from the addresses you listed and only trusts a token it signed. The token names you as the teacher, so it does nothing on another teacher’s lesson. There is no field to set the channel yourself. Without a token, or once it has expired, the lesson is recorded as a marketplace booking.

The student lands on the booking screen with the teacher and offer selected, signs in or creates an account, picks the slot and pays. There is no guest flow for lessons on purpose: a lesson is a relationship with reminders, rescheduling and a chat, and those need an account.

  • Create a lesson booking from your server. There is no public write endpoint for lessons.
  • Read a student’s bookings. That is theirs, in the app.

Need either? Tell us what for — it is how the public surface grows.