# Northlight Yoga for developers

Northlight Yoga is a sample yoga studio whose classes people, programs and AI assistants can book for free, with no account, through a page, an API or MCP.

Call the same operations over plain HTTP, as MCP tools, or from a page through WebMCP. The base URL is `https://yoga.ferrite.run`.

## Quickstart

Read something first. This request needs no setup:

```sh
curl -s 'https://yoga.ferrite.run/api/event-types'
```

List every bookable class with its duration, seats per session, teacher IDs, optional per-class booking questions (`questions`), and drop-in pricing (`drop_in_price: null`, `pricing_model`). Use it first, to find the class a customer wants and its id. Required fields: none. Example: GET /api/event-types. Returns `{ event_types: [...], drop_in_price: null, pricing_model }`.

Then change something. Send an `idempotency-key` so a retry cannot run twice:

```sh
curl -s -X POST 'https://yoga.ferrite.run/api/routing/responses' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: submit_routing_response-1' \
  -d '{"company_size":1,"email":"maya@example.org","name":"Maya Lin"}'
```

To use Northlight Yoga from an AI assistant, add its MCP server:

```sh
claude mcp add --transport http ferrite-booking https://yoga.ferrite.run/mcp
```

## Authentication and API keys

No API key, account or sign-up is needed to read the timetable, hold a place, book a class, change a booking with the token on its receipt, join a waitlist or send an enquiry. Six operations act on a member's account: `get_my_account`, `list_my_bookings`, `book_with_membership`, `cancel_my_booking`, `subscribe_membership` and `manage_membership`. They need a Personal Agent's `Poppy-Session` header and an OAuth 2.1 access token with the scope each description names, and answer 401 without them. The [protected resource metadata](/.well-known/oauth-protected-resource) names the authorization server, and the [agent guide](/poppy/guide) walks through the sign-in.

## Sandbox

The public address is the sandbox. The studio is fictional, its timetable is seeded and nothing is charged, so a test booking costs nobody anything. Use an address at `example.org` as the attendee, and cancel with the `manage_token` from the receipt when you have finished so that the place is free again. To try the member operations, sign in at [/account](/account) as one of the two demo members.

The [sandbox page](/sandbox) is the place to start.

## Endpoints

