---
name: book-appointment
description: Book a customer appointment at one BeatyBook studio using the authenticated REST or MCP booking API, with customer SMS verification and payment-state checks.
---

# Book a customer appointment at a BeatyBook studio

Read [agent instructions](https://beatybook.ru/developers/agent-guide.md) and the
[live OpenAPI](https://beatybook.ru/api/agent/v1/openapi.json) for complete schemas.
This is customer booking, not authority to edit the owner's catalogue or calendar.
Use current API responses for services, prices, availability and booking status.
Documentation examples and earlier conversation results are not live studio data.
Preserve the project's timezone and service restrictions; refresh availability
before a new booking attempt rather than treating a snapshot as synchronization.

## Prerequisites and safe connection test

1. Connect through owner-approved Authorization Code + PKCE S256 with rotating
   refresh tokens, or a server-side project key using `client_credentials`.
   Use CIMD only if the target deployment advertises
   `client_id_metadata_document_supported: true`; the server supports CIMD, and
   dynamic public client registration remains available. A CIMD URL or public
   registration grants no project permissions by itself; the actual owner/admin
   selects one project and scopes in BeatyBook.
   See [authentication](https://beatybook.ru/auth.md) for the full flow.
2. Keep secrets and tokens in protected client storage, not ordinary chat.
   Access tokens last one hour. Delegated refresh tokens are single-use and
   replaced on each update; serialize refreshes, save replacements atomically,
   and never blindly replay an old token after an uncertain refresh response.
   Reuse revokes the whole connection. The grant ends 30 days after consent.
   Native ChatGPT/Dots account linking has not been verified end to end.
3. Call MCP `get_connection` or REST `GET /api/agent/v1/connection` and verify
   the studio and effective scopes. This requires a valid token, not write access,
   and sends no SMS. New keys are read-only; booking needs explicit `bookings:write`.
   Anonymous MCP `initialize` only advertises public protocol/server metadata;
   `tools/list` and `tools/call` require authentication. A successful handshake
   does not establish project access.

## Workflow

1. `search_services`: find the intended service and its real `id`. Prices are
   rubles, durations are hours.
2. `get_availability`: select a suitable slot. Pass `service_type_id` to preserve
   service restrictions. For rentals also pass the project-local `date` and select
   an interval; ISO timestamps must keep their UTC offset.
3. Confirm the customer's service, time and prepayment conditions. Then call
   `create_booking` with `service_type_id`, `customer_phone` (`+7XXXXXXXXXX`),
   optional name/notes, and `slot_id`. Rentals use `start` and `end` instead.
4. The `pending_verification` result contains `verification_id` and code expiry.
   SMS has been sent; **the slot is not reserved and the booking is not confirmed**.
5. Ask the customer for the SMS code, then call `confirm_booking` with
   `verification_id` and `code`. Never invent or guess a code.
6. Inspect the actual result: `confirmed` is confirmed; `awaiting_payment` means
   prepayment remains due. Respect its deadline. Do not claim payment succeeded.
   This API does not return a payment URL; direct the customer to the studio's
   normal booking/account page and recheck the known booking as appropriate.
7. `get_booking` reads status. On a time conflict, refresh availability and let
   the customer choose another time. Do not silently book a different slot.

## Rescheduling and cancellation

- Reschedule is REST only:
  `POST /api/agent/v1/bookings/{booking_id}/reschedule` with `{"new_slot_id":456}`.
- Cancellation: MCP `cancel_booking` or REST
  `POST /api/agent/v1/bookings/{booking_id}/cancel` (204 without body on success).
- Default `accept_no_refund=false`. If rules would keep the prepayment, the
  booking is NOT cancelled: REST returns `409 refund_not_available` and
  `error.client_text`, or MCP returns a tool error. Show the condition to the customer.
- Only after explicit agreement retry with MCP `accept_no_refund: true` or REST
  `?accept_no_refund=true`. Never set it automatically or promise an unverified refund.

## Retry and access rules

- REST creation supports `Idempotency-Key`: use one unique key for an unchanged
  intent; do not reuse it with different data. Deduplication is temporary.
- MCP creation has no idempotency argument. Do not blindly replay writes after a
  timeout or send repeated SMS; reconcile the known result first.
- HTTP 200 from MCP is not enough: inspect `result.isError`.
- Respect 401/403, rate limits and `writes_disabled`; do not work around them.
- Keys and delegated grants are project-bound and revocable. Do not enumerate booking IDs or access
  another studio. Do not log credentials, SMS codes or customer phone numbers.

## Endpoints

- REST: `https://beatybook.ru/api/agent/v1`
- MCP: `POST https://beatybook.ru/mcp` (protocol `2025-06-18`)
- [Server card](https://beatybook.ru/.well-known/mcp/server-card.json)
- [Human documentation](https://beatybook.ru/developers/)
