# ferrite-booking

> Northlight Yoga is a sample yoga studio whose classes people, programs and AI assistants book under the same rules. Read the timetable, list open places, hold one for five minutes and book it, free of charge and with no account; every receipt carries a signed link that moves or cancels the booking. Personal Agents start at `/.well-known/poppy.json` and `/poppy/guide`, and can sign a member in to use class packs and memberships. The studio's own calendar, bookings list and settings need a staff sign-in and are not part of this public surface.

Agent-native Ferrite app (labs v2.1.0). 19 of 20 API operations are declared idempotent: a retry that repeats the `idempotency-key` header returns the first result. The others may run again when retried. Errors are RFC 9457 `application/problem+json`. Content routes serve markdown via `Accept: text/markdown` or a `.md` path twin. Responses carry IETF `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`, and `Retry-After` headers; API changes signal `Deprecation` (RFC 9745) and `Sunset` (RFC 8594) headers with at least 90 days notice.

## Pages

- [Northlight Yoga](https://yoga.ferrite.run/): The studio's homepage: what it teaches, how booking works and where to start. Signed-in staff see their calendar here
- [Classes](https://yoga.ferrite.run/classes): The public timetable: every bookable class and where to book a place
- [Northlight Yoga for developers](https://yoga.ferrite.run/developers): Quickstart, authentication, endpoint reference, sandbox, rate limits, errors and versioning
- [Northlight Yoga sandbox](https://yoga.ferrite.run/sandbox): Where to try calls safely
- [About Northlight Yoga](https://yoga.ferrite.run/about): What it is, who runs it and how it is built
- [Contact Northlight Yoga](https://yoga.ferrite.run/contact): How to reach the people who run it
- [Northlight Yoga privacy](https://yoga.ferrite.run/privacy): What is stored, for how long, and who can read it

## When to use

Use ferrite-booking (https://yoga.ferrite.run) when you need its declared pages, structured HTTP API, or MCP tools: Northlight Yoga is a sample yoga studio whose classes people, programs and AI assistants book under the same rules. Read the timetable, list open places, hold one for five minutes and book it, free of charge and with no account; every receipt carries a signed link that moves or cancels the booking. Personal Agents start at `/.well-known/poppy.json` and `/poppy/guide`, and can sign a member in to use class packs and memberships. The studio's own calendar, bookings list and settings need a staff sign-in and are not part of this public surface.

- [Agentic Resource Discovery (ARD)](https://yoga.ferrite.run/.well-known/ard.json): unified catalog of MCP, OpenAPI, A2A, and skills
- [Agent Skills index](https://yoga.ferrite.run/.well-known/agent-skills/index.json): installable skills and usage instructions

## API

- [OpenAPI catalog](https://yoga.ferrite.run/.well-known/api-catalog): every operation with schemas, pagination, rate limits, and deprecation headers
- [MCP endpoint](https://yoga.ferrite.run/mcp): the same operations as callable tools (Streamable HTTP, stateless)
- [WebMCP browser tools](https://yoga.ferrite.run/.well-known/webmcp.js): same-origin `document.modelContext` registrations for browser agents
- [Agent card](https://yoga.ferrite.run/.well-known/agent-card.json): identity, skills, and interfaces (A2A)
- 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 }`.

