<!-- Built by scripts/build-agent-docs.mjs from site/agents-src/booking.md: edit that file. -->
# Page Lemon booking: guide for AI assistants

> For people: https://pagelemon.com/docs/bookings explains this feature in plain words. This page is for AI assistants.

This is the Bookings block: services with times, staff or rooms; visitors book, only the Workspace Owner and the people allowed to read bookings see them, and the emails are Automations. All eight blocks: https://pagelemon.com/agents/blocks.

Online booking on a site published with Page Lemon: appointments with services and opening hours (salons, tutors, coaches, clinics, barbers), or classes with places. Page Lemon keeps the calendar and the rules and never books one time twice; the site shows a picker in its own design. Publishing in general: https://pagelemon.com/agents.

Use this when the person asks for bookings ("Add bookings: haircut 30 minutes, Tuesday to Saturday 9 to 6", "parents book a lesson"), or when a site you build for them needs it.

## Plans and limits

Online bookings a month, services, staff and rooms depend on the plan: https://pagelemon.com/pricing. A refused call says which limit and gives `pricing_url`: pass it on, never retry the same call, and never start or pay for a plan for the person. Say plan names, never ids. Only bookings customers make online count; bookings the person adds with `booking_save` `action=create` (phone, walk-in, a series) never do.
A paid service (a price above 0) saves before the site's payment account is connected (the account is stored when there is one); a live booking of it answers `409` `conflict` with `reason` `payments_not_connected` until the person connects Stripe (a visitor sees "Payments are paused on this site"): https://pagelemon.com/agents/payments. Save the price first and try the booking and its payment on a draft with a pretend member (a pretend payment needs no Stripe account, there is no Stripe test mode); the person connects Stripe when ready. Until then keep the service free online and say "pay at the lesson" on the page. Confirmations and reminders go by email only.

## Ask the person

Ask only what can't be defaulted, in one message, then show the defaults you used in the confirm step:

- **Salon, barber, clinic, tutor, coach:** the services (name, length, price as it should show), the opening hours per day, and, where the plan has them, the staff or rooms and who does what.
- **Classes:** each class, its length, its weekly times and how many places. A full class has a waitlist unless the person says no: when a place opens, everyone waiting is emailed and the first to book gets it (nothing is held).
- **Always ask:** closed days and holidays, and whether bookings are confirmed at once or wait for the person's OK.
- **Offer (defaults in brackets):** how late customers can cancel or move online (24 hours before), reminders before the booking (a day before). A paid time is held 30 minutes while the customer pays; that is fixed.

The time zone is the business's (an IANA name such as `Europe/London`): confirm it.

## What the person needs ready

Their services, hours and (where the plan has them) staff or rooms. A person's email and calendar connection are set in the Dashboard, never through the API or MCP: give them the link and let them do it.
The business's name: booking emails to customers come from "<name> via Page Lemon", where the name is the site's `sender_name`, else the service's name. Ask the person for the business's name and set `sender_name` (at most 40 characters) with `site_update` `action=settings` before the first booking; never pick it yourself. Replies to these emails reach the business only when the person sets a reply address: ask them for it and send `reply_to` with `site_update` `action=settings`, in a call of its own; it waits for their approval, and Page Lemon emails that address a link, used once it is confirmed. Also set `business_phone` (and `business_address`) for customers to get in touch.
The customer's confirmation names the service, the time, who it is with (when the service has more than one person or room) and the business's address and phone when set (`business_address`, `business_phone`), with links to add it to a calendar and a button to change or cancel it; the person's own copy adds who it is with and the answers to the service's questions.

## Set it up

`booking_service_save` `action=service` with a new service's `key` (to change one later, give `key` or its `service` id, a key works in either, and the `etag` its `booking_read` `what=services` read gave; the bare version number works too), or the same under `bookings` in `site_spec_save` (`hosts` and `services`):

```json
{"site": "site_…", "key": "haircut", "name": "Haircut", "duration_seconds": 1800,
 "price": {"amount": 2500, "currency": "GBP"},
 "hours": { "time_zone": "Europe/London", "weekly": {"tue": [["09:00", "18:00"]], "wed": [["09:00", "18:00"]]}, "exceptions": [{"date": "2026-12-25", "closed": true}]},
 "resources": {"chair-1": {"name": "Chair 1", "capacity": 1}}}
```

