{"openapi":"3.1.0","info":{"title":"WhenMeet.me API","version":"1.0.0","description":"Cross-provider group scheduling: rank meeting times when everyone is free (Google Calendar + Microsoft Outlook live data, hand-marked availability for everyone else — published only for a proven address), create calendar events with Meet links (Google) or Teams links (Teams-enabled Microsoft 365 work/school), and negotiate alternate times. Plus personal and team booking links (whenmeet.me/@nickname — live the moment a calendar is connected; team links check each teammate’s own hours and can have their own whenmeet.me/@team address), reminder emails, HubSpot / Pipedrive / Slack / signed-webhook integrations (Salesforce once its customer install package ships) and one-call imports from Calendly and HubSpot Meetings. An MCP server wrapping this API is served at POST /mcp (Streamable HTTP). Errors are { \"error\": \"<code>\" }.","x-last-updated":"2026-10-09"},"servers":[{"url":"https://whenmeet.me"}],"tags":[{"name":"Account","description":"Your account, calendar connections and who may read your availability."},{"name":"Booking links","description":"Your zero-config personal link (whenmeet.me/@nickname) and its link types."},{"name":"Team links","description":"One link backed by several people: everyone must be free (\"all\") or whoever is free (\"any\"), each inside their own working hours; optionally its own whenmeet.me/@team address."},{"name":"Public booking","description":"What a visitor’s browser (or agent) calls — no account needed."},{"name":"Manage booking","description":"Cancel / reschedule with the invitee token or as the owner."},{"name":"Integrations","description":"HubSpot and Pipedrive (CRM), Salesforce (built; external orgs can connect once the customer install package ships), Slack (notifications) and a signed webhook for everything else."},{"name":"Import","description":"Move over from Calendly or HubSpot Meetings in one call."},{"name":"OAuth","description":"OAuth 2.1 for MCP connectors (Claude.ai, ChatGPT): discovery, registration, authorize, token, revoke, connected apps."}],"components":{"securitySchemes":{"bearerToken":{"type":"http","scheme":"bearer","description":"Personal access token or OAuth access token (format mn_…). Create a PAT with POST /api/tokens while signed in in a browser; connectors get OAuth tokens from /oauth/token (valid only at /mcp). Scopes: read (GET endpoints and the read-only slot / ranking POSTs) and write (everything else); a call outside the scope gets 403 { error: \"insufficient_scope\" }. New PATs expire after 90 days by default; expired → 401 invalid_token. PATs created before scopes existed keep read+write and never expire. A Bearer header that does not resolve (malformed, unknown or revoked) is answered 401 { error: \"invalid_token\" } on every /api/* route and on /mcp — never silently treated as anonymous."},"sessionCookie":{"type":"apiKey","in":"cookie","name":"__Host-session","description":"Browser session minted by the Google/Microsoft OAuth flow. The flow is bound to the browser and session that started it (a __Host-oauth-<provider> cookie carrying the state, and the signed-in uid stored with it); a callback from another browser or session redirects to <return_to>?auth_error=invalid_state and does nothing. Only an address the provider verified signs in (Google: email_verified; Microsoft: a personal account's email, or a work account's UPN unless the optional xms_edov claim vouches for its email); otherwise the callback redirects to <return_to>?auth_error=email_not_verified (connect_email_not_verified while signed in) and nothing is stored. Signed out, landing in an existing account by address also needs the provider to be authoritative for it (Gmail, a Workspace hd, a work account, a Microsoft mail domain) or that account to already have this connection; else <return_to>?auth_error=use_original_sign_in."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string","description":"Stable snake_case code, e.g. slot_unavailable."}},"required":["error"]},"WeeklyHours":{"type":"object","description":"Working hours per weekday in the profile timezone, or in hoursTimezone for a personal link override: up to 6 [\"HH:MM\",\"HH:MM\"] intervals per day (\"24:00\" allowed as an end). Missing days mean no hours; overlapping intervals merge. Profile default Mon–Fri 09:00–17:00.","properties":{"mon":{"type":"array","maxItems":6,"items":{"type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"minItems":2,"maxItems":2}},"tue":{"type":"array","maxItems":6,"items":{"type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"minItems":2,"maxItems":2}},"wed":{"type":"array","maxItems":6,"items":{"type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"minItems":2,"maxItems":2}},"thu":{"type":"array","maxItems":6,"items":{"type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"minItems":2,"maxItems":2}},"fri":{"type":"array","maxItems":6,"items":{"type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"minItems":2,"maxItems":2}},"sat":{"type":"array","maxItems":6,"items":{"type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"minItems":2,"maxItems":2}},"sun":{"type":"array","maxItems":6,"items":{"type":"array","items":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"minItems":2,"maxItems":2}}},"example":{"mon":[["09:00","17:00"]],"tue":[["09:00","12:00"],["13:00","17:00"]],"sat":[],"sun":[]}},"BookingQuestion":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z0-9_]{1,32}$"},"label":{"type":"string","maxLength":200},"type":{"type":"string","enum":["text","textarea"]},"required":{"type":"boolean"}},"required":["id","label","type","required"]},"Profile":{"type":"object","properties":{"handle":{"type":"string"},"displayName":{"type":["string","null"]},"welcome":{"type":["string","null"],"description":"Intro shown on the public page."},"timezone":{"type":"string","description":"IANA zone the weekly hours are expressed in."},"weeklyHours":{"$ref":"#/components/schemas/WeeklyHours"},"createdAt":{"type":"integer","description":"unix ms"},"updatedAt":{"type":"integer","description":"unix ms"}}},"TeamSettings":{"type":"object","description":"Turns a link into a TEAM link. mode \"all\" = every member must be free (e.g. a two-person interview panel); \"any\" = whoever is free, assigned in turn (round-robin). Members get an email invite and join with one calendar connect.","properties":{"mode":{"type":"string","enum":["all","any"]},"members":{"type":"array","items":{"type":"string","format":"email"},"maxItems":10,"description":"Colleagues to invite (you excluded)."},"includeMe":{"type":"boolean","description":"In all mode you attend with the team; in any mode you join the round-robin pool so one available person (you or a teammate) receives the booking. Default true."}},"required":["mode"]},"TeamMember":{"type":"object","properties":{"email":{"type":"string","format":"email"},"name":{"type":["string","null"]},"status":{"type":"string","enum":["pending","active","declined"]},"isOwner":{"type":"boolean"},"visibility":{"type":"string","enum":["self","org","none"],"description":"self = joined, their own calendar is used; org = not joined yet but your calendar account can see their free/busy (same Workspace / Microsoft 365 org); none = not visible until they join (excluded from the check)."},"hours":{"$ref":"#/components/schemas/ParticipantHours"},"canHost":{"type":"boolean","description":"False when this participant (owner included) has a calendar but no connection that can add events, so an `any` link never assigns them."}}},"ParticipantHours":{"type":"object","description":"The working hours a team participant is checked against (owner view only — never public). Every teammate is checked against their OWN hours: own = their booking profile (also your own entry); default = joined but no profile yet: Mon–Fri 09:00–17:00 in their account timezone (UTC if unknown); owner = not joined yet (pending / declined): your hours and zone.","properties":{"weeklyHours":{"$ref":"#/components/schemas/WeeklyHours"},"tz":{"type":"string","description":"IANA zone the hours are in."},"source":{"type":"string","enum":["own","default","owner"]}},"required":["weeklyHours","tz","source"]},"TeamHealth":{"type":"object","description":"Can this team link take bookings right now? The same strict calendar read the public page does (today in the link zone + 14 days), served from its 60 s cache. Inactive links are not read and report ok.","properties":{"ok":{"type":"boolean"},"reason":{"type":["string","null"],"enum":["member_unreadable","no_checkable_member",null],"description":"member_unreadable = an \"all\" participant, or every \"any\" participant, can’t be read (an \"any\" link with only some unreadable stays ok); no_checkable_member = nobody can be checked, or you have no calendar connected."},"memberEmail":{"type":["string","null"],"description":"The first unreadable participant (member_unreadable only)."}},"required":["ok","reason","memberEmail"]},"EventTypeInput":{"type":"object","description":"Link type settings. Only title is needed to create one; everything else has a sensible default.","properties":{"title":{"type":"string","minLength":1,"maxLength":120},"slug":{"type":"string","description":"Default: from the title (-2, -3 … appended if taken)."},"description":{"type":["string","null"],"maxLength":2000},"durationMin":{"type":"integer","minimum":5,"maximum":480,"multipleOf":5,"default":30},"conference":{"type":["string","null"],"enum":["meet","teams",null],"description":"Default: meet for a Google calendar, teams for Microsoft."},"bufferBeforeMin":{"type":"integer","minimum":0,"maximum":240,"default":0},"bufferAfterMin":{"type":"integer","minimum":0,"maximum":240,"default":0},"minNoticeMin":{"type":"integer","minimum":0,"maximum":43200,"default":240},"maxDaysAhead":{"type":"integer","minimum":1,"maximum":60,"default":60},"slotStepMin":{"type":"integer","enum":[5,10,15,20,30,45,60,90,120],"default":30},"dailyLimit":{"type":["integer","null"],"minimum":1,"maximum":50,"default":null},"questions":{"type":"array","maxItems":10,"items":{"$ref":"#/components/schemas/BookingQuestion"},"description":"Name and email are always collected."},"weeklyHours":{"anyOf":[{"$ref":"#/components/schemas/WeeklyHours"},{"type":"null"}],"description":"Personal links only. Set with hoursTimezone to override this link’s weekly hours; null follows the booking profile. Team links reject an override (invalid_weekly_hours)."},"hoursTimezone":{"type":["string","null"],"description":"IANA timezone for weeklyHours. A non-null weeklyHours needs a valid non-null zone; clear both to follow the profile (invalid_hours_timezone on a mismatched pair)."},"reminders":{"type":"array","items":{"type":"integer","enum":[15,30,60,120,240,1440,2880]},"maxItems":3,"default":[1440,60],"description":"Reminder emails to the invitee and guests, in minutes before the start (24 h and 1 h by default). Any 3 of the allowed values; duplicates collapse, stored sorted descending. [] turns reminders off; null resets to the default. Error: invalid_reminders."},"active":{"type":"boolean","default":true},"team":{"anyOf":[{"$ref":"#/components/schemas/TeamSettings"},{"type":"null"}]},"teamHandle":{"type":["string","null"],"description":"Team links only: the link’s own public address, whenmeet.me/@<teamHandle> (same rules as nicknames and the same namespace; a leading @ and upper case are forgiven). null or \"\" releases it; turning the link personal releases it too. Errors: invalid_team_handle (bad handle, or the link is / becomes personal), 409 handle_taken (held by any nickname — yours included — or another link; nothing changes), 400 too_many_team_handles (you already hold 5 team handles on other links; nothing changes)."},"teamName":{"type":["string","null"],"maxLength":80,"description":"Shown with the team handle (\"Acme Sales\"); null → the link title. Stored only next to a team handle (ignored without one). Error: invalid_team_name."}}},"EventType":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"durationMin":{"type":"integer"},"conference":{"type":["string","null"],"enum":["meet","teams",null]},"bufferBeforeMin":{"type":"integer"},"bufferAfterMin":{"type":"integer"},"minNoticeMin":{"type":"integer"},"maxDaysAhead":{"type":"integer"},"slotStepMin":{"type":"integer"},"dailyLimit":{"type":["integer","null"]},"questions":{"type":"array","items":{"$ref":"#/components/schemas/BookingQuestion"}},"weeklyHours":{"anyOf":[{"$ref":"#/components/schemas/WeeklyHours"},{"type":"null"}],"description":"Personal link override; null follows the profile. Team links use each participant’s hours."},"hoursTimezone":{"type":["string","null"],"description":"Timezone for the personal link’s weeklyHours override; null when following the profile."},"reminders":{"type":"array","items":{"type":"integer"},"description":"Minutes before the start, sorted descending; [] = off."},"active":{"type":"boolean"},"position":{"type":"integer"},"url":{"type":"string","format":"uri","description":"Public booking URL, e.g. https://whenmeet.me/@anna/intro"},"team":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["all","any"]},"members":{"type":"array","items":{"$ref":"#/components/schemas/TeamMember"}},"health":{"$ref":"#/components/schemas/TeamHealth"}}},{"type":"null"}]},"teamHandle":{"type":["string","null"],"description":"The team link’s own handle (null for personal links and team links without one)."},"teamName":{"type":["string","null"]},"teamUrl":{"type":["string","null"],"format":"uri","description":"https://whenmeet.me/@<teamHandle>, or null."}}},"BookingProfileResponse":{"type":"object","properties":{"profile":{"anyOf":[{"$ref":"#/components/schemas/Profile"},{"type":"null"}]},"suggestedHandle":{"type":"string"},"eventTypes":{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},"hasCalendar":{"type":"boolean"},"calendarOk":{"type":"boolean","description":"The booking page can read the calendar right now (false: revoked / expired token or missing scope — reconnect)."},"calendarWritable":{"type":"boolean","description":"False when none of your connections can add events (read-only grant): your personal links (and team links needing you as organizer) take no bookings — reconnect and allow event creation."},"publicUrl":{"type":["string","null"],"format":"uri"}}},"PublicEventType":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":["string","null"]},"durationMin":{"type":"integer"},"conference":{"type":["string","null"],"enum":["meet","teams",null]},"questions":{"type":"array","items":{"$ref":"#/components/schemas/BookingQuestion"}},"minNoticeMin":{"type":"integer"},"maxDaysAhead":{"type":"integer"},"team":{"anyOf":[{"type":"object","description":"Who the visitor will meet — names and initials only, never emails (null name = a teammate who has not joined yet).","properties":{"mode":{"type":"string","enum":["all","any"]},"members":{"type":"array","items":{"type":"object","properties":{"name":{"type":["string","null"]},"initials":{"type":"string"}}}}}},{"type":"null"}]}}},"PublicProfile":{"type":"object","properties":{"handle":{"type":"string"},"name":{"type":"string","description":"Display name; for a team handle the team name, else the link title."},"welcome":{"type":["string","null"]},"timezone":{"type":"string"},"acceptingBookings":{"type":"boolean"},"eventTypes":{"type":"array","items":{"$ref":"#/components/schemas/PublicEventType"}},"aliasOf":{"type":"object","description":"Team handles only (absent for people): the owner’s handle + the link slug — the canonical /api/public/{handle}/{slug} route for slots and book.","properties":{"handle":{"type":"string"},"slug":{"type":"string"}},"required":["handle","slug"]}}},"BookableSlot":{"type":"object","properties":{"start":{"type":"integer","description":"unix ms"},"end":{"type":"integer","description":"unix ms"},"othersFree":{"type":"integer","description":"Visitor side (signed-in visitor + guests) free at this time."},"othersTotal":{"type":"integer","description":"Visitor-side people checked (0 for anonymous visitors)."}}},"SlotsResponse":{"type":"object","properties":{"slots":{"type":"array","items":{"$ref":"#/components/schemas/BookableSlot"}},"hostTimezone":{"type":"string"},"window":{"type":"object","properties":{"from":{"type":"integer","description":"unix ms"},"to":{"type":"integer","description":"unix ms"}}},"viewer":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"name":{"type":["string","null"]}}},{"type":"null"}]},"participants":{"type":"array","description":"Visitor side only — never the host or team.","items":{"type":"object","properties":{"email":{"type":"string"},"source":{"type":"string","enum":["self","manual","host"]}}}}}},"HostBooking":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["confirmed","cancelled"]},"startsAt":{"type":"integer","description":"unix ms"},"endsAt":{"type":"integer","description":"unix ms"},"eventTitle":{"type":"string"},"eventTypeId":{"type":["string","null"]},"invitee":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}}},"guests":{"type":"array","items":{"type":"string"}},"answers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"answer":{"type":"string"}}}},"notes":{"type":["string","null"]},"assignedTo":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"name":{"type":["string","null"]}}},{"type":"null"}]},"meetingId":{"type":["string","null"]},"meetingUrl":{"type":["string","null"]},"cancelReason":{"type":["string","null"]},"cancelledBy":{"type":["string","null"],"enum":["invitee","host",null]},"createdAt":{"type":"integer","description":"unix ms"},"isOwner":{"type":"boolean"},"canModify":{"type":"boolean","description":"Owner, organizer or the \"any\" assignee: may cancel / reschedule. An \"all\" teammate only sees it."}}},"ManagedBooking":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["confirmed","cancelled"]},"startsAt":{"type":"integer","description":"unix ms"},"endsAt":{"type":"integer","description":"unix ms"},"eventTitle":{"type":"string"},"eventType":{"anyOf":[{"type":"object","properties":{"slug":{"type":"string"},"durationMin":{"type":"integer"},"maxDaysAhead":{"type":"integer"}}},{"type":"null"}]},"handle":{"type":["string","null"]},"host":{"type":"object","properties":{"name":{"type":"string"}}},"assignedTo":{"anyOf":[{"type":"object","properties":{"name":{"type":["string","null"]},"email":{"type":"string","format":"email"}}},{"type":"null"}]},"attendees":{"type":"array","description":"Complete invitation roster; does not grant access to attendee calendars.","items":{"type":"object","properties":{"email":{"type":"string","format":"email"},"name":{"type":["string","null"]},"role":{"type":"string","enum":["organizer","invitee","guest","member"]}},"required":["email","name","role"]}},"invitee":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}}},"guests":{"type":"array","items":{"type":"string"}},"conferenceUrl":{"type":["string","null"]},"meetingId":{"type":["string","null"]},"meetingUrl":{"type":["string","null"]},"canModify":{"type":"boolean","description":"Cancel / reschedule allowed (confirmed, not started, caller may modify)."}}},"SyncLogRow":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["hubspot","salesforce","pipedrive","slack","webhook"]},"bookingId":{"type":["string","null"]},"event":{"type":"string"},"status":{"type":"string","enum":["ok","error","skipped"]},"detail":{"type":["string","null"],"maxLength":500},"createdAt":{"type":"integer","description":"unix ms"}}},"ImportFinding":{"type":"object","description":"A skipped link or a setting warning. Translate by code (+ params); reason is the same message in English.","properties":{"name":{"type":"string"},"code":{"type":"string","enum":["invalid_settings","slug_taken","one_off","meeting_poll","round_robin","collective","team_event","group_event","secret_event","inactive","group_link","unsupported_link_type","availability_scope_missing","too_many_links","event_hours_unrepresentable","event_hours_no_rule","event_hours_unreadable","calendly_multiple_durations","calendly_duration_rounded","name_shortened","description_shortened","questions_shortened","questions_free_text","multiple_locations","video_provider_not_copied","location_not_copied","no_location","date_exceptions_not_imported","intervals_unrepresentable","calendly_no_duration","calendly_defaults","buffer_unrepresentable","step_unrepresentable","horizon_unrepresentable","hubspot_description_shortened","hubspot_fields_unrepresentable","hubspot_fields_omitted","hubspot_labels_shortened","hubspot_choice_free_text","hubspot_location_not_copied","hubspot_consent_not_copied","hubspot_multiple_durations","hubspot_duration_rounded","hubspot_details_unavailable","hubspot_no_duration","hubspot_custom_availability","hubspot_availability_undocumented","hubspot_date_range_not_imported","hubspot_defaults"],"description":"Stable machine code. Skipped: invalid_settings {error}, slug_taken {slug}, one_off, meeting_poll, round_robin, collective, team_event, group_event, secret_event, inactive, group_link, unsupported_link_type, availability_scope_missing, too_many_links {max}. Warnings: everything else; *_multiple_durations {durations, to}, *_duration_rounded {from, to}, calendly_defaults / hubspot_defaults {settings}."},"params":{"type":"object","additionalProperties":{"type":["string","number"]},"description":"Values for the message. error (invalid_settings) is the untranslated event-type validation code, e.g. invalid_duration_min. settings is a comma-separated list of setting codes: setting_notice, setting_horizon, setting_buffers, setting_buffer, setting_step, setting_daily_limit, setting_reminders."},"reason":{"type":"string","description":"English text (kept for compatibility)."}},"required":["name","code","reason"]},"ImportPreview":{"type":"object","properties":{"profile":{"type":"object","properties":{"handle":{"type":["string","null"],"description":"Suggested nickname (with -1, -2 … if taken)."},"displayName":{"type":["string","null"]},"timezone":{"type":["string","null"]},"weeklyHours":{"anyOf":[{"$ref":"#/components/schemas/WeeklyHours"},{"type":"null"}]}}},"applyProfile":{"type":"boolean","description":"true while your auto-created profile is untouched — apply will then take over nickname, zone and hours."},"eventTypes":{"type":"array","items":{"$ref":"#/components/schemas/EventTypeInput"}},"skipped":{"type":"array","items":{"$ref":"#/components/schemas/ImportFinding"},"description":"Whole links or types not imported, with a reason."},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/ImportFinding"},"description":"Settings changed, approximated or unavailable for review before applying; separate from skipped links."}}},"ImportResult":{"type":"object","properties":{"created":{"type":"array","items":{"$ref":"#/components/schemas/EventType"}},"skipped":{"type":"array","items":{"$ref":"#/components/schemas/ImportFinding"}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/ImportFinding"},"description":"Setting-level differences to review on the imported links."},"profile":{"$ref":"#/components/schemas/Profile"}}},"BookingEventPayload":{"type":"object","description":"Body of every outbound booking webhook (and what the HubSpot / Salesforce / Pipedrive / Slack adapters receive). Never contains the invitee manage token.","properties":{"event":{"type":"string","enum":["booking.created","booking.cancelled","booking.rescheduled","test"]},"occurredAt":{"type":"integer","description":"unix ms"},"booking":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["confirmed","cancelled"]},"startsAt":{"type":"integer","description":"unix ms"},"endsAt":{"type":"integer","description":"unix ms"},"timezone":{"type":"string"},"title":{"type":"string"},"eventType":{"type":"object","properties":{"id":{"type":["string","null"]},"slug":{"type":["string","null"]},"title":{"type":"string"},"durationMin":{"type":"integer"}}},"invitee":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"}}},"guests":{"type":"array","items":{"type":"string"}},"answers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"answer":{"type":"string"}}}},"notes":{"type":["string","null"]},"conferenceUrl":{"type":["string","null"]},"meetingUrl":{"type":["string","null"]},"utm":{"type":"object","additionalProperties":{"type":"string"}},"cancelReason":{"type":["string","null"]},"cancelledBy":{"type":["string","null"],"enum":["invitee","host",null]},"previousStartsAt":{"type":["integer","null"]},"team":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["all","any"]},"members":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":["string","null"]}}}}}},{"type":"null"}]},"assignedTo":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"name":{"type":["string","null"]}}},{"type":"null"}]}}},"host":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]}}}}},"Interval":{"type":"object","properties":{"start":{"type":"integer"},"end":{"type":"integer"}},"required":["start","end"],"description":"Half-open interval in unix milliseconds."},"RankedSlot":{"type":"object","properties":{"start":{"type":"integer"},"end":{"type":"integer"},"freeCount":{"type":"integer"},"score":{"type":"number"},"allFree":{"type":"boolean","description":"true = everyone free; false = compromise slot (only appended when there are too few everyone-free slots)."}}}}},"paths":{"/api/availability":{"post":{"summary":"Rank meeting times for the participants (per-participant timezones)","description":"Reading another user’s connected calendar is logged for that user (GET /api/me/availability-lookups) and limited per viewer (429 lookup_limit); an owner can block a viewer (POST /api/me/availability-blocks). Merges live free/busy per participant: their own connected calendar (source \"self\"), hand-marked slots (source \"manual\": the owner-proven ones, plus those marked through the caller’s own ask-links), or the host’s view (source \"host\"). Calls without a connected host calendar (anonymous, or signed in but not connected) fall back to hand-marked slots only — participants with none are returned as source \"host\" with readable:false (no data — never treat them as free). Never fabricated. Ranking is per-participant timezone-aware (each filtered/scored in their own zone), scores buffer time around existing meetings and prefers sooner slots, and — when there are too few everyone-free slots — appends compromise slots (allFree:false). At most the 16 most-common participant timezones are evaluated per request (rarer zones fall back to the requester tz) to bound worst-case CPU.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"participants":{"type":"array","items":{"type":"string","format":"email"},"minItems":1,"maxItems":50,"description":"Up to 50 distinct emails (trimmed, lower-cased, deduped)."},"from":{"type":"integer","description":"Window start, unix ms."},"to":{"type":"integer","description":"Window end, unix ms: after from; the requested window may reach at most 60 days back or ahead from now."},"durationMin":{"type":"integer","enum":[15,30,45,60],"default":30,"description":"Optional; anything else falls back to 30."},"tz":{"type":"string","description":"Requester IANA zone: fallback for participants whose own zone is unknown, plus the round-hour scoring bonus."},"turnstileToken":{"type":"string","description":"Cloudflare Turnstile token. Only needed after a 403 turnstile_required (browser sessions past 15 new foreign addresses in the rolling hour); a valid token exempts the session for one hour. PATs and MCP never need it."}},"required":["participants","from","to"]}}}},"responses":{"200":{"description":"availability[] (busy intervals per participant), slots[] (ranked; allFree:true everyone-free first, then allFree:false compromise slots; capped to the first 90 days of the window), participantSources[] (per-participant tz only for authenticated callers; calendarStatus \"unavailable\" when a connected calendar could not be read — a token that needs re-auth, a provider error, or an owner who blocked you — and that participant is then treated as busy for the whole window, never as free; readable false on \"host\" rows whose calendar could not be read — every \"host\" row when no calendar token was used — so their empty busy means no data, not free), source: \"real\", cached."},"400":{"description":"bad_request | invalid_participants (none, more than 50, or an invalid email) | bad_window (to ≤ from, starting more than 60 days ago, or ending more than 60 days from now).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"invalid_token (a Bearer token that is malformed, unknown or revoked).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"turnstile_required — browser sessions only (never PATs or MCP): the request adds new foreign addresses past 15 in the rolling hour; resend with turnstileToken. Repeat-only requests are never challenged; nothing is written on refusal.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited — anonymous callers: more than 60 requests per IP in 10 minutes. lookup_limit — you read more than 30 other people’s connected calendars in the last hour or 50 in the last 24 h (only new addresses count; repeats are free; nothing is counted on refusal).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/meetings":{"post":{"summary":"Create a meeting (calendar event + Meet or Teams link per host provider + email invites)","description":"Meet links need a Google host calendar; Teams links need a Teams-enabled Microsoft 365 work/school host (personal Microsoft accounts get none).","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{8,64}$"},"description":"Per-user key reused on retry: a key whose meeting exists returns it with replayed:true (no quota spent); a claim without a meeting row answers 409 in_progress; only a failed provider create (no event) releases the key. Pruned after 24 h."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"participants":{"type":"array","items":{"type":"string","format":"email"},"maxItems":50,"description":"Up to 50 submitted emails; trimmed, lower-cased and deduplicated before any provider, database or mail write."},"startsAt":{"type":"integer","description":"unix ms; at most 60 days from now."},"endsAt":{"type":"integer","description":"unix ms; after startsAt."},"title":{"type":"string","maxLength":200},"conference":{"type":"string","enum":["meet","teams"],"nullable":true},"tz":{"type":"string"}},"required":["participants","startsAt","endsAt"]}}}},"responses":{"200":{"description":"id, shareUrl (/m/<id>), conferenceUrl, eventLink, provider, invites (per-recipient email delivery results). A replayed Idempotency-Key returns the stored meeting with replayed:true (no invites, no eventLink)."},"400":{"description":"invalid_participants (more than 50 submitted entries, or an invalid email) | invalid_title | bad_window (endsAt ≤ startsAt, or startsAt more than 60 days ahead) | no_matching_connection (host lacks the provider needed for the requested conference type).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"in_progress — a previous attempt with this Idempotency-Key may have created the event: check your calendar; start over with a new key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited (20 attempts/user/hour, 100 recipient units/user/day, or 5 to the same recipient/user/day).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"provider_failed (recipient units are returned, the attempt remains counted, and no meeting row is written).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/meetings/{id}":{"get":{"summary":"Read a meeting by share-link id (no auth — the UUID is the capability)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Meeting details, complete attendees[] invitation roster ({email,name,role}), and suggestions[]. bookingManaged:true and booking:{id,status} for a booking-link meeting; its /m page manages changes using an authorized session or the invitee token. The public meeting id alone never grants management rights. cancelledAt (ms) once the organizer cancelled it."},"404":{"description":"Unknown id."}}}},"/api/meetings/{id}/availability":{"post":{"summary":"Aggregated group availability for a meeting (symmetric heat-map)","description":"Returns per-30-min-slot counts of how many participants are free plus ranked slots (per-participant timezones, buffer + soonness scoring; allFree:true everyone-free slots and allFree:false compromise slots). Individual busy blocks are never exposed to link holders. Hand-marked slots count as the meeting host sees them (including what guests marked through the host’s own ask-links). Foreign connected calendars are blockable from the host’s viewpoint before cache/provider access; a calendar owner who blocked the host is treated as unavailable. Guest heat-map refreshes do not write a host lookup log or consume the host’s foreign-calendar lookup budget. A booking-link meeting answers only its organizer (404 for everyone else). The window may reach at most 60 days back or ahead.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"integer"},"to":{"type":"integer"},"durationMin":{"type":"integer","enum":[15,30,45,60]},"tz":{"type":"string"}},"required":["from","to"]}}}},"responses":{"200":{"description":"total, cells[{start, free}], slots[] (aggregate only — no participant list). Slots ranked over the first 90 days of the window."},"400":{"description":"bad_window (empty/backwards, more than 60 days in the past, or more than 60 days ahead).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown id, or a booking-link meeting and the caller is not its organizer."},"409":{"description":"host_has_no_connection."},"429":{"description":"rate_limited (120 calls per meeting/actor per 10 minutes).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/meetings/{id}/suggest":{"post":{"summary":"Propose a different time (share-link capability; optional auth)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"suggestedBy":{"type":"string","format":"email"},"startsAt":{"type":"integer"},"endsAt":{"type":"integer"},"message":{"type":"string","maxLength":2000},"turnstileToken":{"type":"string","description":"Cloudflare Turnstile token. Required for anonymous callers when Turnstile is configured; authenticated callers instead must use one of their account/connected-calendar addresses as suggestedBy."}},"required":["suggestedBy","startsAt","endsAt"]}}}},"responses":{"200":{"description":"ok + suggestion id; the host is emailed."},"400":{"description":"invalid_email | bad_window (endsAt ≤ startsAt) | window_out_of_range | message_too_long.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"turnstile_failed (anonymous caller without a valid Turnstile token) | forbidden (authenticated suggestedBy is not owned by the caller).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"booking_managed — a booking-link meeting; reschedule with the manage link."},"429":{"description":"rate_limited (20 attempts per meeting/actor/hour, 30 successful suggestions per meeting/hour, 5 per meeting/actor/hour, or 10 per actual uid or IP/hour).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/meetings/{id}/suggestions/{sid}":{"post":{"summary":"Host accepts or declines a proposed time","description":"Accept moves the meeting: D1 row, the provider calendar event, and a reschedule email with a SEQUENCE-bumped ICS to all participants.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["accept","decline"]}},"required":["action"]}}}},"responses":{"200":{"description":"status accepted/declined; on accept also startsAt/endsAt/eventUpdated."},"403":{"description":"Caller is not the host."},"409":{"description":"already_resolved, or booking_managed (a booking-link meeting moves via its manage link)."}}}},"/api/meetings/{id}/cancel":{"post":{"summary":"Organizer cancels a Find-a-time meeting","description":"Deletes the event on the organizer's calendar first (a failure changes nothing, 502 provider_failed), sets cancelled_at, and emails every participant an ICS METHOD:CANCEL (same UID, bumped SEQUENCE). Idempotent: a repeat answers alreadyCancelled:true and sends nothing.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"{ ok: true, alreadyCancelled }"},"403":{"description":"Caller is not the organizer."},"409":{"description":"booking_managed (cancel via the booking), or meeting_past."},"502":{"description":"provider_failed."}}}},"/api/meetings/{id}/reschedule":{"post":{"summary":"Organizer moves a Find-a-time meeting","description":"Body { startsAt, endsAt? } (ms; endsAt defaults to the same duration). startsAt must be between now and 60 days ahead. PATCHes the organizer's calendar event first, then the D1 row, then emails participants an updated ICS (same UID, SEQUENCE+1).","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startsAt":{"type":"integer"},"endsAt":{"type":"integer"}},"required":["startsAt"]}}}},"responses":{"200":{"description":"{ ok: true, startsAt, endsAt, sequence } (or unchanged:true for the same time)."},"400":{"description":"bad_window, or window_out_of_range (past / beyond 60 days)."},"403":{"description":"Caller is not the organizer."},"409":{"description":"meeting_cancelled, meeting_past, booking_managed, or conflict (changed concurrently)."},"429":{"description":"rate_limited (10 reschedules per meeting/hour or 30 per organizer/hour)."},"502":{"description":"provider_failed or provider_disconnected."},"503":{"description":"calendar_unavailable (a participant iCloud feed could not be read)."}}}},"/api/manual-availability":{"get":{"summary":"Read hand-marked slots for an email (no auth; confirmed / live data only)","description":"Reads the layer the same caller's save would write to: the signed-in caller's own address → the global (owner-proven) layer only (own address beats k). Otherwise the global layer merged with at most one host's layer: the issuer of a valid k for this email, else the signed-in caller (session / PAT), else none. If both layers have rows in the window, the more recently saved one wins whole. Never another host's layer.","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","format":"email"}},{"name":"from","in":"query","required":true,"schema":{"type":"integer"}},{"name":"to","in":"query","required":true,"schema":{"type":"integer"}},{"name":"k","in":"query","required":false,"schema":{"type":"string"},"description":"The ask-link signature from /free?email=…&k=… (adds that host's layer)."}],"responses":{"200":{"description":"email + freeSlots[] + busySlots[] (live data only — pending saves never show)."},"400":{"description":"invalid_email | bad_window."}}},"post":{"summary":"Replace hand-marked slots inside a window (live for a proven address, otherwise confirmed by email)","description":"The manual fallback for people who do not publish an iCloud calendar, prefer not to connect a calendar, use another unsupported calendar, or have no calendar; the heat-map labels it source \"manual\". Goes LIVE FOR EVERYONE (200) when the caller is signed in and the email is one of their own addresses (account email, a connected Google / Microsoft calendar, a team address they joined under), or when k is the owner proof returned by Confirm. With a host-issued ask-link k (POST /api/ask-links) it goes live ONLY FOR THAT HOST (200 with scope: \"host\" and hostName): their picker and meeting heat-maps see it, nobody else does, until the person shares it with everyone (POST /api/manual-availability/share). Anyone else gets 202 { ok, pending: true, email }: nothing is published, and that address gets a \"Confirm your free times\" email whose link (GET /api/manual-availability/confirm) opens /free with a one-click Confirm (POST /api/manual-availability/confirm) that publishes the save. Pending saves expire after 7 days (≤ 5 per address); a save that is live for everyone drops the address's older pending ones (a host-scoped save keeps them). Confirmation emails per 24 h: 3 per sender per address, 10 per address, 20 per signed-in sender (session / PAT) and 10 per anonymous IP per hour (claimed atomically before anything is stored; a refused mail costs nothing). Anonymous callers need a Turnstile token (also with k), and may not paint an address that has a connected account (409). Rate-limited per email (30 saves/h); a host-scoped save counts against that host's own budget for the address, so nobody's ask-link saves use up the owner's.","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"windowFrom":{"type":"integer"},"windowTo":{"type":"integer"},"freeSlots":{"type":"array","items":{"$ref":"#/components/schemas/Interval"}},"busySlots":{"type":"array","items":{"$ref":"#/components/schemas/Interval"},"description":"Optional extra busy blocks."},"k":{"type":"string","maxLength":87,"description":"Signature from a /free?email=…&k=… link. A host-issued k (POST /api/ask-links), `<issuerId>.<expMs>.<22-char sig>` (legacy `<issuerId>.<sig>` still verifies; an expired one proves nothing → 202 pending), makes the save live for that host only; the owner proof from Confirm (empty issuer, `.<expMs>.<sig>`) makes it live for everyone. An M7 22-char k without an issuer proves nothing (→ 202 pending)."},"turnstileToken":{"type":"string","description":"Required for anonymous callers when Turnstile is configured."}},"required":["email","windowFrom","windowTo","freeSlots"]}}}},"responses":{"200":{"description":"Saved live: { ok, email, saved, free, busy }, plus scope: \"host\" and hostName when it is live only for the host whose ask-link k it carried.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"email":{"type":"string"},"saved":{"type":"integer"},"free":{"type":"integer"},"busy":{"type":"integer"},"scope":{"type":"string","const":"host","description":"Present only for a host-scoped save."},"hostName":{"type":["string","null"],"description":"That host's display name or first name (\"Shared with <hostName>.\"); never an email."}}}}}},"202":{"description":"Pending until the address owner confirms by email: { ok, pending: true, email }.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"pending":{"type":"boolean","const":true},"email":{"type":"string"}}}}}},"400":{"description":"bad_request | invalid_email | bad_window | window_out_of_range | too_many_slots | slots_out_of_window.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"turnstile_failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"account_exists (anonymous caller, the address has a connected calendar — sign in instead).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited (30 saves/h per email — per email and host for a host-scoped save — or a confirmation-email limit; nothing stored).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"email_failed (the confirmation email could not be sent; nothing kept).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/manual-availability/share":{"post":{"summary":"\"Let anyone who schedules with you see this\": promote a host-scoped save, confirmed by email","description":"After a save that went live only for the host whose ask-link k it carried, queue the same payload as a normal pending save (the same limits as POST /api/manual-availability; the issuer is noted, and its confirmation email and Confirm page say that host already sees the times). The confirmation click publishes it for everyone. k must be a valid host-issued signature for this email. Anonymous callers need a Turnstile token and may not use an address that has a connected account.","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"k":{"type":"string","description":"The host-issued ask-link signature `<issuerId>.<expMs>.<sig>` (or legacy `<issuerId>.<sig>`)."},"payload":{"type":"object","properties":{"windowFrom":{"type":"integer"},"windowTo":{"type":"integer"},"freeSlots":{"type":"array","items":{"$ref":"#/components/schemas/Interval"}},"busySlots":{"type":"array","items":{"$ref":"#/components/schemas/Interval"}}},"required":["windowFrom","windowTo","freeSlots"]},"turnstileToken":{"type":"string","description":"Required for anonymous callers when Turnstile is configured."}},"required":["email","k","payload"]}}}},"responses":{"202":{"description":"{ ok: true, pending: true, email } — a confirmation email went to that address.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"pending":{"type":"boolean","const":true},"email":{"type":"string"}}}}}},"400":{"description":"bad_request | invalid_email | invalid_k (missing, M7 issuer-less, owner proof or not valid for this email) | bad_window | window_out_of_range | too_many_slots | slots_out_of_window.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"turnstile_failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"account_exists (anonymous caller, the address has a connected calendar — sign in instead).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited (30 saves/h per email, or a confirmation-email limit; nothing stored).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"email_failed (the confirmation email could not be sent; nothing kept).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/manual-availability/confirm":{"get":{"summary":"The link in the confirmation email: opens the Confirm page (never publishes)","description":"No auth. Writes nothing — mail link scanners (Safe Links, Mimecast, Proofpoint…) fetch links before the person sees them, so publishing takes the POST below (the Confirm button on /free).","parameters":[{"name":"t","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"302":{"description":"/free?email=<email>&confirm=<t> for a live token; /free?confirm_error=1 for a missing, unknown, used or expired one."}}},"post":{"summary":"Confirm a pending hand-marked save (the Confirm button on /free)","description":"No auth — the emailed token is the capability (single use, 7-day expiry, only its sha256 is stored). Publishes the save exactly like a live one (replacing that window; the rows carry the pending save's time, so a host-scoped save made after it still wins for that host) and drops it plus every older pending save for the address.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"t":{"type":"string"}},"required":["t"]}}}},"responses":{"200":{"description":"{ ok: true, email, k? } — the save is now live for everyone; k is the owner proof for the address (`.<sig>`, the click proved the mailbox), so the page's later edits save live for everyone without another email.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"email":{"type":"string"},"k":{"type":"string"}}}}}},"400":{"description":"invalid_token (missing, unknown, used, expired or unreadable).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/manual-availability/pending":{"get":{"summary":"What a pending hand-marked save would publish (the Confirm page shows it before the click)","description":"No auth — the emailed token is the capability. Read-only. scope: \"host\" (with that host's display name, never an email) marks a \"share with everyone\" request whose host already sees the times.","parameters":[{"name":"t","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ email, windowFrom, windowTo, freeSlots, busySlots, scope?, hostName? }","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"windowFrom":{"type":"integer"},"windowTo":{"type":"integer"},"freeSlots":{"type":"array","items":{"$ref":"#/components/schemas/Interval"}},"busySlots":{"type":"array","items":{"$ref":"#/components/schemas/Interval"}},"scope":{"type":"string","enum":["host"]},"hostName":{"type":["string","null"]}}}}}},"400":{"description":"invalid_token (missing, unknown, used, expired or unreadable).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/ask-links":{"post":{"summary":"Sign personal /free links: what people mark there is live for you straight away, without the confirmation email","description":"For each address returns <origin>/free?email=…&k=<callerId>.<expMs>.<22-char signature> (HMAC of the lower-cased email, the caller's id and the expiry with a server key that never reaches the client; valid 62 days, after which a save through it goes the email-confirmation route). Whoever opens it can paint that address live FOR THE CALLER ONLY: the caller vouches for the address, for themselves, by sending the link to that person. Others see it only after the person shares it with everyone and confirms by email. Emails are trimmed, lower-cased and deduped. To have WhenMeet email the people itself (and tell you when they answer), use POST /api/leads instead; its request mails carry the same kind of link.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"string","format":"email"},"maxItems":50}},"required":["emails"]}}}},"responses":{"200":{"description":"{ links: { email, url }[] }","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"url":{"type":"string","format":"uri"}}}}}}}}},"400":{"description":"invalid_emails (not an array, more than 50, or an invalid entry).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"not_configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/tokens":{"post":{"summary":"Create a personal access token (session-only)","description":"Requires a browser session — a token cannot mint more tokens. The plaintext token is returned exactly once.","security":[{"sessionCookie":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80},"scopes":{"type":"array","items":{"type":"string","enum":["read","write"]},"description":"Default [\"read\",\"write\"]; \"write\" implies \"read\"."},"expiresInDays":{"type":["integer","null"],"enum":[30,90,365,null],"description":"Default 90; null = never expires."}}}}}},"responses":{"200":{"description":"{ id, name, token, scopes, expiresAt } — store the token now."},"400":{"description":"invalid_scopes | invalid_expiry | too_many_tokens"}}},"get":{"summary":"List token metadata (never the secrets)","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"tokens[{id, name, createdAt, lastUsedAt, scopes, expiresAt}] (PATs only; OAuth grants are under /api/oauth/apps)."}}}},"/api/tokens/{id}":{"delete":{"summary":"Revoke a token","security":[{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"ok."},"404":{"description":"Unknown id."}}}},"/api/me":{"get":{"tags":["Account"],"summary":"Current user + connected calendars","description":"Session or token. connections[].status is \"needs_reauth\" when a token refresh failed for good (sign in with that provider again) and \"read_only\" when it was granted without permission to add events (free/busy only; reconnect and allow event creation); calendarFeeds lists public iCloud feeds (metadata only, never the URL).","security":[{"bearerToken":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"{ id, email, name, timezone, connections[], calendarFeeds[], plan }","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":["string","null"]},"timezone":{"type":["string","null"]},"connections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Use with /api/connections/{id}."},"provider":{"type":"string","enum":["google","microsoft"]},"email":{"type":"string"},"accountKind":{"type":["string","null"],"enum":["work","personal",null]},"status":{"type":"string","enum":["ok","needs_reauth","read_only"]}}}},"calendarFeeds":{"type":"array","items":{"type":"object"}},"plan":{"type":"object","description":"Plan + limits. Free: up to 2 calendars (Google / Microsoft / iCloud), no external integrations. calendars.limit is null when unlimited (Pro, or billing not configured on this server).","properties":{"plan":{"type":"string","enum":["free","pro"]},"billingConfigured":{"type":"boolean"},"source":{"type":["string","null"],"enum":["stripe_sub","stripe","manual",null],"description":"stripe_sub = subscription, stripe = older lifetime purchase, manual = set by the owner."},"calendars":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":["integer","null"]}}},"externalAllowed":{"type":"boolean","description":"Slack, webhook, Pipedrive, HubSpot, Salesforce may be added."},"canAddCalendar":{"type":"boolean"},"subscription":{"type":"object","properties":{"interval":{"type":"string","enum":["month","year"]},"status":{"type":"string"},"renewsAt":{"type":["integer","null"]},"cancelAt":{"type":["integer","null"]}}},"prices":{"type":"object","properties":{"month":{"type":"integer"},"year":{"type":"integer"},"currency":{"type":"string"}}},"downgradePreview":{"type":"object","description":"Only while a cancellation is scheduled: what stays / is disconnected when Pro ends.","properties":{"keep":{"type":"array","items":{"type":"string"}},"remove":{"type":"array","items":{"type":"string"}}}},"hasCustomer":{"type":"boolean"}}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/connections/{id}":{"get":{"tags":["Account"],"summary":"Preview disconnecting a calendar (what will stop working)","security":[{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"connections[].id from GET /api/me."}],"responses":{"200":{"description":"{ id, provider, email, warnings[] }","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"email":{"type":"string"},"warnings":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","const":"last_connection"}},"required":["code"],"description":"No other Google / Microsoft calendar stays connected: live availability stops."},{"type":"object","properties":{"code":{"type":"string","const":"booking_links"},"count":{"type":"integer"}},"required":["code","count"],"description":"Active booking links (your own or team links you belong to) rely on your calendars."}]}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found (unknown id or not yours).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Account"],"summary":"Disconnect a calendar: deletes its tokens, stops push, revokes the Google grant","description":"Deletes the connection row (tokens included) first; then, best-effort, stops the provider push channel, revokes the Google grant (Microsoft has no revoke endpoint) and drops cached availability. Same-origin browser calls only.","security":[{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok: true, warnings[] } — the warnings that applied at the time.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"warnings":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"code":{"type":"string","const":"last_connection"}},"required":["code"],"description":"No other Google / Microsoft calendar stays connected: live availability stops."},{"type":"object","properties":{"code":{"type":"string","const":"booking_links"},"count":{"type":"integer"}},"required":["code","count"],"description":"Active booking links (your own or team links you belong to) rely on your calendars."}]}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"forbidden (cross-origin request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/timezone":{"put":{"tags":["Account"],"summary":"Set your account time zone","description":"The one editable account zone (Settings → Time zone). Writes users.timezone and the booking profile zone together, so invite emails, booking-link hours and Find-a-time ranking use the same value.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"timezone":{"type":"string","description":"IANA zone, e.g. Europe/Warsaw"}},"required":["timezone"]}}}},"responses":{"200":{"description":"{ timezone }","content":{"application/json":{"schema":{"type":"object","properties":{"timezone":{"type":"string"}}}}}},"400":{"description":"invalid_body | invalid_timezone.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/availability-lookups":{"get":{"tags":["Account"],"summary":"Who read your connected calendar through availability lookups (last 30 days)","description":"One row per viewer: reads of your calendar by another signed-in user through POST /api/availability or the MCP find_common_slots tool. Public booking links are not listed (they show free slots only).","security":[{"bearerToken":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"{ lookups[] }","content":{"application/json":{"schema":{"type":"object","properties":{"lookups":{"type":"array","items":{"type":"object","properties":{"uid":{"type":"string"},"email":{"type":["string","null"]},"name":{"type":["string","null"]},"firstAt":{"type":"integer"},"lastAt":{"type":"integer"},"count":{"type":"integer"},"via":{"type":"array","items":{"type":"string","enum":["session","token","mcp"]}},"blocked":{"type":"boolean"}}}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/availability-blocks":{"get":{"tags":["Account"],"summary":"Accounts you blocked from reading your availability","security":[{"bearerToken":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"{ blocks[] }","content":{"application/json":{"schema":{"type":"object","properties":{"blocks":{"type":"array","items":{"type":"object","properties":{"uid":{"type":"string"},"email":{"type":["string","null"]},"name":{"type":["string","null"]},"createdAt":{"type":"integer"}}}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Account"],"summary":"Block an account from reading your availability (idempotent)","description":"The blocked viewer sees you exactly like an unreadable calendar (calendarStatus \"unavailable\", the whole window busy, no timezone) — the block itself is never revealed.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"uid":{"type":"string"}},"required":["uid"],"description":"uid of a WhenMeet.me account, as listed by GET /api/me/availability-lookups."}}}},"responses":{"200":{"description":"{ ok: true, uid }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"uid":{"type":"string"}}}}}},"400":{"description":"bad_request | cannot_block_self.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found (no such account).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/availability-blocks/{uid}":{"delete":{"tags":["Account"],"summary":"Unblock an account","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok: true }"},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing":{"get":{"tags":["Account"],"summary":"Plan and integration usage","security":[{"bearerToken":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"PlanSummary","content":{"application/json":{"schema":{"type":"object","description":"Plan + limits. Free: up to 2 calendars (Google / Microsoft / iCloud), no external integrations. calendars.limit is null when unlimited (Pro, or billing not configured on this server).","properties":{"plan":{"type":"string","enum":["free","pro"]},"billingConfigured":{"type":"boolean"},"source":{"type":["string","null"],"enum":["stripe_sub","stripe","manual",null],"description":"stripe_sub = subscription, stripe = older lifetime purchase, manual = set by the owner."},"calendars":{"type":"object","properties":{"used":{"type":"integer"},"limit":{"type":["integer","null"]}}},"externalAllowed":{"type":"boolean","description":"Slack, webhook, Pipedrive, HubSpot, Salesforce may be added."},"canAddCalendar":{"type":"boolean"},"subscription":{"type":"object","properties":{"interval":{"type":"string","enum":["month","year"]},"status":{"type":"string"},"renewsAt":{"type":["integer","null"]},"cancelAt":{"type":["integer","null"]}}},"prices":{"type":"object","properties":{"month":{"type":"integer"},"year":{"type":"integer"},"currency":{"type":"string"}}},"downgradePreview":{"type":"object","description":"Only while a cancellation is scheduled: what stays / is disconnected when Pro ends.","properties":{"keep":{"type":"array","items":{"type":"string"}},"remove":{"type":"array","items":{"type":"string"}}}},"hasCustomer":{"type":"boolean"}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing/checkout":{"post":{"tags":["Account"],"summary":"Start Stripe Checkout for a Pro subscription ({ interval: month | year, returnTo? })","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"{ url } — redirect the browser there","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}}}}}},"400":{"description":"invalid_interval","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"already_pro | purchase_pending","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"billing_not_configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing/portal":{"post":{"tags":["Account"],"summary":"Open the Stripe Customer Portal (invoices, billing details)","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"{ url } — redirect the browser there","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}}}}}},"400":{"description":"no_customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"billing_not_configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/billing/webhook":{"post":{"tags":["Account"],"summary":"Stripe webhook receiver (Stripe-Signature verified; not for API clients)","security":[{}],"responses":{"200":{"description":"{ received: true, duplicate? }"},"400":{"description":"invalid_signature / invalid_payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"processing_failed (Stripe retries)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/marketing-consent":{"put":{"tags":["Account"],"summary":"Opt in / out of planning tips by email (off by default; same-origin only)","security":[{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["consent"],"properties":{"consent":{"type":"boolean"}}}}}},"responses":{"200":{"description":"{ ok: true, marketingConsent }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"marketingConsent":{"type":"boolean"}}}}}},"400":{"description":"bad_request (consent is not a boolean)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"forbidden (foreign Origin)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/leads":{"post":{"tags":["Public booking"],"summary":"\"Ask for availability\": WhenMeet emails each participant a link and tells the host when they answered","description":"Signed out: Turnstile required; every address gets the same answer and one confirmation mail (48 h link, double opt-in); nothing goes to the participants until the host confirms (POST /leads/confirm). Signed in: the account address is used, the watch is live at once and the request mails go out in this request (status per participant: sent, already = asked recently for the same window, skipped = unsubscribed, over a limit or the mail failed). The cron mails the best times once everyone has painted their availability (or partial results after 14 days).","security":[{},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["participants","from","to","durationMin"],"properties":{"email":{"type":"string","format":"email","description":"Signed out only."},"participants":{"type":"array","items":{"type":"string","format":"email"},"minItems":1,"maxItems":20},"from":{"type":"integer","description":"unix ms"},"to":{"type":"integer","description":"unix ms, at most 62 days ahead"},"durationMin":{"type":"integer","minimum":15,"maximum":480},"tz":{"type":"string","description":"IANA zone (default UTC)"},"consent":{"type":"boolean","description":"Planning tips by email; recorded only on the confirm click."},"turnstileToken":{"type":"string"},"utm":{"type":"string"}}}}}},"responses":{"202":{"description":"{ ok: true, pending: true } (confirmation mail sent) | { ok: true, pending: false, requests } (signed in)","content":{"application/json":{"schema":{"type":"object","required":["ok","pending"],"properties":{"ok":{"type":"boolean","const":true},"pending":{"type":"boolean"},"requests":{"type":"array","description":"Signed in only: one entry per participant.","items":{"type":"object","required":["email","status"],"properties":{"email":{"type":"string","format":"email"},"status":{"type":"string","enum":["sent","already","skipped"]}}}}}}}}},"400":{"description":"bad_request | invalid_participants | bad_window | bad_duration | invalid_email","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"turnstile_failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"too_many_watches (10 confirmed per address) | rate_limited (+ retryAfter seconds)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"email_failed (nothing kept)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/leads/resend-from-token":{"post":{"tags":["Public booking"],"summary":"Mail a fresh confirmation link from an expired one","security":[{}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["t"],"properties":{"t":{"type":"string"}}}}}},"responses":{"202":{"description":"{ ok: true }"},"400":{"description":"invalid_token (not an expired token of an unconfirmed watch)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited (+ retryAfter seconds)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"email_failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/leads/confirm":{"get":{"tags":["Public booking"],"summary":"Confirmation page with one \"Send my request\" POST button (never changes state)","description":"The form submits itself only in the browser whose localStorage wm_host_email equals the host address (the one that typed it into the ask sheet). An already used link → 200 \"This link was already used\" page linking to /app.","security":[{}],"parameters":[{"name":"t","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"HTML page (localized, no-store, noindex).","content":{"text/html":{"schema":{"type":"string"}}}},"400":{"description":"HTML page (localized, no-store, noindex).","content":{"text/html":{"schema":{"type":"string"}}}}}},"post":{"tags":["Public booking"],"summary":"Confirm the address (double opt-in); the watch goes live and the request mails go out","security":[{}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"t":{"type":"string"}},"required":["t"]}}}},"responses":{"200":{"description":"Already used link: \"This link was already used\" page (HTML).","content":{"text/html":{"schema":{"type":"string"}}}},"303":{"description":"Redirect (no-store) to /app?with=<a,b>&d=<min>[&h=<hint>]&asked=<n>, n = requests sent or already sent (0..20).","headers":{"Location":{"schema":{"type":"string"}}}},"400":{"description":"HTML page (localized, no-store, noindex).","content":{"text/html":{"schema":{"type":"string"}}}},"429":{"description":"Too many active watches for the address (HTML).","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/u/{token}":{"get":{"tags":["Public booking"],"summary":"Unsubscribe page with one POST button (never changes state)","security":[{}],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"HTML page (localized, no-store, noindex).","content":{"text/html":{"schema":{"type":"string"}}}},"404":{"description":"HTML page (localized, no-store, noindex).","content":{"text/html":{"schema":{"type":"string"}}}}}},"post":{"tags":["Public booking"],"summary":"Unsubscribe (RFC 8058 one-click body List-Unsubscribe=One-Click); action=resubscribe undoes it","description":"Suppresses all non-essential mail to the address, clears marketing consent and ends its open watches.","security":[{}],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"HTML page (localized, no-store, noindex).","content":{"text/html":{"schema":{"type":"string"}}}},"404":{"description":"HTML page (localized, no-store, noindex).","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/api/booking-profile":{"get":{"tags":["Booking links"],"summary":"Your booking profile, link types and public URL","description":"profile is null until the first /links visit (or POST /api/booking-profile/ensure).","security":[{"bearerToken":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"Profile + link types.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProfileResponse"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"tags":["Booking links"],"summary":"Update nickname, display name, welcome text, timezone or weekly hours (partial)","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"handle":{"type":"string","description":"New nickname (3–40, [a-z0-9-]); lower-cased."},"displayName":{"type":["string","null"]},"welcome":{"type":["string","null"]},"timezone":{"type":"string"},"weeklyHours":{"$ref":"#/components/schemas/WeeklyHours"}}}}}},"responses":{"200":{"description":"{ profile }","content":{"application/json":{"schema":{"type":"object","properties":{"profile":{"$ref":"#/components/schemas/Profile"}}}}}},"400":{"description":"invalid_body | invalid_handle | invalid_display_name | invalid_welcome | invalid_timezone | invalid_weekly_hours | no_profile (call ensure first).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"handle_taken (another nickname, or a team link’s handle — they share one namespace).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/booking-profile/ensure":{"post":{"tags":["Booking links"],"summary":"Zero-config provisioning (idempotent): profile + default 30-minute link","description":"Creates the profile (nickname from your name or email, timezone from tz → account → UTC, Mon–Fri 09–17) and the default \"30 min meeting\" link when missing. The link is live as soon as this returns. Same response as GET.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"tz":{"type":"string"}}}}}},"responses":{"200":{"description":"Profile + link types.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProfileResponse"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/handles/{handle}":{"get":{"tags":["Booking links"],"summary":"Is this nickname (or team handle) valid and free? (drives the inline editors)","description":"No auth. Nicknames and team handles share one namespace, so both count and suggestions skip either. Without link: your own nickname counts as available, a team handle never does. With ?link=<your team link id>: that link’s own handle is available and every nickname (yours included) is not.","parameters":[{"name":"handle","in":"path","required":true,"schema":{"type":"string"}},{"name":"link","in":"query","required":false,"schema":{"type":"string"},"description":"Event type id of one of YOUR team links: answer for its team handle instead of your nickname. Send it empty (?link=) for a team link not created yet: every nickname, yours included, is then taken."}],"responses":{"200":{"description":"Availability + a free suggestion.","content":{"application/json":{"schema":{"type":"object","properties":{"available":{"type":"boolean"},"valid":{"type":"boolean"},"suggestion":{"type":"string"}}}}}}}}},"/api/event-types":{"post":{"tags":["Booking links"],"summary":"Create a link type (personal, or a team link with `team`)","description":"With team set, invitees get an email with a Join button (/join/<token>); before they join, their free/busy is read only through YOUR calendar account when your org lets you see it. Every teammate is checked against their own working hours. Personal links may set weeklyHours and hoursTimezone together for link-specific availability; team links reject this override. teamHandle gives a team link its own address (whenmeet.me/@acme-sales); it is claimed before any invite goes out, and a taken handle undoes the create (409). Reminder emails go out 24 h and 1 h before by default (reminders).","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventTypeInput"}}}},"responses":{"200":{"description":"{ eventType }","content":{"application/json":{"schema":{"type":"object","properties":{"eventType":{"$ref":"#/components/schemas/EventType"}}}}}},"400":{"description":"no_profile | invalid_body | invalid_<field> (e.g. invalid_title, invalid_duration_min, invalid_questions, invalid_reminders, invalid_weekly_hours, invalid_hours_timezone, invalid_team, invalid_team_member, invalid_team_handle, invalid_team_name) | too_many_team_members | too_many_team_handles (at most 5 team handles per owner).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"slug_taken (only for an explicit slug; derived slugs get -2, -3 …) | handle_taken (the team handle).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/event-types/member-check":{"post":{"tags":["Team links"],"summary":"Which of these addresses recently booked one of your links (editor warning before adding teammates)","description":"Up to 50 emails; invalid ones are ignored, the rest are lower-cased. previousBookers lists those that booked (as the invitee) on any of your links — likely people you meet, not teammates. Recent bookings only: booking rows are removed about 30 days after the meeting.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"{ previousBookers }","content":{"application/json":{"schema":{"type":"object","properties":{"previousBookers":{"type":"array","items":{"type":"string"}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/event-types/{id}":{"patch":{"tags":["Booking links"],"summary":"Update any subset of a link type","description":"A team change diffs members (new ones invited, removed ones dropped); a partial team ({ mode: \"any\" }) keeps the rest. team: null turns it back into a personal link and releases its team handle. Personal links may set or clear a weeklyHours + hoursTimezone pair; setting an override on a team link is rejected. A new or moved teamHandle is claimed first: 409 handle_taken changes nothing, and a later slug_taken puts the old handle back. teamHandle: null releases it; teamName alone renames it.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventTypeInput"}}}},"responses":{"200":{"description":"{ eventType }","content":{"application/json":{"schema":{"type":"object","properties":{"eventType":{"$ref":"#/components/schemas/EventType"}}}}}},"400":{"description":"invalid_body | no_profile | invalid_<field> (incl. invalid_reminders, invalid_weekly_hours, invalid_hours_timezone, invalid_team_handle, invalid_team_name) | too_many_team_members | too_many_team_handles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found (not yours).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"slug_taken | handle_taken.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Booking links"],"summary":"Delete a link type (bookings keep their snapshot; its team handle is freed)","description":"Without force=1, a link with upcoming confirmed bookings is refused (409 has_future_bookings with count) so the owner can confirm. After a delete its bookings stay on the calendars and can still be cancelled; reschedule answers 409 link_unavailable.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"force","in":"query","required":false,"schema":{"type":"string","enum":["1"]},"description":"Delete even with upcoming bookings."}],"responses":{"200":{"description":"{ ok: true }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"{ error: \"has_future_bookings\", count } — upcoming confirmed bookings on this link; repeat with ?force=1.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","const":"has_future_bookings"},"count":{"type":"integer"}}}}}}}}},"/api/event-types/{id}/members/{email}/resend":{"post":{"tags":["Team links"],"summary":"Re-send a team invite (fresh token)","description":"Invite emails are capped at 50 per owner per 24 h across all links (resends included); past it, new members are still added but not emailed.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"email","in":"path","required":true,"schema":{"type":"string"},"description":"Member email (URL-encoded)."}],"responses":{"200":{"description":"{ ok: true }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited (5 per member per hour, or the daily invite-email cap).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/bookings":{"get":{"tags":["Booking links"],"summary":"Bookings you own or attend as a team member (max 100)","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"scope","in":"query","schema":{"type":"string","enum":["upcoming","past"],"default":"upcoming"}}],"responses":{"200":{"description":"{ bookings }","content":{"application/json":{"schema":{"type":"object","properties":{"bookings":{"type":"array","items":{"$ref":"#/components/schemas/HostBooking"}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/meetings":{"get":{"tags":["Meetings"],"summary":"Your meetings: group meetings you organize or are invited to + bookings you host or are assigned","description":"Group meetings match your sign-in email or a connected calendar address. Upcoming = not yet ended, sorted by start ascending; past sorted descending. A participant sees only the host in people (as on /m/<id>). Keyset pagination via nextCursor.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"scope","in":"query","schema":{"type":"string","enum":["upcoming","past"],"default":"upcoming"}},{"name":"kind","in":"query","schema":{"type":"string","enum":["group","booking"]},"description":"Only group meetings or only bookings (omit for both). 400 invalid_kind otherwise."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","schema":{"type":"string"},"description":"nextCursor of the previous page."}],"responses":{"200":{"description":"{ items, nextCursor }","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["group","booking"]},"id":{"type":"string"},"title":{"type":"string"},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["confirmed","cancelled","pending"]},"role":{"type":"string","enum":["organizer","participant","host","assignee"]},"conference":{"type":["object","null"],"properties":{"provider":{"type":["string","null"],"enum":["google_meet","teams",null]},"url":{"type":["string","null"]}}},"people":{"type":"array","maxItems":10,"items":{"type":"object","properties":{"name":{"type":["string","null"]},"email":{"type":"string"}}}},"href":{"type":"string","description":"/m/<meetingId>, or /links for a booking without a meeting page."}}}},"nextCursor":{"type":["string","null"]}}}}}},"400":{"description":"invalid_scope | invalid_limit | invalid_cursor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/team-invites/{token}":{"get":{"tags":["Team links"],"summary":"Read a team invite (no auth — the token is the capability)","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Invite details.","content":{"application/json":{"schema":{"type":"object","properties":{"ownerName":{"type":"string"},"linkTitle":{"type":"string"},"mode":{"type":"string","enum":["all","any"]},"email":{"type":"string"},"status":{"type":"string","enum":["pending","active","declined"]},"signedIn":{"type":"boolean"},"signedInEmail":{"type":["string","null"]}},"description":"Each teammate is checked against their own working hours (set at /links), so the owner’s hours are not part of the invite."}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/team-invites/{token}/accept":{"post":{"tags":["Team links"],"summary":"Join a team link (any connected calendar account)","description":"tz (optional) is the joiner's browser zone: when their account has no zone yet (the sign-in placeholder UTC), it is recorded, so without a booking profile they are checked against Mon–Fri 9–17 in their own zone. link.url is the team URL (/@<team handle>) when the link has one.","security":[{"sessionCookie":[]}],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"tz":{"type":"string","description":"IANA zone, e.g. America/New_York."}}}}}},"responses":{"200":{"description":"{ ok, link: { title, url } }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"link":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"}}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"own_link (the owner cannot join their own link as a member).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/team-invites/{token}/decline":{"post":{"tags":["Team links"],"summary":"Decline a team invite (no auth; the owner gets a short note)","description":"reason \"wanted_to_book\" (someone who meant to book a time with the owner, not host): the owner is asked to send them the booking link, and the response adds bookUrl (the link's public URL, null without a booking profile) for the page to redirect to.","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","enum":["wanted_to_book"]}}}}}},"responses":{"200":{"description":"{ ok } or, with reason, { ok, bookUrl }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"bookUrl":{"type":["string","null"]}}}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/team-memberships":{"get":{"tags":["Team links"],"summary":"Team links you host as an active member, and pending invites to host one (other people's links)","description":"invites: pending team-link invites addressed to one of your verified addresses (account email or a connected calendar account), one per link; accept or decline them with the routes below. upcomingBookings counts upcoming confirmed bookings that involve you: on an \"any\" link those assigned to you, on an \"all\" link those that hold your time (made while you were an active member). Ordered by title.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"{ memberships, invites }","content":{"application/json":{"schema":{"type":"object","properties":{"invites":{"type":"array","items":{"type":"object","properties":{"eventTypeId":{"type":"string"},"title":{"type":"string"},"ownerName":{"type":["string","null"]},"mode":{"type":"string","enum":["all","any"]},"url":{"type":["string","null"]},"email":{"type":"string","description":"The invited address (one of yours)."}}}},"memberships":{"type":"array","items":{"type":"object","properties":{"eventTypeId":{"type":"string"},"title":{"type":"string"},"ownerName":{"type":["string","null"]},"mode":{"type":"string","enum":["all","any"]},"url":{"type":["string","null"]},"upcomingBookings":{"type":"integer"}}}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/team-memberships/{eventTypeId}/leave":{"post":{"tags":["Team links"],"summary":"Leave a team link (same as declining the invite; the owner gets a short note)","description":"Existing bookings stay as they are. To rejoin, the owner re-sends the invite.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"eventTypeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok: true }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found (not an active member).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/team-memberships/{eventTypeId}/accept":{"post":{"tags":["Team links"],"summary":"Accept a pending team-link invite in-app (same effect as the emailed /join link)","description":"Only for a still-pending invite addressed to one of your verified addresses, and not when you are already an active member of the link. Optional body { tz } (IANA zone, fills a placeholder account zone).","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"eventTypeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok: true }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found (no pending invite to one of your addresses, or already active on the link).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/me/team-memberships/{eventTypeId}/decline":{"post":{"tags":["Team links"],"summary":"Decline a pending team-link invite in-app (the owner gets a short note)","description":"Optional body { reason: \"wanted_to_book\" } → the owner is told you meant to book, and the response carries bookUrl. Declines the pending invites to all your addresses on that link (404 as accept). The emailed link can still join afterwards.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"eventTypeId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok, bookUrl? }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"bookUrl":{"type":["string","null"]}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found (no pending invite to one of your addresses).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/public/{handle}":{"get":{"tags":["Public booking"],"summary":"A person’s public booking page (name, welcome, active link types) — or a team handle’s single link","description":"For a team handle (whenmeet.me/@acme-sales) the same shape holds exactly that team link, welcome is null, name is the team name (else the link title) and aliasOf names the owner handle + slug to call for slots and book. An inactive or released team handle is 404.","parameters":[{"name":"handle","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])$"},"description":"Booking nickname or team handle: lower-case, 3–40 chars of [a-z0-9-] (the part after whenmeet.me/@). Nicknames and team handles share one namespace."}],"responses":{"200":{"description":"Public profile.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicProfile"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/public/{handle}/{slug}":{"get":{"tags":["Public booking"],"summary":"One link type (personal or team)","description":"handle is the owner’s nickname; a team handle also works with that link’s own slug (the canonical form is aliasOf from GET /api/public/{handle}).","parameters":[{"name":"handle","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])$"},"description":"Booking nickname or team handle: lower-case, 3–40 chars of [a-z0-9-] (the part after whenmeet.me/@). Nicknames and team handles share one namespace."},{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{0,58}[a-z0-9])?$"},"description":"Link type slug, 1–60 chars of [a-z0-9-]."}],"responses":{"200":{"description":"Link details.","content":{"application/json":{"schema":{"type":"object","properties":{"host":{"type":"object","properties":{"name":{"type":"string"},"handle":{"type":"string"},"timezone":{"type":"string"},"welcome":{"type":["string","null"],"description":"The profile’s welcome note."}}},"eventType":{"$ref":"#/components/schemas/PublicEventType"},"acceptingBookings":{"type":"boolean"}}}}}},"404":{"description":"not_found (unknown or inactive).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/public/{handle}/{slug}/slots":{"post":{"tags":["Public booking"],"summary":"Bookable times — slots and counts only, never busy blocks or emails","description":"Host side: the owner’s calendars (all of them, read strictly) + existing bookings; the owner’s own owner-proven painted layer applies (rows saved since 2026-10-12; older migrated rows are ignored) (painted free overrides calendar busy, painted busy adds on top; host-scoped ask-link layers are ignored); team links compose members per mode, each teammate inside their OWN working hours (slots sit on a step grid from midnight in the link zone). Signed-in visitors (session or PAT) also get othersFree/othersTotal from THEIR own calendar and their guests — \"times that suit both sides\". Anonymous visitors: guests are ignored.","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"parameters":[{"name":"handle","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])$"},"description":"Booking nickname or team handle: lower-case, 3–40 chars of [a-z0-9-] (the part after whenmeet.me/@). Nicknames and team handles share one namespace."},{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{0,58}[a-z0-9])?$"},"description":"Link type slug, 1–60 chars of [a-z0-9-]."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"integer","description":"unix ms"},"to":{"type":"integer","description":"unix ms; to − from ≤ 62 days."},"tz":{"type":"string"},"guests":{"type":"array","items":{"type":"string","format":"email"},"maxItems":10}},"required":["from","to"]}}}},"responses":{"200":{"description":"Slots.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlotsResponse"}}}},"400":{"description":"bad_window | invalid_guests | too_many_guests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"host_unavailable (no calendar connected, or no checkable team member).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/public/{handle}/{slug}/book":{"post":{"tags":["Public booking"],"summary":"Book a slot: calendar event + Meet link (Google host) or Teams link (Teams-enabled Microsoft 365 work/school host) + invites","description":"Every caller has a 20-attempt/hour budget (anonymous per IP, authenticated per uid); anonymous callers also pass Turnstile. A session/PAT must use an email owned by that uid. Recipient budgets cap one actor at 3 deliveries to the same external invitee/guest address and 50 total recipient units per 24 hours; owner and internal team addresses do not count. The slot is re-validated with fresh data and guarded in one D1 transaction against double booking. Known read-only organizer connections are excluded from bookable slots. The event goes to the owner’s calendar (or, for an \"any\" team link, the assignee’s). The invitee and guests get reminder emails at the link’s reminders offsets (24 h and 1 h by default); the invitee’s carries the manage link.","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"parameters":[{"name":"handle","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])$"},"description":"Booking nickname or team handle: lower-case, 3–40 chars of [a-z0-9-] (the part after whenmeet.me/@). Nicknames and team handles share one namespace."},{"name":"slug","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{0,58}[a-z0-9])?$"},"description":"Link type slug, 1–60 chars of [a-z0-9-]."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"startsAt":{"type":"integer","description":"A slot start from …/slots."},"name":{"type":"string","minLength":1,"maxLength":120},"email":{"type":"string","format":"email","maxLength":254},"guests":{"oneOf":[{"type":"array","items":{"type":"string","format":"email"},"maxItems":10},{"type":"string","description":"Comma/space separated list."}],"description":"Extra attendees, e.g. a colleague from another company (≤ 10)."},"answers":{"type":"object","additionalProperties":{"type":"string","maxLength":2000},"description":"Keyed by question id."},"notes":{"type":"string","maxLength":2000},"tz":{"type":"string","description":"Invitee IANA zone (email formatting)."},"utm":{"type":"object","additionalProperties":{"type":"string","maxLength":200},"description":"Up to 10 utm_* keys (^utm_[a-z_]{1,20}$); malformed ones are dropped."},"turnstileToken":{"type":"string","description":"Required for anonymous callers when Turnstile is configured."}},"required":["startsAt","name","email"]}}}},"responses":{"200":{"description":"Booked.","content":{"application/json":{"schema":{"type":"object","properties":{"bookingId":{"type":"string"},"meetingId":{"type":"string"},"startsAt":{"type":"integer","description":"unix ms"},"endsAt":{"type":"integer","description":"unix ms"},"title":{"type":"string"},"conferenceUrl":{"type":["string","null"]},"conference":{"type":["string","null"],"enum":["meet","teams",null],"description":"The video the booking actually got."},"meetingUrl":{"type":"string","description":"Shareable meeting page (/m/<id>)."},"manageUrl":{"type":"string","description":"Private invitee cancel / reschedule link (/m/<meetingId>?t=<token>; legacy bookings without a meeting use /booking/<id>). Keep it private."},"assignedTo":{"anyOf":[{"type":"object","properties":{"name":{"type":["string","null"]}}},{"type":"null"}]}}}}}},"400":{"description":"invalid_body | invalid_starts_at | invalid_name | invalid_email | invalid_guests | too_many_guests | missing_answer | invalid_answers | invalid_notes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"turnstile_failed | invitee_identity_mismatch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"slot_unavailable | host_unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"provider_failed (nothing was booked).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/bookings/{id}":{"get":{"tags":["Manage booking"],"summary":"Read a booking for its cancel / reschedule page","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"t","in":"query","schema":{"type":"string"},"description":"Invitee manage token from the confirmation email."}],"responses":{"200":{"description":"Booking.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedBooking"}}}},"401":{"description":"unauthorized (neither a token nor a session; answered before any lookup).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found (also for any auth mismatch).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/bookings/{id}/slots":{"post":{"tags":["Manage booking"],"summary":"Slots for rescheduling (the booking’s own time does not block itself)","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"integer","description":"unix ms"},"to":{"type":"integer","description":"unix ms; to − from ≤ 62 days."},"tz":{"type":"string"},"t":{"type":"string"}},"required":["from","to"]}}}},"responses":{"200":{"description":"Slots.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlotsResponse"}}}},"400":{"description":"bad_window.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"link_unavailable | host_unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited (invitee token: 60 calendar reads per booking per 10 min).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/bookings/{id}/cancel":{"post":{"tags":["Manage booking"],"summary":"Cancel: removes the calendar event, emails everyone a CANCEL ICS","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"t":{"type":"string"},"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"{ ok: true }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"400":{"description":"invalid_reason.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"already_cancelled | too_late (already started).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"provider_failed (nothing changed).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/bookings/{id}/reschedule":{"post":{"tags":["Manage booking"],"summary":"Move a booking to another slot (event moved, updated invites)","security":[{"bearerToken":[]},{"sessionCookie":[]},{}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"t":{"type":"string"},"startsAt":{"type":"integer","description":"unix ms"},"tz":{"type":"string","description":"The invitee’s IANA zone (invitee token only): their mails show times in it."}},"required":["startsAt"]}}}},"responses":{"200":{"description":"{ ok, startsAt, endsAt }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"startsAt":{"type":"integer","description":"unix ms"},"endsAt":{"type":"integer","description":"unix ms"}}}}}},"400":{"description":"invalid_starts_at.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"already_cancelled | too_late | slot_unavailable | link_unavailable | host_unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited (invitee tokens and staff have separate 10-attempt/booking/hour and 30-attempt/actor/hour budgets; anonymous actor is IP).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"provider_failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/integrations":{"get":{"tags":["Integrations"],"summary":"Integration status + the last 30 sync log rows (never secrets)","security":[{"bearerToken":[]},{"sessionCookie":[]}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"hubspot":{"allOf":[{"type":"object","properties":{"configured":{"type":"boolean","description":"The server has the OAuth app credentials."},"connected":{"type":"boolean"},"accountLabel":{"type":["string","null"]},"connectedAt":{"type":["integer","null"]}}},{"type":"object","properties":{"canImport":{"type":"boolean","description":"The HubSpot Meetings import scope was granted."},"needsReconnect":{"type":"boolean","description":"The newest sync failed asking to reconnect (revoked or regenerated token) since the connection was saved."}}}]},"salesforce":{"allOf":[{"type":"object","properties":{"configured":{"type":"boolean","description":"The server has the OAuth app credentials."},"connected":{"type":"boolean"},"accountLabel":{"type":["string","null"]},"connectedAt":{"type":["integer","null"]}}},{"type":"object","properties":{"needsReconnect":{"type":"boolean","description":"The newest sync failed asking to reconnect (revoked or regenerated token) since the connection was saved."},"installUrl":{"type":["string","null"],"format":"uri","description":"The package install link for our External Client App (https only), shown to send to a Salesforce admin after salesforce_blocked; null when the server has none."}}}]},"pipedrive":{"type":"object","description":"A pasted personal API token — no app, so no configured flag.","properties":{"connected":{"type":"boolean"},"accountLabel":{"type":["string","null"],"description":"<company_domain>.pipedrive.com"},"connectedAt":{"type":["integer","null"]},"needsReconnect":{"type":"boolean","description":"The newest sync failed asking to reconnect (revoked or regenerated token) since the connection was saved."}}},"slack":{"type":"object","properties":{"configured":{"type":"boolean","description":"The server has the OAuth app credentials."},"connected":{"type":"boolean"},"accountLabel":{"type":["string","null"]},"connectedAt":{"type":["integer","null"]}}},"webhook":{"type":"object","properties":{"connected":{"type":"boolean"},"url":{"type":["string","null"]},"connectedAt":{"type":["integer","null"]}}},"log":{"type":"array","items":{"$ref":"#/components/schemas/SyncLogRow"}}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/integrations/{provider}/connect":{"get":{"tags":["Integrations"],"summary":"Start OAuth (\"Connect HubSpot\" / \"Connect Salesforce\" / \"Add to Slack\") — browser navigation","description":"Salesforce uses the web-server flow with PKCE (S256; the verifier stays server-side) and the scopes \"api refresh_token\"; ?sandbox=1 signs in at test.salesforce.com.","security":[{"sessionCookie":[]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","enum":["hubspot","salesforce","slack"]}},{"name":"sandbox","in":"query","required":false,"schema":{"type":"string","enum":["1","true"]},"description":"Salesforce only: connect a sandbox org (test.salesforce.com)."}],"responses":{"302":{"description":"To the provider’s consent page (or back to /links?integration_error=signin_required)."},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"hubspot_not_configured | salesforce_not_configured | slack_not_configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/integrations/{provider}/callback":{"get":{"tags":["Integrations"],"summary":"OAuth return (state is single-use)","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","enum":["hubspot","salesforce","slack"]}},{"name":"code","in":"query","schema":{"type":"string"}},{"name":"state","in":"query","schema":{"type":"string"}}],"responses":{"302":{"description":"/links?connected=<provider>, or /links?integration_error=access_denied | missing_params | invalid_state | signin_required | account_mismatch | <provider>_not_configured | <provider>_failed | <provider>_blocked. access_denied is only the provider's own access_denied (the user pressed Deny). <provider>_blocked: the provider refused (Salesforce: the org has not approved the app — /links then shows how to get the admin's one-time approval, with salesforce.installUrl when set). Salesforce configuration or transient errors (invalid_client_id, redirect_uri_mismatch, server_error, …) are salesforce_failed."}}}},"/api/integrations/{provider}":{"delete":{"tags":["Integrations"],"summary":"Disconnect an integration","description":"Removes the connection and its booking refs; HubSpot and Salesforce also revoke their refresh token.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","enum":["hubspot","salesforce","pipedrive","slack","webhook"]}}],"responses":{"200":{"description":"{ ok: true }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"not_found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/integrations/slack":{"put":{"tags":["Integrations"],"summary":"Slack without the app: paste an incoming-webhook URL","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","pattern":"^https://hooks\\.slack\\.com/services/[A-Za-z0-9/_-]+$"}},"required":["url"]}}}},"responses":{"200":{"description":"{ ok, slack: { connected, accountLabel, connectedAt } }"},"400":{"description":"invalid_url.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"plan_limit (kind external): external integrations need Pro — docs/BILLING.md.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/integrations/pipedrive":{"put":{"tags":["Integrations"],"summary":"Pipedrive: paste your personal API token (Settings → Personal preferences → API)","description":"No app to install. The token is checked against Pipedrive’s users/me (sent in the x-api-token header, never in a URL) and stored encrypted. Each booking then finds or creates the person and logs a meeting activity, updated on cancel / reschedule. Connecting another company clears the old booking refs.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"apiToken":{"type":"string","minLength":16,"maxLength":200}},"required":["apiToken"]}}}},"responses":{"200":{"description":"{ ok, pipedrive: { connected, accountLabel, connectedAt } }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"pipedrive":{"type":"object","properties":{"connected":{"type":"boolean"},"accountLabel":{"type":"string"},"connectedAt":{"type":"integer","description":"unix ms"}}}}}}}},"400":{"description":"invalid_token (malformed, or Pipedrive refused it).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"plan_limit (kind external): external integrations need Pro — docs/BILLING.md.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"pipedrive_unreachable (network error, 429 or 5xx — try again) | not_configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/integrations/webhook":{"put":{"tags":["Integrations"],"summary":"Create / update the signed booking webhook (Zapier, Make, n8n, your backend)","description":"HTTPS only (no private / link-local IPs or metadata hosts). The signing secret is returned only on create or with rotate: true — store it then. Deliveries: see the bookingEvent webhook in this spec.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"rotate":{"type":"boolean"}},"required":["url"]}}}},"responses":{"200":{"description":"{ url, secret? }","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"secret":{"type":"string","description":"Shown once."}}}}}},"400":{"description":"invalid_url.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"plan_limit (kind external): external integrations need Pro — docs/BILLING.md.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/integrations/{provider}/test":{"post":{"tags":["Integrations"],"summary":"Send a sample booking through Slack or the webhook","security":[{"bearerToken":[]},{"sessionCookie":[]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","enum":["slack","webhook"]}}],"responses":{"200":{"description":"{ ok: true }","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}}}}}},"400":{"description":"not_connected | test_not_supported (hubspot, salesforce, pipedrive — a sample would create real CRM records).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"rate_limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"test_failed (+ detail).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/import/calendly":{"post":{"tags":["Import"],"summary":"Import from Calendly with one pasted personal access token","description":"The token is used for this request only — never stored or logged. Preview reads the user schedule and bounded event-specific availability; personal links can keep their own weekly hours even when the profile was edited. apply: true creates selected new links and updates an untouched profile. Existing slugs are skipped without overwriting them. skipped lists whole links; warnings separately lists unavailable or converted settings before and after apply, including Calendly notice and horizon defaults.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"Calendly personal access token (\"Bearer \" prefix tolerated)."},"apply":{"type":"boolean"},"slugs":{"type":"array","items":{"type":"string"},"description":"Subset to import (default: all importable)."}},"required":["token"]}}}},"responses":{"200":{"description":"Preview (ImportPreview) or, with apply, ImportResult.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ImportPreview"},{"$ref":"#/components/schemas/ImportResult"}]}}}},"400":{"description":"invalid_token | calendly_unauthorized | calendly_scope_missing (the PAT needs users:read, event_types:read, availability:read).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"calendly_rate_limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"import_failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"calendly_failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/import/hubspot":{"post":{"tags":["Import"],"summary":"Import your HubSpot Meetings links (through the connected HubSpot account)","description":"Reads your personal links and bounded /book details. Supported duration, buffer, start step, horizon, description and text fields are copied when available. Custom availability and unsupported settings appear in warnings before and after apply. apply: true creates selected new links; existing slugs are skipped without overwriting them. Team links appear in skipped.","security":[{"bearerToken":[]},{"sessionCookie":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"apply":{"type":"boolean"},"slugs":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Preview (ImportPreview) or, with apply, ImportResult.","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ImportPreview"},{"$ref":"#/components/schemas/ImportResult"}]}}}},"400":{"description":"hubspot_not_connected | hubspot_unauthorized.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"unauthenticated (no session or token), or invalid_token (a Bearer token that is malformed, unknown or revoked — never a silent anonymous fallback).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"scope_missing (reconnect HubSpot to grant Meetings access).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"hubspot_rate_limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"import_failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"hubspot_failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/.well-known/oauth-protected-resource":{"get":{"tags":["OAuth"],"summary":"Protected-resource metadata (RFC 9728); also at /.well-known/oauth-protected-resource/mcp","security":[],"responses":{"200":{"description":"{ resource: \"<origin>/mcp\", authorization_servers, scopes_supported: [\"read\",\"write\"], bearer_methods_supported }","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/oauth-authorization-server":{"get":{"tags":["OAuth"],"summary":"Authorization-server metadata (RFC 8414)","security":[],"responses":{"200":{"description":"issuer, endpoints, code_challenge_methods_supported [\"S256\"], grant_types_supported, token_endpoint_auth_methods_supported [\"none\"].","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/mcp.json":{"get":{"tags":["OAuth"],"summary":"MCP server card: transport, protocol versions, auth and tools","security":[],"responses":{"200":{"description":"Server card.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/oauth/register":{"post":{"tags":["OAuth"],"summary":"Dynamic Client Registration (RFC 7591), public clients only","description":"Body { client_name?, redirect_uris[1–10], grant_types?, response_types?, token_endpoint_auth_method?: \"none\" }. redirect_uris must be https, or http on 127.0.0.1 / localhost. client_name is capped at 100 characters. 20 registrations per hour per IP.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"201":{"description":"{ client_id, client_id_issued_at, client_name, redirect_uris, grant_types, response_types, token_endpoint_auth_method: \"none\" }","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"invalid_redirect_uri | invalid_client_metadata","content":{"application/json":{"schema":{"type":"object"}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/oauth/authorize":{"get":{"tags":["OAuth"],"summary":"Authorization endpoint: sign in + consent page (HTML)","description":"Query: response_type=code, client_id, redirect_uri, code_challenge, code_challenge_method=S256 (required), state, scope (\"read\", \"write\" or both; default both), resource (must be <origin>/mcp). Allow → 302 redirect_uri?code=…&state=…&iss=…; Deny → error=access_denied.","security":[],"responses":{"200":{"description":"Consent or sign-in page."},"302":{"description":"Error redirect to the client."},"400":{"description":"Unknown client or redirect_uri mismatch (no redirect)."}}}},"/oauth/token":{"post":{"tags":["OAuth"],"summary":"Token endpoint: authorization_code (PKCE) and refresh_token (rotating)","description":"Access tokens are mn_… Bearer tokens valid for 1 hour, only at /mcp. Refresh tokens (mnr_…) last 60 days from their last use and are rotated on every refresh; presenting a rotated-out refresh token revokes the whole grant.","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object"}},"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"{ access_token, token_type: \"Bearer\", expires_in: 3600, refresh_token, scope }","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"invalid_grant | invalid_request | invalid_scope | invalid_target | unsupported_grant_type","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"invalid_client","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/oauth/revoke":{"post":{"tags":["OAuth"],"summary":"Token revocation (RFC 7009)","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object"}},"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"{} (also for unknown tokens).","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"invalid_request: token is missing","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/oauth/apps":{"get":{"tags":["OAuth"],"summary":"Connected apps: OAuth clients you authorized (session-only)","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"apps[{ clientId, name, redirectHost, scopes, connectedAt, lastUsedAt }]","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/oauth/apps/{clientId}":{"delete":{"tags":["OAuth"],"summary":"Disconnect an app (revokes its tokens for you)","security":[{"sessionCookie":[]}],"parameters":[{"name":"clientId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok: true }","content":{"application/json":{"schema":{"type":"object"}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/mcp":{"post":{"summary":"MCP server (Model Context Protocol, Streamable HTTP)","description":"JSON-RPC 2.0: initialize (protocol versions 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05; the client's version is echoed when supported, else the latest), tools/list (annotations, outputSchema), tools/call (structuredContent). Tools: find_common_slots, create_meeting, get_meeting, get_meeting_availability, suggest_time, respond_to_suggestion, set_manual_availability, get_manual_availability, list_my_meetings, list_my_event_types, get_booking_slots, book_slot, list_my_bookings, cancel_booking, reschedule_booking. Every request (initialize and tools/list included) needs a Bearer mn_… token; without one the answer is HTTP 401 with WWW-Authenticate: Bearer resource_metadata=\"<origin>/.well-known/oauth-protected-resource/mcp\". Tools that change data need the write scope (insufficient_scope tool error otherwise). Connectors (Claude.ai, ChatGPT) sign in with OAuth 2.1 (see /.well-known/oauth-protected-resource/mcp); header clients (Claude Code, Cursor) send a PAT.","security":[{"bearerToken":[]}],"responses":{"200":{"description":"JSON-RPC response."},"401":{"description":"No credentials: JSON-RPC error -32001 with WWW-Authenticate: Bearer resource_metadata=\"<origin>/.well-known/oauth-protected-resource/mcp\" (starts the OAuth flow). A Bearer token that is malformed, unknown, revoked or expired: JSON-RPC error { code: -32001, message: \"invalid_token\" } with WWW-Authenticate: Bearer error=\"invalid_token\", resource_metadata=\"<origin>/.well-known/oauth-protected-resource/mcp\".","headers":{"WWW-Authenticate":{"schema":{"type":"string"}}}}}}}},"webhooks":{"bookingEvent":{"post":{"tags":["Integrations"],"summary":"Outbound booking event (booking.created / .cancelled / .rescheduled, or test from POST /api/integrations/webhook/test)","description":"POSTed to the URL set with PUT /api/integrations/webhook. Verify x-whenmeet-signature: t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>. 10 s timeout; a non-2xx answer is logged in the sync log, not retried.","parameters":[{"name":"x-whenmeet-event","in":"header","required":true,"schema":{"type":"string","enum":["booking.created","booking.cancelled","booking.rescheduled","test"]}},{"name":"x-whenmeet-signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"x-whenmeet-delivery","in":"header","required":true,"schema":{"type":"string","format":"uuid"},"description":"Unique id of this delivery — use it to de-duplicate."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingEventPayload"}}}},"responses":{"200":{"description":"Any 2xx acknowledges the delivery."}}}}}}