| Operation | Request | What it does |
| --- | --- | --- |
| `list_event_types` | `GET /api/event-types` | List every bookable class with its duration, seats per session, teacher IDs, optional per-class booking questions (`questions`), and drop-in pricing (`drop_in_price: null`, `pricing_model`). Use it first, to find the class a customer wants and its id. Required fields: none. Example: GET /api/event-types. Returns `{ event_types: [...], drop_in_price: null, pricing_model }`. |
| `list_slots` | `GET /api/event-types/{id}/slots` | List open sessions for one class over the next `days` days (default 14, max 60). Use it before holding or booking, because it is the only source of a valid `start_ms`. Required fields: `id` (event_type_id or slug, e.g. `beginners-yoga` or `evt_beginners`). Optional: `timezone` (IANA), `teacher_id` (`mem_mira`, `mem_nadia`, `mem_karim`), `days` (1-60). Example: GET /api/event-types/beginners-yoga/slots?days=14&timezone=Europe/London. Returns `{ slots: [{ start_ms, local_start, seats_remaining, ... }], now_ms, questions, drop_in_price: null, pricing_model }`. |
| `list_teachers` | `GET /api/teachers` | List active Northlight Yoga teachers with bios, specialties, certifications, and classes (including each class's `questions` and `drop_in_price: null`). Use it when the customer asks who teaches, or wants a class with a particular teacher. Required fields: none. Example: GET /api/teachers. Returns `{ teachers: [{ id, name, bio, specialties, classes }] }`. |
| `get_teacher_schedule` | `GET /api/teachers/{teacher_id}/slots` | List upcoming open sessions taught by one teacher over the next `days` days (default 14). Use it when the customer chooses the teacher before the class. Required fields: `teacher_id` (`mem_mira`, `mem_nadia`, `mem_karim`, or teacher name). Optional: `timezone`, `days` (1-30). Example: GET /api/teachers/mem_karim/slots?days=14. Returns `{ teacher, timezone, sessions: [{ event_type_id, slug, start_ms, start_iso, seats_left, questions, drop_in_price, pricing_model }] }`. |
| `list_memberships` | `GET /api/memberships` | List optional Northlight Yoga class packs and monthly memberships (never required for single-class guest bookings, which are free). Use it when the customer asks about prices, packs or memberships. Required fields: none. Example: GET /api/memberships. Returns `{ plans: [{ id, name, billing, price_usd, credits_included, perks }], drop_in_price: null, pricing_model }`. |
| `submit_routing_response` | `POST /api/routing/responses` | Send the studio an enquiry (signed-out OK). Use it for a question or request that booking a class does not cover. Required fields: `name`, `email`, `company_size` (integer; 1 for an individual). Optional: `intent`. Example: {"name":"Maya Lin","email":"maya@example.org","company_size":1,"intent":"Private session inquiry"}. Returns `{ id, status, routed_to }`. |
| `get_my_account` | `GET /api/me/account` | Optional signed-in member operation (OAuth scope `bookings:read`; not needed for guest bookings). Use it to read the member's profile, plan and remaining credits. Required fields: none. Example: GET /api/me/account (with Bearer token + Poppy-Session). Returns `{ account, upcoming_bookings_count, bookings }`. |
| `list_my_bookings` | `GET /api/me/bookings` | Optional signed-in member operation (OAuth scope `bookings:read`; not needed for guest bookings). Use it to find the `booking_id` of a class the member wants to check or cancel. Required fields: none. Optional: `status` (`upcoming`/`all`/`past`/`confirmed`/`cancelled`). Example: GET /api/me/bookings?status=upcoming. Returns `{ account_id, email, filter, bookings, waitlist }`. |
| `book_with_membership` | `POST /api/me/bookings` | Optional signed-in member alternative (OAuth scope `bookings:write`, Poppy operations v3) for studio members redeeming an active class pack or monthly membership. Use it when a signed-in member wants to spend a credit; for guests without an account, use `create_booking` instead. Required fields: `event_type_id`, `start_ms`. Optional: `attendee_timezone`, `hold_id`, `notes`, `responses`, `idempotency_key`. Example: {"event_type_id":"evt_beginners","start_ms":"1795858200000"}. Returns `{ booking, manage_url, manage_token, membership_billing }`. |
| `cancel_my_booking` | `POST /api/me/bookings/cancel` | Optional signed-in member cancellation (OAuth scope `bookings:write`, requires Poppy operations v3 `approver="user"`). For guest bookings, use `manage_booking` with `manage_token` instead. Use it when the member asks to give up a class booked under their account. Required fields: `booking_id`. Example: {"booking_id":"book_000001"}. Returns `{ cancelled: true, credit_refunded, booking }`. |
| `subscribe_membership` | `POST /api/me/memberships/subscribe` | Optional signed-in member operation (OAuth scope `memberships:write`, requires Poppy operations v3 `approver="user"`). Use it to start a pack or membership from `list_memberships` for the member; no payment is taken. Required fields: `plan_id` (`plan_5pack`/`plan_monthly`/`plan_founding`). Example: {"plan_id":"plan_monthly"}. Returns `{ subscribed: true, account_id, subscription }`. |
| `manage_membership` | `POST /api/me/memberships/manage` | Optional signed-in member operation (OAuth scope `memberships:write`, requires Poppy operations v3 `approver="user"`). Use it to pause, resume or cancel the membership the member already has. Required fields: `action` (`pause`/`resume`/`cancel`). Example: {"action":"pause"}. Returns `{ updated: true, account_id, subscription }`. |
| `reserve_slot` | `POST /api/holds` | Hold one seat for 5 minutes while confirming with the customer (signed-out OK). Use it when the customer has chosen a time but still has to confirm the details. Required fields: `event_type_id`, `start_ms`, `attendee_email`. Example: {"event_type_id":"evt_beginners","start_ms":"1795858200000","attendee_email":"maya@example.org"}. Returns `{ id, event_type_id, start_ms, expires_at_ms, status: "held" }`; pass `id` as `hold_id` to `create_booking`. |
| `release_hold` | `POST /api/holds/release` | Release an unused 5-minute hold before it lapses so the seat returns immediately. Use it when the customer changes their mind. Required fields: `hold_id`. Example: {"hold_id":"hold_000001"}. Returns `{ id, status: "released" }` (409 if already converted to a booking). |
| `begin_booking` | `POST /api/bookings/attempts` | Start a booking attempt before `create_booking` so lost receipts can be recovered safely with their signed `manage_url`. Use it once per booking, and keep the secret until the receipt arrives. Required fields: `event_type_id`. Example: {"event_type_id":"evt_beginners"}. Returns `{ recovery_secret }`; send it unchanged on every retry with the same `idempotency_key`. |
| `create_booking` | `POST /api/bookings` | Default guest booking (free, no account or OAuth sign-in required; Poppy Personal Agents sending Poppy-Session confirm via operations v3). Use it once the customer has agreed the class, the time and their details. Required fields: `event_type_id` (or slug), `start_ms` (decimal string from `list_slots`), `attendee_name`, `attendee_email`. Optional: `attendee_phone`, `attendee_timezone`, `hold_id`, `notes`, `responses` (answers to per-class `questions`), `idempotency_key` (24-120 chars `[A-Za-z0-9_-]`), `recovery_secret` (from `begin_booking`). Example: {"event_type_id":"evt_beginners","start_ms":"1795858200000","attendee_name":"Maya Lin","attendee_email":"maya@example.org","responses":{"Have you practised before?":"No"}}. Returns `{ booking: { id, status, host_name, start_ms, ... }, manage_url, manage_path, manage_token }` (409 if full or hold expired). |
| `create_booking_series` | `POST /api/bookings/series` | Book 2-12 weekly guest sessions at the same studio local time (signed-out OK; Poppy operations v3). Use it when the customer wants the same class at the same time for several weeks. Required fields: `event_type_id`, `start_ms`, `attendee_name`, `attendee_email`, `count` (2-12). Optional: `attendee_timezone`, `idempotency_key`, `recovery_secret`. Example: {"event_type_id":"evt_vinyasa","start_ms":"1795854600000","attendee_name":"Maya Lin","attendee_email":"maya@example.org","count":4}. Returns `{ series_id, timezone, complete, occurrences: [{ booking, manage_url, manage_token }], failure, resume }`. |
| `manage_booking` | `POST /api/bookings/manage` | View, reschedule, or cancel a guest booking without sign-in using the signed capability from `manage_url` (`#id=<id>&token=<token>`). Use it when a guest wants to check, move or cancel a booking they hold the link for. Required fields: `id`, `token`, `action` (`view`/`cancel`/`reschedule`), plus `request_id` (stable key) for `cancel`/`reschedule`, `start_ms` for `reschedule`, and optional `scope` (`occurrence`/`series`). Example: {"id":"book_000001","token":"<manage_token>","action":"cancel","scope":"occurrence","request_id":"cancel-1"}. Returns `{ booking, slots, series }` on `view`, or `{ scope, bookings, manage_token? }` on `cancel`/`reschedule` (cancelling spends the token; rescheduling rotates and returns a new `manage_token`). A Personal Agent cancels with Poppy operations v3 `approver="user"`. |
| `join_waitlist` | `POST /api/waitlist` | Join a full class's waitlist without sign-in; a cancellation automatically promotes the oldest matching entry. Use it when the session the customer wants has no places left. Required fields: `event_type_id`, `attendee_name`, `attendee_email`. Optional: `start_ms`. Example: {"event_type_id":"evt_beginners","attendee_name":"Maya Lin","attendee_email":"maya@example.org","start_ms":"1795858200000"}. Returns `{ entry: { id, status, position } }`. |
| `get_public_page` | `GET /api/public/{slug}` | Read the public booking page payload for one class slug (including per-class `questions`, `drop_in_price: null`, `pricing_model`, open `slots`, and `timezones`). Use it to get one class and its open times in a single call. Required fields: `slug` (e.g. `beginners-yoga`). Example: GET /api/public/beginners-yoga. Returns `{ owner, event_type, slots, timezones, drop_in_price: null, pricing_model }`. |

The [OpenAPI 3.1 document](/openapi.json) describes every parameter and response. The MCP server at `https://yoga.ferrite.run/mcp` exposes the same operations as tools with the same names.

## Example requests

### `list_event_types`

```sh
curl -s 'https://yoga.ferrite.run/api/event-types'
```

### `list_slots`

```sh
curl -s 'https://yoga.ferrite.run/api/event-types/beginners-yoga/slots'
```

### `list_teachers`

```sh
curl -s 'https://yoga.ferrite.run/api/teachers'
```

### `get_teacher_schedule`

```sh
curl -s 'https://yoga.ferrite.run/api/teachers/mem_karim/slots'
```

### `list_memberships`

```sh
curl -s 'https://yoga.ferrite.run/api/memberships'
```

### `submit_routing_response`

```sh
curl -s -X POST 'https://yoga.ferrite.run/api/routing/responses' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: submit_routing_response-1' \
  -d '{"company_size":1,"email":"maya@example.org","name":"Maya Lin"}'
```

### `get_my_account`

```sh
curl -s 'https://yoga.ferrite.run/api/me/account'
```

### `list_my_bookings`

```sh
curl -s 'https://yoga.ferrite.run/api/me/bookings'
```

## Conventions

- Rate limits: every response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`. A `429` also carries `Retry-After`, in seconds.
- Errors: refusals are RFC 9457 `application/problem+json` with a stable `type`, a `detail` written to be read, and a `hint` when there is a next step.
- Retries: where the OpenAPI document declares an `idempotency-key`, repeating it returns the first result again.
- Versioning: this is version 2.1.0. A change that would break a caller is announced with `Deprecation` and `Sunset` headers at least 90 days ahead.
- Markdown: add `.md` to a page path, or send `Accept: text/markdown`.

## Machine-readable descriptions

- [llms.txt](/llms.txt): orientation for agents
- [OpenAPI](/openapi.json): operations and schemas
- [Agent skills](/.well-known/agent-skills/index.json): installable instructions
- [Agentic Resource Discovery](/.well-known/ard.json): the catalogue of everything here
- [Pricing](/pricing.md)

Questions: see the [contact page](/contact).
