# Saybooked API

Calendar connection, free time and bookings for AI agents and apps.

Base address: https://saybooked.com
Auth: `Authorization: Bearer sk_...` on every request. JSON bodies and answers.
MCP connector (Streamable HTTP): https://saybooked.com/mcp with the same Authorization header.

## Flow
1. POST /v1/connect-links -> send the returned url to the calendar owner; they connect Google Calendar in one step.
2. GET /v1/calendars/{id}/availability?from=tomorrow&duration_minutes=30 -> free slots, with a summary in words.
3. POST /v1/bookings {calendar_id, day, time, weekday, title, attendee:{name,email}} -> booked after a second check, read back from the calendar, answered with a confirmation code and a `say` sentence.
4. GET /v1/calls/{call_id} -> what one phone call really did (send X-Call-Id or call_id with each request).

Every account has a sandbox calendar (GET /v1/calendars) that works without Google.

## Endpoints
- POST /v1/trial: No key needed. Returns a trial key and a test calendar, so an AI assistant can build and test before a person signs up. The key lasts 7 days and cannot connect a real calendar.
- GET /v1/calendars: List connected calendars. Every account also has one sandbox calendar for testing.
- POST /v1/connect-links: Make a link that a calendar owner opens once to connect their Google Calendar. Body: external_id = your own id for this client (optional); redirect_url = where to send the owner afterwards (optional)
- GET /v1/connect-links/{id}: See whether a link was used, and the calendar id it produced.
- GET /v1/calendars/{id}: One calendar with its booking rules.
- PATCH /v1/calendars/{id}: Change booking rules: time zone, opening hours, slot length, buffer, notice. Body: rules = object with any of: timezone, hours, slot_minutes, step_minutes, buffer_minutes, min_notice_minutes, max_days_ahead, services (a list of {name, duration_minutes})
- DELETE /v1/calendars/{id}: Disconnect a calendar. The Google permission is withdrawn and stored tokens are erased.
- GET /v1/calendars/{id}/availability: Free slots. Query: from, to, duration_minutes, limit. A day can be a date or plain words: today, tomorrow, friday, 27 october. Each slot comes with its day and time in words, and the answer says today's date in the owner's time zone.
- POST /v1/availability: The same free slots, for tools that send a JSON body. Body: calendar_id = required; from = a date, a time, or words such as today, friday or 27 october; to = optional; service = optional: one of the calendar's services; its length is used; duration_minutes = optional; call_id = optional, the voice platform's id for this call
- POST /v1/bookings: Book a slot. Send the caller's own words in day and time, or an ISO time in start. The time is always read in the calendar owner's time zone. The slot is checked again just before writing, the new event is read back from the calendar, and the answer carries a six-digit confirmation code and a sentence to say. Words that can be read two ways are refused with a question for the caller. Body: calendar_id = required; day = friday, tomorrow, 27 october or 2027-01-15 (with time); time = 3pm, 3:30 pm or 15:00 (with day); start = ISO 8601, instead of day and time; weekday = optional: the day name the caller said; a booking is refused when it does not match the date; service = optional: one of the calendar's services; sets the length and the name, and a word that fits none is refused with the list; duration_minutes = optional, or send end; title = optional; attendee = {name, email, phone}, optional; no email is needed, and an email gets a calendar invitation; caller_phone = optional: the caller's number, kept as their phone when none is given; notes = optional; idempotency_key = optional, makes a retry safe; call_id = optional, the voice platform's id for this call
- GET /v1/bookings: List bookings. Query: calendar_id, from, to, status, limit, code, phone. from and to take a date or words, so from=tomorrow&to=tomorrow lists the bookings to remind.
- POST /v1/bookings/find: Find a caller's coming bookings by confirmation code or phone number. Without either, the caller's own number is used when the platform sends it. Body: code = six-digit confirmation code; phone = the caller's phone number; calendar_id = optional
- GET /v1/bookings/{id}: One booking by id or confirmation code, checked against the owner's calendar first.
- POST /v1/bookings/{id}/reschedule: Move a booking to a new time, if that time is free. The id can be the confirmation code. Body: day = with time; time = with day; start = ISO 8601, instead of day and time; weekday = optional check
- POST /v1/bookings/{id}/cancel: Cancel a booking and remove it from the owner's calendar. The id can be the confirmation code.
- GET /v1/calls/{id}: What one phone call really did: whether a booking was made, whether it was read back from the calendar, and every failed attempt. Use it after a call to check what the agent told the caller.
- GET /v1/activity: The latest requests with their result. Query: call_id, calendar_id, limit.
- GET /v1/usage: Plan, connected calendars and the month's price.
- GET /v1/account: Your account. PATCH with {name} sets the name shown to calendar owners.