Making a service answers `confirmation_required` with a summary first (as a change that could affect bookings does): show it and resend with `confirm_token` after the person's yes. Required on create: `name`, `duration_seconds` and `hours`; a service that names no resource gets one, `main`, with 1 place. Other settings: `requires_approval`, `active`, and a `policy` object for the booking rules: `cancel_until_seconds`, `reminder_seconds` (up to two), `lead_time_seconds`, `max_days_ahead`, `slot_interval_seconds`, `buffer_before_seconds`, `buffer_after_seconds`, `request_expiry_seconds`, `waitlist_closed`, `phone`, `approval`, `max_party`, `business_address`, `business_phone` (for example `"policy": {"cancel_until_seconds": 43200, "phone": "required"}`). Hours are 24-hour `HH:MM`; only the last range of a day may run past midnight. A resource has a `name`, a `capacity` (places; a class uses more than 1) and optionally a `host`, its own `hours` (weekly `HH:MM` ranges, `{"tue": [["09:00", "17:00"]]}`; a day left out is a day off; `null` works whenever the service is open) and `time_off` (as a service's). They only narrow the service: customers see and book a staff member or room only while both are open, `any` picks whoever works then, a class runs only in its teacher's hours, and the person may still add a booking outside them. One key on several services is one person, so their hours and days off change on every service together, and those services must share a time zone. The person may move a customer's booking outside them too. Changing hours, length or price never moves or reprices a booking already made.
A class is a service whose resource has `capacity` places and weekly times: `booking_service_save` `action=schedule` with `classes: {timetable: [{day: "tue", start: "18:00", from?, until?}], sessions?: [{date: "2026-12-02", start: "10:00"}], skip?: ["2026-12-23" or "2026-12-23T18:00"]}` (`timetable` the weekly times, `day` `mon` to `sun`, `from` and `until` days `YYYY-MM-DD`; `sessions` one-off times; `skip` a date, or one time of it).

**One person or room on several services** (Mei does a 30-minute haircut and a 90-minute colour): give the resource the same key on each service (`"resources": {"mei": {"name": "Mei"}}` on both). Resources with one key on a site's services are one person or room: they are never in two bookings at once, across every service, and a time Mei is booked on one service is not offered on the other. Different keys are different calendars. `main`, the resource a service gets when it names none, is that service's own and never shared. A host (`bookings.hosts` in `site_spec_save`, then `"host": "mei"` on each resource) does the same across resources with different keys, and is where a staff member's own calendar connects; a resource naming a host the site does not have is refused before the confirm step.

## Confirm with the person

A change that could affect bookings already made answers with a description and a `confirm_token` first. A spec change (`site_spec_save` with the spec's `etag`) answers `202` with `approval.url` and the list of `changes` in the same call (a change's `detail` counts future bookings outside the new hours): show the person the link; there is no token to send back, and nothing changes until they approve.

1. Show the person every line, in their language. Don't shorten it.
2. Ask whether it's right. If they change anything, call again with the change.
3. After their clear yes, call again with the same arguments plus `confirm_token`.

## Put it on the page

Every service `booking_read` `what=services` reads has `picker_html` (a ready booking form and the picker script: paste it into a page) and `booking_url` (the hosted booking page: link it). The picker shows the free days and times, shows a full time that takes a waitlist as "Full, join the waitlist", and books. Choosing who (the "With" list) after a time keeps that time when the person chosen is free then. In a template's own picker, keep its `data-pl-picker` parts, give each service radio the service id as its value and add the script tag `picker_html` ends with. `site_publish` with `patch` to add the page. A pasted `picker_html` is a copy: the picker script it loads is always today's, but a later change to the form's own markup (such as `data-pl-picker-style="default"`, the default look) reaches a published page only when you paste today's `picker_html` and publish that page again.

**The picker's markup**, to style it like the rest of the site: the form is `form[data-pl-picker][data-pl-picker-style=default]`. Its `data-pl-picker-style="default"` gives it a plain default look (choices in wrapping rows, fields stacked, the page's own font and colours); every default rule is inside `:where()`, so any rule of the site's own wins, and without the attribute the markup is bare. Inside:
- `fieldset[data-pl-picker=days]` and `fieldset[data-pl-picker=times]`: a `legend`, then one choice per day or time, each `label > input[type=radio] + span` (inputs named `day` and `start`; the span holds the weekday or the time, and a `small` with the date or "Full, join the waitlist"). `p[data-pl-picker=empty]` shows when a day has no free times.
- `label > input` named `name`, `email` and `phone` (when the service asks), `label > select[name=resource]` (the "With" list, when the service has more than one person or room), `label > select[name=party]` (when more than one may come), and one field per question named `q_<question id>` (a yes/no question is a checkbox).
- `p[data-pl-picker=zone]` (the time zone the times are in), `p[data-pl-picker=status][role=status]` (what happened, after sending) and `button[type=submit]`.
For example `[data-pl-picker=times] label:has(input:checked) { background: var(--accent); color: #fff }`.