## Times
Always the calendar owner's time zone. For a booking send `day` and `time` in the caller's words (`friday`, `tomorrow`, `27 october`, `2027-01-15`; `3pm`, `3:30 pm`, `15:00`), or an ISO 8601 `start` (no offset = the calendar's zone).
`weekday` is an optional check: the booking is refused when it does not match the date.
Words are never guessed: `next friday`, a bare hour that fits morning and afternoon, or `10/27` return a 422 whose `say` is a question for the caller.
For availability, a plain date or a day in words means the whole day.

## For voice agents
- Every answer and every error has `say`: a sentence to speak.
- Say an appointment is booked only after the booking answer returned `confirmation_code`; read the code to the caller.
- `verified: true` means the event was read back from the owner's calendar.
- No email is needed: a name is enough, and the caller's phone number finds the booking again (POST /v1/bookings/find).
- `text_message` in the booking answer is a ready text for the caller's phone.
- `service` picks one of the calendar's services (rules.services); it sets the length. A word that fits none is refused with the list.

## Rules (PATCH /v1/calendars/{id} with {"rules": {...}})
```json
{
  "timezone": "UTC",
  "hours": {
    "mon": [
      [
        "09:00",
        "17:00"
      ]
    ],
    "tue": [
      [
        "09:00",
        "17:00"
      ]
    ],
    "wed": [
      [
        "09:00",
        "17:00"
      ]
    ],
    "thu": [
      [
        "09:00",
        "17:00"
      ]
    ],
    "fri": [
      [
        "09:00",
        "17:00"
      ]
    ],
    "sat": [],
    "sun": []
  },
  "slot_minutes": 30,
  "step_minutes": 30,
  "buffer_minutes": 0,
  "min_notice_minutes": 60,
  "max_days_ahead": 60,
  "services": []
}
```

## Errors
Shape: {"error": {"code", "message"}}.
- 401 missing_api_key, invalid_api_key: Send a valid key in the Authorization header.
- 402 free_limit_reached: The free plan is full. Ask for the paid plan in the dashboard.
- 404 calendar_not_found, booking_not_found: The id or confirmation code does not belong to your account.
- 409 slot_taken: The time is no longer free. The answer lists the next free times in `alternatives`.
- 409 outside_hours, too_soon, too_far: The time breaks one of the calendar's rules.
- 409 calendar_disconnected: The owner withdrew access. Send them a new connect link.
- 422 date_ambiguous, time_ambiguous: The words fit two readings, such as “next friday” or a bare “4” on a day open all hours. `say` holds the question to ask the caller.
- 422 date_mismatch: The date and the weekday the caller said do not agree. Nothing was booked.
- 422 service_not_found, service_ambiguous: The word does not match one service on the calendar. `say` reads out the list.
- 422 date_not_understood, time_not_understood: The day or time could not be read for certain. Nothing was guessed.
- 422 date_in_past: The time has passed. The message says today's date in the calendar's time zone.
- 422 invalid_time, invalid_rules, ...: A field is missing or malformed. The message says which.
- 429 rate_limited: Too many requests in a minute. Wait and retry.
- 502 calendar_unreachable: Google did not answer. For a new booking we look for the event before answering: nothing was written. Retry.
- 502 booking_outcome_unknown: Google did not answer and the check failed too, so the event may or may not be on the calendar. Send the request again with the same `Idempotency-Key`: the event keeps one id, so a repeat cannot make a second one.
- 502 booking_not_on_calendar: The event could not be found on the calendar after writing. No booking was recorded. Retry.

## Pricing
- Free: 1 real connected calendar, the test calendar and trial keys
- Starter: up to 5 connected calendars, $19 a month
- Agency: up to 20 connected calendars, $49 a month
- Scale: up to 100 connected calendars, $149 a month
- Above 100 calendars: $1.00 a month for each extra calendar

A flat price by the number of connected calendars. Bookings and requests are not counted.
Payments are not switched on yet; every account is on the free plan and more calendars are set up on request.
Sign up: https://saybooked.com/dashboard