Only a page that builds its own picker needs the routes. Free times: `booking_read` `what=times` `{site, service, from?, to?, resource?, full?}` (`from` and `to` are days, `YYYY-MM-DD`, at most 31 days; `service` is the service's id or its key); `full: true` adds the full times a visitor may wait for. Book with `POST /v2/sites/{site}/bookings` (`create_booking` takes no waitlist field; a full time answers `booking_time_taken`). Join a waitlist with `POST /v2/sites/{site}/waitlist-entries` (`service`, `resource`, `start_at`, `email`). A full day shows no free times to customers; the person can still book on it with `booking_save` `action=create`.

## Test

Bookings hold customers' names and emails, which are people's data: before the test booking, an AI connection asks the person for people's data on the site with `list_grant_update` `action=request` (they approve it through the link it answers; without it `booking_save` `action=create` answers `403` `ai_read_needs_approval`, before any confirm step), and an API key needs the People's data tick (`key_people_data_off`).
Reading bookings is reading people's text: for 12 hours after it, publishing, domains, links and products wait for the person's yes in the Dashboard. So do this last, after the page is published and everything else is set up, and tell the person.
After publishing: read the times with `booking_read` `what=times`, make one test booking with `booking_save` `action=create`, read that one booking back with `booking_read` `what=booking` and its `booking` id (a booking you made yourself is your own words, so reading it back does not hold the rest of the build; the list, `what=bookings`, looks at every booking of the site, so any customer's booking among them holds it, and the answer says until when in `marked_until`), then cancel it with `booking_cancel` (it answers `confirmation_required`: resend with `confirm_token` after the person's yes) and the person's yes. Tell the person the result. If it fails, the answer names the problem; fix the service or the page and test again. Only then tell the person booking is live.

## Day to day

- Bookings: `booking_read` `what=bookings` with `site` and a state (requests waiting for the person, upcoming, and so on), or one booking by id.
- `booking_save` `action=update`: move a booking (`start_at`), or set it `confirmed` (a request the person approves: this is their yes, and it emails the customer, so ask first), `declined` (turns a request down), `completed` or `no_show`; `email` changes the customer's address. `booking_cancel` cancels (tier C: a summary first, then `confirm_token`); `series: true` the rest of a series. `booking_class_update` `action=move` moves a class time and `booking_class_cancel` `action=cancel` cancels one (tier C). `booking_service_save` `action=schedule` sets hours, time off, classes, `ical_url` and seats; `booking_read` `what=services` reads the services.
- Phone or walk-in: `booking_save` `action=create` with `service`, `start_at` and `end_at` (the service's length after the start; a time from `what=times` gives both). "Every Tuesday 5pm for 10 weeks": a series with a count; a clash is reported with the clashing times: ask, then skip them or force.
- Classes: each class time has its places taken and left and its waitlist. A person put in from the waitlist is booked in with the waiting entry's id.
- A class time: `booking_class_update` `action=move` moves it, `booking_class_cancel` `action=cancel` cancels it (everyone booked is told and refunded), `booking_class_cancel` `action=close_waitlist` ends its waitlist (everyone waiting is emailed that no place will open; nobody new can join; booked places stay) and `booking_class_update` `action=open_waitlist` re-opens it. `booking_class_update` `action=add_date` adds a one-off class (`date`, `start`, in the service's time zone); `booking_class_update` `action=skip_date` skips a date or one time of it and answers how many people are already booked: they stay booked, so offer to move or cancel them.
- Who is told and when: an automation on the booking events, created with `site_spec_save` (`automations`) and tried with `automation_run` `action=test`; `automation_read` `what=runs` shows what ran.
- Paid services: a deposit or the full price is taken through Page Lemon Checkout (https://pagelemon.com/agents/payments). `booking_service_save` `action=service` takes `price` and either `deposit` (an amount) or `deposit_percent` (1 to 99, worked out from the price and again when the price changes); the rest is paid to the business directly. To cancel a paid booking, `booking_cancel` takes `refund`: `full` (the default), `keep_deposit` (the deposit service's deposit stays with the business) or `none`. Money moves only after the person's yes; a team session records the refund owed for the Workspace Owner.
- Download: `booking_read` `what=bookings` with `format: "csv"` returns the bookings as a CSV file, all or one calendar month (`from` and `to` in the same month, `YYYY-MM-DD`, by the site's time zone). A read-only key gets it without customer names, emails and answers.

## What Page Lemon refuses, and the fix

| Refused | Fix to offer |
|---|---|
| Staff or rooms on a plan without them | One calendar without them, or the plan the reply names (`pricing_url`) |
| Hours that overlap, or end before they start | Fix the ranges (24-hour `HH:MM`; only the last range of a day may run past midnight) |
| A time zone that isn't an IANA name | `Europe/London`, `America/New_York` |
| A capacity below the live bookings of a future time | Cancel or move those bookings first |
| A host change that would double-book (`booking_time_taken`) | Another host, or other times |
| A live booking of a paid service with no payment account (`409` `conflict`, `reason` `payments_not_connected`; a visitor sees `payments_paused`) | The person connects it: https://pagelemon.com/agents/payments. Saving the price and trying it on a draft needs no account |
| Connecting a calendar or a staff link through the API or MCP (`403`) | Give the person the Dashboard link: only they can |

## Links

- For the person: https://pagelemon.com/docs/bookings
- Take payment when someone books: https://pagelemon.com/agents/payments
- API: https://pagelemon.com/docs/api · MCP tools: https://pagelemon.com/docs/mcp
- All AI guides: https://pagelemon.com/agents
