All connectors

Cal.com

OfficialCalendar

Cal.com

Connect your Cal.com account so your agents can see upcoming and past bookings, find open times on your booking pages, check your calendars for busy times and read your event types, availability schedules and workflows. They can also look at the bookings, event types and schedules of teams you belong to.

With write access, agents can also book meetings, reschedule or cancel them, confirm or decline booking requests, add guests, record no-shows and set out-of-office time. They can create and edit event types, booking questions, private links, availability schedules, webhooks and workflows. Bookings and their changes email the people involved and update connected calendars. Webhooks are visible only with write access, because they include signing secrets.

The connection uses a Cal.com API key from your own account, so it can reach everything your account can.

Connect your Cal.com account.

Setup instructions

Connect Cal.com

  1. Open Cal.com API keys, create a key and copy it. Some accounts place API keys under Settings → Security.
  2. Paste it into Houston's API key.
  3. Choose Read or Write for Access (Write allows bookings and changes), then save.

The key acts as your account, including your teams. Booking changes can email guests and update calendars; workflows can send messages automatically.

Advanced

This connector uses api.cal.com; EU and self-hosted instances are unsupported. Manage connected calendars, video apps and API keys in Cal.com. Replace expired or revoked keys in Houston. Webhooks require Write access because they contain signing secrets.

Cal.com API guide.

Files

  • connector.luau
    -- Cal.com API v2. Arguments and results keep Cal.com's native camelCase fields.
    type Options = {[string]: any}
    type Endpoint = {
    	method: string, path: string, version: string?, query: {string}?, extra: {string}?, required: {string}?,
    	access: string?, body: (boolean | string)?, doc: string, about: string,
    }
    
    local PROVIDER = "Cal.com"
    local API = "https://api.cal.com"
    local DOCS = "https://cal.com/docs/api-reference/v2/"
    
    -- Cal.com versions each controller with a cal-api-version header; without the expected
    -- value an endpoint silently falls back to its legacy behavior, or does not exist.
    local BOOKINGS = "2026-02-25"
    local BOOKING_LIST = "2026-05-01"
    local BOOKING_DETAILS = "2024-08-13"
    local EVENT_TYPES = "2026-06-12"
    local SLOTS = "2024-09-04"
    local PRIVATE_LINKS = "2024-09-04"
    local SCHEDULES = "2024-06-11"
    local WORKFLOWS = "2026-09-22"
    
    local function list(...: {string}): {string}
    	local fields: {string} = {}
    	for _, group in {...} do table.move(group, 1, #group, #fields + 1, fields) end
    	return fields
    end
    local PAGE = {"take", "skip"}
    local BOOKING_FILTERS = {"status", "attendeeEmail", "attendeeName", "bookingUid", "eventTypeIds", "eventTypeId", "afterStart", "beforeEnd",
    	"afterCreatedAt", "beforeCreatedAt", "afterUpdatedAt", "beforeUpdatedAt", "sortStart", "sortEnd", "sortCreated", "sortUpdatedAt"}
    local SLOT_OPTIONS = {"start", "end", "timeZone", "duration", "format", "bookingUidToReschedule"}
    
    -- Operations in Cal.com's public OpenAPI that a user API key can call, checked on
    -- 2026-10-14. Path {fields} and listed query fields are taken from the options; the
    -- other fields form the JSON body (see hasBody). Writes need write access, and so do
    -- webhook reads, which return signing secrets; the routing-form slot calculation only reads.
    local endpoints: {[string]: Endpoint} = {
    	getMe = {method = "GET", path = "/v2/me", doc = "me/get-my-profile", about = "The connected user: id, username, email, timeZone, defaultScheduleId, ..."},
    	updateMe = {method = "PATCH", path = "/v2/me", access = "data:write", doc = "me/update-my-profile",
    		about = "Body {name?, email?, timeZone?, timeFormat? (12 or 24), weekStart?, defaultScheduleId?, locale?, bio?, avatarUrl?, metadata?}."},
    	listOutOfOffice = {method = "GET", path = "/v2/me/ooo", doc = "out-of-office/get-all-out-of-office-entries-for-the-authenticated-user",
    		query = list(PAGE, {"sortStart", "sortEnd"}), about = "Out-of-office entries."},
    	createOutOfOffice = {method = "POST", path = "/v2/me/ooo", access = "data:write", doc = "out-of-office/create-an-out-of-office-entry-for-the-authenticated-user",
    		about = "Body {start, end, reason? (unspecified, vacation, travel, sick or public_holiday), notes?, toUserId? (redirect bookings)}."},
    	updateOutOfOffice = {method = "PATCH", path = "/v2/me/ooo/{oooId}", access = "data:write", doc = "out-of-office/update-an-out-of-office-entry-for-the-authenticated-user",
    		about = "Body: the createOutOfOffice fields to change."},
    	deleteOutOfOffice = {method = "DELETE", path = "/v2/me/ooo/{oooId}", access = "data:write", doc = "out-of-office/delete-an-out-of-office-entry-for-the-authenticated-user", about = "Deletes an entry."},
    
    	listBookings = {method = "GET", path = "/v2/bookings", version = BOOKING_LIST, doc = "bookings/get-all-bookings",
    		query = list(BOOKING_FILTERS, {"teamsIds", "teamId", "cursor", "limit"}),
    		about = "Bookings you host or attend. status: upcoming, recurring, past, cancelled or unconfirmed (one per call). limit is 1..100 (default 50); continue with cursor=pagination.nextCursor while pagination.hasMore."},
    	getBooking = {method = "GET", path = "/v2/bookings/{bookingUid}", version = BOOKINGS, doc = "bookings/get-a-booking", about = "A booking with its attendees, location and status."},
    	getBookingBySeat = {method = "GET", path = "/v2/bookings/by-seat/{seatUid}", version = BOOKINGS, doc = "bookings/get-a-booking-by-seat-uid", about = "The booking holding a seat."},
    	createBooking = {method = "POST", path = "/v2/bookings", access = "data:write", version = BOOKINGS, doc = "bookings/create-a-booking",
    		about = "Body {start, attendee={name, email, timeZone, phoneNumber?, language?}, eventTypeId (or eventTypeSlug with username or teamSlug), guests?, location?, lengthInMinutes?, bookingFieldsResponses?, metadata?}. Take start from getSlots. Add recurrenceCount for recurring event types. Cal.com emails the attendees and hosts."},
    	cancelBooking = {method = "POST", path = "/v2/bookings/{bookingUid}/cancel", access = "data:write", version = BOOKINGS, doc = "bookings/cancel-a-booking",
    		about = "Body {cancellationReason?, cancelSubsequentBookings?}, or {seatUid, cancellationReason?} for one seat. Notifies attendees."},
    	rescheduleBooking = {method = "POST", path = "/v2/bookings/{bookingUid}/reschedule", access = "data:write", version = BOOKINGS, doc = "bookings/reschedule-a-booking",
    		about = "Body {start, reschedulingReason?, rescheduledBy?, lengthInMinutes?}, plus seatUid for a seat. Creates a new booking uid and notifies attendees."},
    	requestBookingReschedule = {method = "POST", path = "/v2/bookings/{bookingUid}/request-reschedule", access = "data:write", version = BOOKINGS, doc = "bookings/request-to-reschedule-a-booking",
    		about = "Body {rescheduleReason?}. Cancels the booking and asks the attendee to pick a new time."},
    	confirmBooking = {method = "POST", path = "/v2/bookings/{bookingUid}/confirm", access = "data:write", version = BOOKINGS, body = false, doc = "bookings/confirm-a-booking", about = "Accepts a booking that requires confirmation."},
    	declineBooking = {method = "POST", path = "/v2/bookings/{bookingUid}/decline", access = "data:write", version = BOOKINGS, doc = "bookings/decline-a-booking",
    		about = "Body {reason?}. Rejects a booking that requires confirmation."},
    	markBookingAbsence = {method = "POST", path = "/v2/bookings/{bookingUid}/mark-absent", access = "data:write", version = BOOKINGS, doc = "bookings/mark-a-booking-absence",
    		about = "Body {host?, attendees?={{email, absent}}}. Records no-shows after the meeting."},
    	reassignBooking = {method = "POST", path = "/v2/bookings/{bookingUid}/reassign", access = "data:write", version = BOOKINGS, body = false, doc = "bookings/reassign-a-booking-to-auto-selected-host",
    		about = "Moves a round-robin booking to another available host."},
    	reassignBookingToUser = {method = "POST", path = "/v2/bookings/{bookingUid}/reassign/{userId}", access = "data:write", version = BOOKINGS, doc = "bookings/reassign-a-booking-to-a-specific-host",
    		about = "Body {reason?}. Moves a round-robin booking to the given host."},
    	getBookingReferences = {method = "GET", path = "/v2/bookings/{bookingUid}/references", version = BOOKINGS, doc = "bookings/get-booking-references",
    		query = {"type"}, about = "Calendar events and video meetings created for a booking."},
    	getBookingRecordings = {method = "GET", path = "/v2/bookings/{bookingUid}/recordings", version = BOOKINGS, doc = "bookings/get-all-the-recordings-for-the-booking", about = "Cal Video recordings."},
    	getBookingTranscripts = {method = "GET", path = "/v2/bookings/{bookingUid}/transcripts", version = BOOKINGS,
    		doc = "bookings/get-cal-video-real-time-transcript-download-links-for-the-booking", about = "Cal Video transcript download links."},
    	getBookingConferencingSessions = {method = "GET", path = "/v2/bookings/{bookingUid}/conferencing-sessions", version = BOOKINGS,
    		doc = "bookings/get-video-meeting-sessions-only-supported-for-cal-video", about = "Cal Video sessions with participants and join times."},
    	getBookingCalendarLinks = {method = "GET", path = "/v2/bookings/{bookingUid}/calendar-links", version = BOOKINGS,
    		doc = "bookings/get-add-to-calendar-links-for-a-booking", about = "Add-to-calendar links for Google, Outlook, Yahoo and ICS."},
    	updateBookingLocation = {method = "PATCH", path = "/v2/bookings/{bookingUid}/location", access = "data:write", version = BOOKING_DETAILS,
    		doc = "bookings/update-booking-location-for-an-existing-booking", about = "Body {location={type, ...}}. Changes where the meeting takes place."},
    	listBookingAttendees = {method = "GET", path = "/v2/bookings/{bookingUid}/attendees", version = BOOKING_DETAILS,
    		doc = "bookings-attendees/get-all-attendees-for-a-booking", about = "Attendees of a booking."},
    	getBookingAttendee = {method = "GET", path = "/v2/bookings/{bookingUid}/attendees/{attendeeId}", version = BOOKING_DETAILS,
    		doc = "bookings-attendees/get-a-specific-attendee-for-a-booking", about = "An attendee."},
    	addBookingAttendee = {method = "POST", path = "/v2/bookings/{bookingUid}/attendees", access = "data:write", version = BOOKING_DETAILS,
    		doc = "bookings-attendees/add-an-attendee-to-a-booking", about = "Body {name, email, timeZone, phoneNumber?, language?}. Notifies the new attendee."},
    	addBookingGuests = {method = "POST", path = "/v2/bookings/{bookingUid}/guests", access = "data:write", version = BOOKING_DETAILS,
    		doc = "bookings-guests/add-guests-to-an-existing-booking", about = "Body {guests={{email, name?, timeZone?}}}: at most 10 per call and 30 per booking. Notifies the guests."},
    	getBookingRoutingTrace = {method = "GET", path = "/v2/bookings/{bookingUid}/routing-trace", version = BOOKING_DETAILS,
    		doc = "bookings-routing-trace/get-the-routing-trace-for-a-booking", about = "How a routing form chose the booking's host."},
    
    	listEventTypes = {method = "GET", path = "/v2/event-types", version = EVENT_TYPES, doc = "event-types/list-event-types",
    		query = {"username", "eventSlug", "usernames", "orgSlug", "orgId", "sortCreatedAt"},
    		about = "Your event types without filters, or another user's public ones by username (and eventSlug)."},
    	getEventType = {method = "GET", path = "/v2/event-types/{eventTypeId}", version = EVENT_TYPES, doc = "event-types/get-an-event-type", about = "An event type."},
    	createEventType = {method = "POST", path = "/v2/event-types", access = "data:write", version = EVENT_TYPES, doc = "event-types/create-an-event-type",
    		about = "Body {title, slug, lengthInMinutes, description?, locations?, bookingFields?, scheduleId?, hidden?, ...}."},
    	updateEventType = {method = "PATCH", path = "/v2/event-types/{eventTypeId}", access = "data:write", version = EVENT_TYPES, doc = "event-types/update-an-event-type",
    		about = "Body: the createEventType fields to change."},
    	deleteEventType = {method = "DELETE", path = "/v2/event-types/{eventTypeId}", access = "data:write", version = EVENT_TYPES, doc = "event-types/delete-an-event-type", about = "Deletes an event type."},
    	getEventTypeSchedulingConfig = {method = "GET", path = "/v2/event-types/{eventTypeId}/scheduling-config", version = EVENT_TYPES,
    		doc = "event-types/get-scheduling-configuration", about = "Availability, limits and buffers that decide an event type's slots."},
    	getEventTypeHistory = {method = "GET", path = "/v2/event-types/{eventTypeId}/history", version = EVENT_TYPES, doc = "event-types/get-event-type-history",
    		query = {"cursor", "limit"}, about = "Changes made to an event type; limit is 1..50."},
    	getBookingFields = {method = "GET", path = "/v2/event-types/{eventTypeId}/booking-fields", version = EVENT_TYPES, doc = "event-types/get-booking-fields",
    		about = "Questions the booking form asks."},
    	addBookingFields = {method = "POST", path = "/v2/event-types/{eventTypeId}/booking-fields", access = "data:write", version = EVENT_TYPES, doc = "event-types/add-custom-booking-fields",
    		about = "Body {bookingFields={{type, slug, label, required, ...}}}. Adds custom questions."},
    	updateBookingFields = {method = "PATCH", path = "/v2/event-types/{eventTypeId}/booking-fields", access = "data:write", version = EVENT_TYPES, doc = "event-types/update-booking-fields",
    		about = "Body {bookingFields}. Changes the questions with matching slugs."},
    	replaceBookingFields = {method = "PUT", path = "/v2/event-types/{eventTypeId}/booking-fields", access = "data:write", version = EVENT_TYPES, doc = "event-types/replace-booking-fields",
    		about = "Body {bookingFields}. Replaces every question."},
    	deleteBookingField = {method = "DELETE", path = "/v2/event-types/{eventTypeId}/booking-fields/{slug}", access = "data:write", version = EVENT_TYPES,
    		doc = "event-types/delete-a-custom-booking-field", about = "Deletes a custom question."},
    	listEventTypeWebhooks = {method = "GET", path = "/v2/event-types/{eventTypeId}/webhooks", access = "data:write", doc = "event-types-webhooks/get-all-webhooks",
    		query = PAGE, about = "Webhooks of an event type."},
    	getEventTypeWebhook = {method = "GET", path = "/v2/event-types/{eventTypeId}/webhooks/{webhookId}", access = "data:write", doc = "event-types-webhooks/get-a-webhook", about = "A webhook."},
    	createEventTypeWebhook = {method = "POST", path = "/v2/event-types/{eventTypeId}/webhooks", access = "data:write", doc = "event-types-webhooks/create-a-webhook",
    		about = "Body as createWebhook, for one event type's bookings."},
    	updateEventTypeWebhook = {method = "PATCH", path = "/v2/event-types/{eventTypeId}/webhooks/{webhookId}", access = "data:write", doc = "event-types-webhooks/update-a-webhook",
    		about = "Body: the createWebhook fields to change."},
    	deleteEventTypeWebhook = {method = "DELETE", path = "/v2/event-types/{eventTypeId}/webhooks/{webhookId}", access = "data:write", doc = "event-types-webhooks/delete-a-webhook", about = "Deletes a webhook."},
    	listPrivateLinks = {method = "GET", path = "/v2/event-types/{eventTypeId}/private-links", version = PRIVATE_LINKS,
    		doc = "event-types-private-links/get-all-private-links-for-an-event-type", about = "Private booking links of an event type."},
    	createPrivateLink = {method = "POST", path = "/v2/event-types/{eventTypeId}/private-links", access = "data:write", version = PRIVATE_LINKS,
    		doc = "event-types-private-links/create-a-private-link-for-an-event-type", about = "Body {expiresAt?, maxUsageCount?}. Returns a booking URL for a hidden event type."},
    	updatePrivateLink = {method = "PATCH", path = "/v2/event-types/{eventTypeId}/private-links/{linkId}", access = "data:write", version = PRIVATE_LINKS,
    		doc = "event-types-private-links/update-a-private-link-for-an-event-type", about = "Body {expiresAt?, maxUsageCount?}."},
    	deletePrivateLink = {method = "DELETE", path = "/v2/event-types/{eventTypeId}/private-links/{linkId}", access = "data:write", version = PRIVATE_LINKS,
    		doc = "event-types-private-links/delete-a-private-link-for-an-event-type", about = "Disables a private link."},
    
    	listWebhooks = {method = "GET", path = "/v2/webhooks", access = "data:write", doc = "webhooks/get-all-webhooks", query = PAGE, about = "Your webhooks for all your bookings."},
    	getWebhook = {method = "GET", path = "/v2/webhooks/{webhookId}", access = "data:write", doc = "webhooks/get-a-webhook", about = "A webhook."},
    	createWebhook = {method = "POST", path = "/v2/webhooks", access = "data:write", doc = "webhooks/create-a-webhook",
    		about = "Body {subscriberUrl, triggers={'BOOKING_CREATED', ...}, active, secret?, payloadTemplate?}. Cal.com then posts those events to subscriberUrl, a receiver you control."},
    	updateWebhook = {method = "PATCH", path = "/v2/webhooks/{webhookId}", access = "data:write", doc = "webhooks/update-a-webhook", about = "Body: the createWebhook fields to change."},
    	deleteWebhook = {method = "DELETE", path = "/v2/webhooks/{webhookId}", access = "data:write", doc = "webhooks/delete-a-webhook", about = "Deletes a webhook."},
    
    	getSlots = {method = "GET", path = "/v2/slots", version = SLOTS, doc = "slots/get-available-time-slots-for-an-event-type",
    		query = list(SLOT_OPTIONS, {"eventTypeId", "eventTypeSlug", "username", "usernames", "teamSlug", "organizationSlug"}), required = {"start", "end"},
    		about = "Bookable times between start and end, as data keyed by date with {start} slots ({start, end} with format='range'). Pass eventTypeId, or eventTypeSlug with username or teamSlug."},
    	reserveSlot = {method = "POST", path = "/v2/slots/reservations", access = "data:write", version = SLOTS, doc = "slots/reserve-a-slot",
    		about = "Body {eventTypeId, slotStart, slotDuration?, reservationDuration? (minutes, default 5)}. Holds a slot while booking."},
    	getSlotReservation = {method = "GET", path = "/v2/slots/reservations/{reservationUid}", version = SLOTS, doc = "slots/get-reserved-slot", about = "A slot reservation."},
    	updateSlotReservation = {method = "PATCH", path = "/v2/slots/reservations/{reservationUid}", access = "data:write", version = SLOTS, doc = "slots/update-a-reserved-slot",
    		about = "Body as reserveSlot."},
    	deleteSlotReservation = {method = "DELETE", path = "/v2/slots/reservations/{reservationUid}", access = "data:write", version = SLOTS, doc = "slots/delete-a-reserved-slot", about = "Releases a slot."},
    
    	listSchedules = {method = "GET", path = "/v2/schedules", version = SCHEDULES, doc = "schedules/get-all-schedules", about = "Your availability schedules."},
    	getDefaultSchedule = {method = "GET", path = "/v2/schedules/default", version = SCHEDULES, doc = "schedules/get-default-schedule", about = "Your default schedule."},
    	getSchedule = {method = "GET", path = "/v2/schedules/{scheduleId}", version = SCHEDULES, doc = "schedules/get-a-schedule", about = "A schedule."},
    	createSchedule = {method = "POST", path = "/v2/schedules", access = "data:write", version = SCHEDULES, doc = "schedules/create-a-schedule",
    		about = "Body {name, timeZone, isDefault, availability?={{days={'Monday', ...}, startTime='09:00', endTime='17:00'}}, overrides?={{date, startTime, endTime}}}."},
    	updateSchedule = {method = "PATCH", path = "/v2/schedules/{scheduleId}", access = "data:write", version = SCHEDULES, doc = "schedules/update-a-schedule",
    		about = "Body: the createSchedule fields to change; availability and overrides are replaced whole."},
    	deleteSchedule = {method = "DELETE", path = "/v2/schedules/{scheduleId}", access = "data:write", version = SCHEDULES, doc = "schedules/delete-a-schedule", about = "Deletes a schedule."},
    
    	listCalendars = {method = "GET", path = "/v2/calendars", doc = "calendars/get-all-calendars",
    		about = "Connected calendars, the calendars checked for conflicts and the destination calendar, with credential IDs."},
    	getBusyTimes = {method = "GET", path = "/v2/calendars/busy-times", doc = "calendars/get-busy-times",
    		query = {"dateFrom", "dateTo", "timeZone", "calendar"}, required = {"dateFrom", "dateTo", "calendar"},
    		about = "Busy intervals in connected calendars. calendar is an array of one or more 'credentialId,externalId' from listCalendars."},
    	listConferencingApps = {method = "GET", path = "/v2/conferencing", doc = "conferencing/list-your-conferencing-applications", about = "Installed video apps."},
    	getDefaultConferencingApp = {method = "GET", path = "/v2/conferencing/default", doc = "conferencing/get-your-default-conferencing-application", about = "Your default video app."},
    	setDefaultConferencingApp = {method = "POST", path = "/v2/conferencing/{app}/default", access = "data:write", body = false, doc = "conferencing/set-your-default-conferencing-application",
    		about = "Makes an installed app the default: google-meet, zoom, msteams or daily-video."},
    	calculateRoutingFormSlots = {method = "POST", path = "/v2/routing-forms/{routingFormId}/calculate-slots", body = "answers",
    		doc = "routing-forms/calculate-slots-based-on-routing-form-response", query = list(SLOT_OPTIONS, {"rescheduleWithSameHost"}), required = {"start", "end"},
    		about = "answers: the form answers keyed by field. Returns the routed event type and its slots without saving a response."},
    
    	listVerifiedEmails = {method = "GET", path = "/v2/verified-resources/emails", doc = "verified-resources/get-list-of-verified-emails", query = PAGE,
    		about = "Emails verified for workflow messages."},
    	getVerifiedEmail = {method = "GET", path = "/v2/verified-resources/emails/{id}", doc = "verified-resources/get-verified-email-by-id", about = "A verified email."},
    	requestEmailVerificationCode = {method = "POST", path = "/v2/verified-resources/emails/verification-code/request", access = "data:write", doc = "verified-resources/request-email-verification-code",
    		about = "Body {email}. Emails a verification code."},
    	verifyEmail = {method = "POST", path = "/v2/verified-resources/emails/verification-code/verify", access = "data:write", doc = "verified-resources/verify-an-email", about = "Body {email, code}."},
    	listVerifiedPhones = {method = "GET", path = "/v2/verified-resources/phones", doc = "verified-resources/get-list-of-verified-phone-numbers", query = PAGE,
    		about = "Phone numbers verified for workflow messages."},
    	getVerifiedPhone = {method = "GET", path = "/v2/verified-resources/phones/{id}", doc = "verified-resources/get-verified-phone-number-by-id", about = "A verified phone number."},
    	requestPhoneVerificationCode = {method = "POST", path = "/v2/verified-resources/phones/verification-code/request", access = "data:write",
    		doc = "verified-resources/request-phone-number-verification-code", about = "Body {phone}. Texts a verification code."},
    	verifyPhone = {method = "POST", path = "/v2/verified-resources/phones/verification-code/verify", access = "data:write", doc = "verified-resources/verify-a-phone-number", about = "Body {phone, code}."},
    
    	listWorkflows = {method = "GET", path = "/v2/workflows", version = WORKFLOWS, doc = "workflows/get-your-workflows", query = PAGE,
    		about = "Automated reminders and follow-ups."},
    	getWorkflow = {method = "GET", path = "/v2/workflows/{workflowId}", version = WORKFLOWS, doc = "workflows/get-your-workflow", about = "A workflow."},
    	getWorkflowConditionFields = {method = "GET", path = "/v2/workflows/{workflowId}/condition-fields", version = WORKFLOWS,
    		doc = "workflows/get-the-fields-a-workflows-conditions-can-read", about = "Fields a workflow's conditions can test."},
    	createWorkflow = {method = "POST", path = "/v2/workflows", access = "data:write", version = WORKFLOWS, doc = "workflows/create-a-workflow",
    		about = "Body {name, activation, trigger, steps}. Steps send emails or texts to attendees or hosts."},
    	updateWorkflow = {method = "PATCH", path = "/v2/workflows/{workflowId}", access = "data:write", version = WORKFLOWS, doc = "workflows/update-your-workflow",
    		about = "Body: the createWorkflow fields to change."},
    	deleteWorkflow = {method = "DELETE", path = "/v2/workflows/{workflowId}", access = "data:write", version = WORKFLOWS, doc = "workflows/delete-your-workflow", about = "Deletes a workflow."},
    
    	listTeams = {method = "GET", path = "/v2/teams", doc = "teams/get-teams", about = "Teams you belong to."},
    	getTeam = {method = "GET", path = "/v2/teams/{teamId}", doc = "teams/get-a-team", about = "A team."},
    	listTeamBookings = {method = "GET", path = "/v2/teams/{teamId}/bookings", doc = "teams-bookings/get-team-bookings",
    		query = list(BOOKING_FILTERS, PAGE), about = "A team's bookings. status is one value or a comma-separated string such as 'upcoming,past'; take is 1..250 (default 100)."},
    	listTeamEventTypes = {method = "GET", path = "/v2/teams/{teamId}/event-types", version = EVENT_TYPES, doc = "team-event-types/list-team-event-types",
    		query = {"eventSlug", "hostsLimit", "sortCreatedAt"}, about = "A team's event types."},
    	getTeamEventType = {method = "GET", path = "/v2/teams/{teamId}/event-types/{eventTypeId}", version = EVENT_TYPES, doc = "team-event-types/get-a-team-event-type",
    		about = "A team event type with its hosts."},
    	listTeamMemberships = {method = "GET", path = "/v2/teams/{teamId}/memberships", doc = "teams-memberships/get-all-memberships",
    		query = list(PAGE, {"emails"}), about = "Team members and their roles."},
    	listTeamSchedules = {method = "GET", path = "/v2/teams/{teamId}/schedules", doc = "teams-schedules/get-all-team-member-schedules", query = PAGE,
    		about = "Availability schedules of team members."},
    
    	listTimezones = {method = "GET", path = "/v2/timezones", doc = "timezones/get-timezones", query = {"search", "limit"}, about = "Supported time zones."},
    }
    
    -- Request layer shared verbatim by the endpoint-table connectors
    -- (tools/validate checks they match). It uses each connector's PROVIDER, DOCS and Endpoint type.
    local NULL = json.decode("null")
    local NONE: {string} = table.freeze({})
    
    local function options(input: Options?): Options
    	if input == nil then return {} end
    	assert(type(input) == "table", "opts must be an object")
    	for key in input do assert(type(key) == "string", "opts must have named fields") end
    	return table.clone(input)
    end
    
    local function scalar(value: any, field: string): string
    	local kind = type(value)
    	assert(kind == "string" or kind == "boolean" or kind == "number", field .. " must be a string, boolean, number or array of those")
    	return url.encode(value)
    end
    
    -- A query value's encoded parts: one for a scalar, one per item of a nonempty array. Each
    -- connector joins them as its provider expects, comma-separated or with the key repeated.
    local function queryParts(value: any, field: string): {string}
    	if type(value) ~= "table" then return {scalar(value, field)} end
    	local parts: {string} = {}
    	for index, item in value do
    		assert(type(index) == "number" and index == #parts + 1, field .. " must be an array, not an object")
    		table.insert(parts, scalar(item, field))
    	end
    	assert(#parts > 0, field .. " must not be an empty array")
    	return parts
    end
    
    -- POST, PATCH and PUT send the remaining options as the JSON body unless body is false
    -- (no body) or names the one option to send.
    local function hasBody(endpoint: Endpoint): boolean
    	return endpoint.body ~= false and (endpoint.method == "POST" or endpoint.method == "PATCH" or endpoint.method == "PUT")
    end
    
    local function fail(name: string, response: HttpResponse, message: string): never
    	return houston.fail({operation = name, layer = "upstream", upstream_status = response.statusCode,
    		retryable = response.statusCode == 429 or response.statusCode >= 500, message = message})
    end
    
    -- A successful response's JSON object, or nil when a write answers without a body. With arrays,
    -- a top-level JSON array is accepted too, and the second result tells which one came back.
    local function object(name: string, endpoint: Endpoint, response: HttpResponse, arrays: boolean?): (any, boolean)
    	local raw = await(response.body:readAll())
    	if endpoint.method ~= "GET" and endpoint.access and string.match(raw, "^%s*$") then return nil, false end
    	local ok, value = pcall(json.decode, raw)
    	local list = arrays == true and string.match(raw, "^%s*%[") ~= nil
    	if not ok or type(value) ~= "table" or not (list or string.match(raw, "^%s*{")) then
    		fail(name, response, PROVIDER .. " returned an invalid JSON object")
    	end
    	return value, list
    end
    
    -- name({path fields, query fields?, extra fields?, required body fields, ...body}) built from the
    -- endpoint itself.
    -- Extra fields are options the connector's own request consumes, such as a request header.
    local function signature(endpoint: Endpoint): string
    	local fields: {string} = {}
    	for field in string.gmatch(endpoint.path, "{([%w_]+)}") do table.insert(fields, field) end
    	for _, group in {endpoint.query or NONE, endpoint.extra or NONE} do
    		for _, field in group do
    			table.insert(fields, if table.find(endpoint.required or NONE, field) then field else field .. "?")
    		end
    	end
    	if type(endpoint.body) == "string" then
    		table.insert(fields, endpoint.body)
    	elseif hasBody(endpoint) then
    		for _, field in endpoint.required or NONE do
    			if not table.find(fields, field) then table.insert(fields, field) end
    		end
    		table.insert(fields, "...body")
    	end
    	return "({" .. table.concat(fields, ", ") .. "})"
    end
    
    -- A function for each endpoint the connection's access allows, and help listing them after intro.
    local function operations(endpoints: {[string]: Endpoint}, request: (string, Endpoint, Options?) -> any, intro: {string}): {[string]: any}
    	local exports: {[string]: any} = {}
    	for name, endpoint in endpoints do
    		if not endpoint.access or houston.allows(endpoint.access) then
    			exports[name] = function(args: Options?): any return request(name, endpoint, args) end
    		end
    	end
    	exports.help = function(): string
    		local names: {string} = {}
    		for name in exports do if name ~= "help" then table.insert(names, name) end end
    		table.sort(names)
    		local lines = table.clone(intro)
    		table.insert(lines, "Each function below names its route and reference page, " .. DOCS .. "<page>.")
    		for _, name in names do
    			local endpoint = endpoints[name]
    			table.insert(lines, name .. signature(endpoint) .. ": " .. endpoint.about .. " " .. endpoint.method .. " " .. endpoint.path .. " (" .. endpoint.doc .. ")")
    		end
    		return table.concat(lines, "\n")
    	end
    	return exports
    end
    -- End of the shared request layer.
    
    -- Event types, schedules, teams and users have numeric IDs; bookings, seats, webhooks,
    -- reservations and links have string IDs; apps and booking fields have slugs.
    local function identifier(value: any, field: string): string
    	if type(value) == "number" then
    		assert(value >= 0 and value % 1 == 0 and value <= 9007199254740991, field .. " must be a nonnegative integer ID")
    		return string.format("%d", value)
    	end
    	assert(type(value) == "string" and string.match(value, "^[%w_%-]+$"), field .. " must be an ID, uid or slug")
    	return value
    end
    
    -- Cal.com errors are {status="error", error={code, message, details?}}.
    local function errorMessage(status: number, value: any): string
    	local message = "Cal.com HTTP " .. tostring(status)
    	local problem = if type(value) == "table" and type(value.error) == "table" then value.error else nil
    	if problem then
    		if type(problem.code) == "string" then message ..= " (" .. problem.code .. ")" end
    		if type(problem.message) == "string" then message ..= ": " .. string.sub(problem.message, 1, 600) end
    		if problem.details ~= nil then message ..= " " .. string.sub(json.encode(problem.details), 1, 600) end
    	end
    	return message
    end
    
    local function failStatus(name: string, response: HttpResponse): never
    	local ok, value = pcall(json.decode, await(response.body:readPrefix(16 * 1024)))
    	local message = errorMessage(response.statusCode, if ok then value else nil)
    	local retry = response.headers["retry-after"]
    	if retry and retry[1] then message ..= "; Retry-After: " .. retry[1] end
    	return fail(name, response, message)
    end
    
    local function decode(name: string, endpoint: Endpoint, response: HttpResponse): any
    	if response.statusCode < 200 or response.statusCode >= 300 then failStatus(name, response) end
    	local value = object(name, endpoint, response)
    	-- Some deletions, such as deleteWorkflow, succeed without a body.
    	if value == nil then return {status = "success"} end
    	if value.status ~= "success" then fail(name, response, errorMessage(response.statusCode, value)) end
    	return value
    end
    
    local function request(name: string, endpoint: Endpoint, input: Options?): any
    	local args = options(input)
    	local path = string.gsub(endpoint.path, "{([%w_]+)}", function(field: string)
    		local id = identifier(args[field], field)
    		args[field] = nil
    		return id
    	end)
    	for _, field in endpoint.required or NONE do
    		assert(args[field] ~= nil and args[field] ~= NULL, field .. " is required")
    	end
    	local query: {string} = {}
    	for _, field in endpoint.query or NONE do
    		-- Arrays repeat their key (calendar=a&calendar=b), as Cal.com's busy times require; other
    		-- lists, such as eventTypeIds, are comma-separated strings.
    		if args[field] ~= nil then
    			for _, part in queryParts(args[field], field) do table.insert(query, field .. "=" .. part) end
    		end
    		args[field] = nil
    	end
    	if #query > 0 then path ..= "?" .. table.concat(query, "&") end
    	local headers: HttpHeaders = {Accept = {"application/json"}}
    	if endpoint.version then headers["cal-api-version"] = {endpoint.version} end
    	local body: string? = nil
    	if type(endpoint.body) == "string" then
    		local field = endpoint.body
    		assert(type(args[field]) == "table", field .. " must be an object")
    		body = json.encode(args[field])
    		args[field] = nil
    	elseif hasBody(endpoint) then
    		body = json.encode(args)
    		args = {}
    	end
    	local unknown = next(args)
    	assert(unknown == nil, name .. " has no option " .. tostring(unknown))
    	if body then headers["Content-Type"] = {"application/json"} end
    	return decode(name, endpoint, await(http.request({method = endpoint.method, url = API .. path, headers = headers, body = body})))
    end
    
    return operations(endpoints, request, {
    	"Cal.com API v2. Every function takes one named options object with Cal.com's camelCase names; ? marks optional fields and ...body the JSON body fields. end is a Luau keyword, so write it as ['end']='2026-10-22'. In bodies, pass json.decode('[]') for empty arrays and json.decode('null') to clear a field. Results are Cal.com's JSON unchanged: {status='success', data, pagination?}; a write without a response body returns {status='success'}. The connector sends each endpoint's cal-api-version. Connector calls return completed values: use them directly, without await.",
    	"Bookings are identified by their uid (bookingUid); event types, schedules, teams, users and attendees by numeric IDs. Times are ISO 8601, such as 2026-10-14T09:00:00Z, and time zones IANA names such as Europe/Paris. Lists such as eventTypeIds='100,200' are comma-separated strings; only getBusyTimes takes calendar as an array.",
    	"Paging: listBookings uses cursor and limit (continue with pagination.nextCursor while pagination.hasMore); getEventTypeHistory also uses a cursor. listTeamBookings returns pagination totals for take and skip. Other take/skip lists (take 1..250, default 250) return a plain data array: increase skip while a full page comes back. Event types, schedules, teams, calendars and apps are unpaginated.",
    	"To book: getSlots({eventTypeId=123, start='2026-10-15', ['end']='2026-10-22', timeZone='Europe/Paris'}) returns data[date] = {{start=...}}; then createBooking({eventTypeId=123, start=slot.start, attendee={name='Ana', email='[email protected]', timeZone='Europe/Paris'}}). Other examples: listBookings({status='upcoming', afterStart='2026-10-14T00:00:00Z', limit=20}); cancelBooking({bookingUid=uid, cancellationReason='Conflict'}); rescheduleBooking({bookingUid=uid, start='2026-10-16T14:00:00Z'}).",
    	"Read-only connections omit writes and webhook reads, whose responses include signing secrets; calculateRoutingFormSlots only reads. Bookings, cancellations, reschedules, reassignments and added attendees or guests email the people involved and update connected calendars; verification-code requests send an email or text; workflows send messages automatically. Team functions need team membership. Connecting calendars or video apps, organization administration and API key rotation happen in Cal.com, not here.",
    	"There are no automatic retries: after a timeout or 5xx, read the booking or resource again before repeating a write. Errors report the HTTP status, Cal.com's error code, message and validation details.",
    })
    
  • houston.json
    {
      "schema_version": 2,
      "name": "Cal.com",
      "files": [
        "connector.luau"
      ],
      "icon": "icon.svg",
      "access": [
        {
          "name": "data",
          "label": "Access",
          "levels": [
            {
              "value": "read",
              "label": "Read"
            },
            {
              "value": "write",
              "label": "Write"
            }
          ],
          "default": "read"
        }
      ],
      "auth": {
        "api_key": {
          "type": "manual",
          "label": "API key",
          "config": {
            "token": {
              "label": "API key",
              "required": true,
              "type": "secret"
            }
          }
        }
      },
      "proxy": [
        {
          "match": {
            "protocol": "http",
            "host": [
              "api.cal.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/v2/bookings",
              "/v2/bookings/by-seat/{seatUid}",
              "/v2/bookings/{bookingUid}",
              "/v2/bookings/{bookingUid}/attendees",
              "/v2/bookings/{bookingUid}/attendees/{attendeeId}",
              "/v2/bookings/{bookingUid}/calendar-links",
              "/v2/bookings/{bookingUid}/conferencing-sessions",
              "/v2/bookings/{bookingUid}/recordings",
              "/v2/bookings/{bookingUid}/references",
              "/v2/bookings/{bookingUid}/routing-trace",
              "/v2/bookings/{bookingUid}/transcripts",
              "/v2/calendars",
              "/v2/calendars/busy-times",
              "/v2/conferencing",
              "/v2/conferencing/default",
              "/v2/event-types",
              "/v2/event-types/{eventTypeId}",
              "/v2/event-types/{eventTypeId}/booking-fields",
              "/v2/event-types/{eventTypeId}/history",
              "/v2/event-types/{eventTypeId}/private-links",
              "/v2/event-types/{eventTypeId}/scheduling-config",
              "/v2/me",
              "/v2/me/ooo",
              "/v2/schedules",
              "/v2/schedules/default",
              "/v2/schedules/{scheduleId}",
              "/v2/slots",
              "/v2/slots/reservations/{reservationUid}",
              "/v2/teams",
              "/v2/teams/{teamId}",
              "/v2/teams/{teamId}/bookings",
              "/v2/teams/{teamId}/event-types",
              "/v2/teams/{teamId}/event-types/{eventTypeId}",
              "/v2/teams/{teamId}/memberships",
              "/v2/teams/{teamId}/schedules",
              "/v2/timezones",
              "/v2/verified-resources/emails",
              "/v2/verified-resources/emails/{id}",
              "/v2/verified-resources/phones",
              "/v2/verified-resources/phones/{id}",
              "/v2/workflows",
              "/v2/workflows/{workflowId}",
              "/v2/workflows/{workflowId}/condition-fields"
            ]
          },
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.api_key.token}}"
              }
            }
          }
        },
        {
          "match": {
            "protocol": "http",
            "host": [
              "api.cal.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/v2/routing-forms/{routingFormId}/calculate-slots"
            ]
          },
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.api_key.token}}"
              }
            }
          }
        },
        {
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "protocol": "http",
            "host": [
              "api.cal.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/v2/event-types/{eventTypeId}/webhooks",
              "/v2/event-types/{eventTypeId}/webhooks/{webhookId}",
              "/v2/webhooks",
              "/v2/webhooks/{webhookId}"
            ]
          },
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.api_key.token}}"
              }
            }
          }
        },
        {
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "protocol": "http",
            "host": [
              "api.cal.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/v2/bookings",
              "/v2/bookings/{bookingUid}/attendees",
              "/v2/bookings/{bookingUid}/cancel",
              "/v2/bookings/{bookingUid}/confirm",
              "/v2/bookings/{bookingUid}/decline",
              "/v2/bookings/{bookingUid}/guests",
              "/v2/bookings/{bookingUid}/mark-absent",
              "/v2/bookings/{bookingUid}/reassign",
              "/v2/bookings/{bookingUid}/reassign/{userId}",
              "/v2/bookings/{bookingUid}/request-reschedule",
              "/v2/bookings/{bookingUid}/reschedule",
              "/v2/conferencing/{app}/default",
              "/v2/event-types",
              "/v2/event-types/{eventTypeId}/booking-fields",
              "/v2/event-types/{eventTypeId}/private-links",
              "/v2/event-types/{eventTypeId}/webhooks",
              "/v2/me/ooo",
              "/v2/schedules",
              "/v2/slots/reservations",
              "/v2/verified-resources/emails/verification-code/request",
              "/v2/verified-resources/emails/verification-code/verify",
              "/v2/verified-resources/phones/verification-code/request",
              "/v2/verified-resources/phones/verification-code/verify",
              "/v2/webhooks",
              "/v2/workflows"
            ]
          },
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.api_key.token}}"
              }
            }
          }
        },
        {
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "protocol": "http",
            "host": [
              "api.cal.com"
            ],
            "method": [
              "PATCH"
            ],
            "path": [
              "/v2/bookings/{bookingUid}/location",
              "/v2/event-types/{eventTypeId}",
              "/v2/event-types/{eventTypeId}/booking-fields",
              "/v2/event-types/{eventTypeId}/private-links/{linkId}",
              "/v2/event-types/{eventTypeId}/webhooks/{webhookId}",
              "/v2/me",
              "/v2/me/ooo/{oooId}",
              "/v2/schedules/{scheduleId}",
              "/v2/slots/reservations/{reservationUid}",
              "/v2/webhooks/{webhookId}",
              "/v2/workflows/{workflowId}"
            ]
          },
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.api_key.token}}"
              }
            }
          }
        },
        {
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "protocol": "http",
            "host": [
              "api.cal.com"
            ],
            "method": [
              "PUT"
            ],
            "path": [
              "/v2/event-types/{eventTypeId}/booking-fields"
            ]
          },
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.api_key.token}}"
              }
            }
          }
        },
        {
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "protocol": "http",
            "host": [
              "api.cal.com"
            ],
            "method": [
              "DELETE"
            ],
            "path": [
              "/v2/event-types/{eventTypeId}",
              "/v2/event-types/{eventTypeId}/booking-fields/{slug}",
              "/v2/event-types/{eventTypeId}/private-links/{linkId}",
              "/v2/event-types/{eventTypeId}/webhooks/{webhookId}",
              "/v2/me/ooo/{oooId}",
              "/v2/schedules/{scheduleId}",
              "/v2/slots/reservations/{reservationUid}",
              "/v2/webhooks/{webhookId}",
              "/v2/workflows/{workflowId}"
            ]
          },
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.api_key.token}}"
              }
            }
          }
        }
      ]
    }
    
  • icon.svgicon.svg
  • README.md
    ---
    description: Check your Cal.com bookings and availability, find open times, and book, reschedule or cancel meetings.
    ---
    
    # Cal.com
    
    Connect your Cal.com account so your agents can see upcoming and past bookings,
    find open times on your booking pages, check your calendars for busy times and
    read your event types, availability schedules and workflows. They can also look
    at the bookings, event types and schedules of teams you belong to.
    
    With write access, agents can also book meetings, reschedule or cancel
    them, confirm or decline booking requests, add guests, record no-shows and set
    out-of-office time. They can create and edit event types, booking questions,
    private links, availability schedules, webhooks and workflows. Bookings and their
    changes email the people involved and update connected calendars. Webhooks are
    visible only with write access, because they include signing secrets.
    
    The connection uses a Cal.com API key from your own account, so it can reach
    everything your account can.
    
    [Connect your Cal.com account](SETUP.md).
    
  • SETUP.md
    # Connect Cal.com
    
    1. Open [Cal.com API keys](https://app.cal.com/settings/developer/api-keys), create
       a key and copy it. Some accounts place API keys under **Settings → Security**.
    2. Paste it into Houston's **API key**.
    3. Choose **Read** or **Write** for **Access** (**Write** allows bookings and
       changes), then save.
    
    > The key acts as your account, including your teams. Booking changes can email
    > guests and update calendars; workflows can send messages automatically.
    
    ## Advanced
    
    This connector uses `api.cal.com`; EU and self-hosted instances are unsupported.
    Manage connected calendars, video apps and API keys in Cal.com. Replace expired
    or revoked keys in Houston. Webhooks require **Write** access because they
    contain signing secrets.
    
    [Cal.com API guide](https://cal.com/docs/api-reference/v2/introduction).
    
  • tests
    • authentication.luau
      return {
      	contract = function(m)
      		m.authentication({
      			{
      				auth = { token = "synthetic-method-secret" },
      				config = {},
      				endpoint = { "GET", "https://api.cal.com/v2/me" },
      				expected = "Bearer synthetic-method-secret",
      				header = "Authorization",
      				method = "api_key",
      				publisher = {},
      			},
      		})
      	end,
      }
      
    • endpoints.luau
      return {
      	contract = function(m)
      		m.endpointRules()
      	end,
      }
      
    • errors.luau
      return {
      	scenario = {publisher = {}, access = {data = "write"}, config = {}, auth_method = "api_key", auth_config = {token = "cal_live_fixture"}},
      	configure = function()
      		calls = 0
      		status = 200
      		payload = "{}"
      		responseHeaders = {}
      		http = {request = function(req)
      			calls += 1
      			return fixture.operation({statusCode = status, headers = responseHeaders, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(cal)
      		local function upstream(code, body, headers, expected)
      			status, payload, responseHeaders = code, body, headers
      			local before = calls
      			local ok, err = pcall(function() cal.cancelBooking({bookingUid = "b1", cancellationReason = "Conflict"}) end)
      			for _, text in expected do
      				assert(not ok and string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err))
      			end
      			assert(calls == before + 1, "failed write was retried")
      		end
      		upstream(401, '{"status":"error","timestamp":"2026-10-14T09:00:00Z","path":"/v2/bookings/b1/cancel","error":{"code":"UnauthorizedException","message":"Invalid API key","details":{"statusCode":401}}}', {},
      			{"HTTP 401", "UnauthorizedException", "Invalid API key"})
      		upstream(400, '{"status":"error","error":{"code":"BadRequestException","message":"Bad Request","details":{"message":["cancellationReason must be a string"]}}}', {},
      			{"HTTP 400", "BadRequestException", "cancellationReason must be a string"})
      		upstream(400, json.encode({status = "error", error = {code = "BadRequestException", message = string.rep("x", 5000), details = {message = {"start must be a date"}}}}), {},
      			{"BadRequestException", "start must be a date"})
      		upstream(429, '{"status":"error","error":{"code":"ThrottlerException","message":"Too Many Requests"}}', {["retry-after"] = {"60"}},
      			{"HTTP 429", "ThrottlerException", "Retry-After: 60"})
      		upstream(500, "<html>Internal error</html>", {}, {"HTTP 500"})
      		upstream(200, '{"status":"error","error":{"code":"NotFoundException","message":"Booking not found"}}', {},
      			{"HTTP 200", "NotFoundException", "Booking not found"})
      		upstream(200, "<html>Maintenance</html>", {}, {"invalid JSON object"})
      		upstream(200, "[]", {}, {"invalid JSON object"})
      	end,
      }
      
    • manifest.luau
      return {
      	contract = function(m)
      		do
      			local api = "https://api.cal.com/v2"
      			for _, access in { "read", "write" } do
      				local r, err = m.resolve(nil, {}, { token = "cal_live_fixture" }, "api_key", { data = access })
      				assert(not err, tostring(err))
      				m.routes(r, "Bearer cal_live_fixture", true, {
      					"GET " .. api .. "/me",
      					"GET " .. api .. "/bookings?status=upcoming&limit=20",
      					"GET " .. api .. "/bookings/2NtaeaVcKfpmSZ4CthFdfk",
      					"GET " .. api .. "/slots?eventTypeId=1&start=2026-10-15&end=2026-10-16",
      					"GET " .. api .. "/teams/3/bookings",
      					"POST " .. api .. "/routing-forms/f1/calculate-slots?start=2026-10-15&end=2026-10-16",
      				})
      				m.routes(r, "Bearer cal_live_fixture", (access == "write"), {
      					"GET " .. api .. "/webhooks",
      					"GET " .. api .. "/event-types/1/webhooks/w1",
      					"POST " .. api .. "/bookings",
      					"POST " .. api .. "/bookings/b1/cancel",
      					"PATCH " .. api .. "/event-types/1",
      					"PUT " .. api .. "/event-types/1/booking-fields",
      					"DELETE " .. api .. "/webhooks/w1",
      					"POST " .. api .. "/conferencing/zoom/default",
      				})
      				m.routes(r, "Bearer cal_live_fixture", false, {
      					"POST " .. api .. "/api-keys/refresh",
      					"POST " .. api .. "/credits/charge",
      					"POST " .. api .. "/calendars/apple/credentials",
      					"GET " .. api .. "/organizations/1/users",
      					"DELETE " .. api .. "/event-types/1/webhooks",
      					"PATCH " .. api .. "/bookings/b1",
      					"GET https://api.cal.com/v1/bookings",
      					"GET https://api.cal.eu/v2/me",
      					"GET https://app.cal.com/v2/me",
      					"GET " .. api .. "/bookings/%2e%2e/me",
      				})
      			end
      		end
      	end,
      }
      
    • read_only.luau
      return {
      	scenario = {publisher = {}, config = {}, auth_method = "api_key", auth_config = {token = "cal_live_fixture"}},
      	configure = function()
      		requests = {}
      		payload = '{"status":"success","data":{}}'
      		http = {request = function(req)
      			table.insert(requests, req)
      			return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(cal)
      		local API = "https://api.cal.com/v2"
      		local NULL = json.decode("null")
      		local function last() return requests[#requests] end
      		local function version() return last().headers["cal-api-version"] and last().headers["cal-api-version"][1] end
      		local function rejected(fn, expected)
      			local before = #requests
      			local ok, err = pcall(fn)
      			assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err))
      			assert(#requests == before, "invalid input reached Cal.com")
      		end
      
      		local names = {}
      		for name in cal do if name ~= "help" then table.insert(names, name) end end
      		assert(#names == 44, "wrong read-only surface: " .. #names)
      		for _, name in {"createBooking", "cancelBooking", "rescheduleBooking", "updateMe", "createWebhook", "deleteEventType",
      			"reserveSlot", "replaceBookingFields", "createWorkflow", "requestPhoneVerificationCode", "setDefaultConferencingApp",
      			"listWebhooks", "getWebhook", "listEventTypeWebhooks", "getEventTypeWebhook"} do
      			assert(cal[name] == nil, "read-only leaked " .. name)
      		end
      		assert(cal.calculateRoutingFormSlots, "calculateRoutingFormSlots only reads")
      		assert(#requests == 0, "initialization reached Cal.com")
      
      		payload = '{"status":"success","data":{"id":7,"email":"[email protected]","bio":null}}'
      		local me = cal.getMe()
      		assert(last().method == "GET" and last().url == API .. "/me" and last().body == nil and version() == nil)
      		assert(last().headers.Accept[1] == "application/json")
      		assert(me.data.id == 7 and me.data.bio == NULL)
      
      		payload = '{"status":"success","data":[{"uid":"b1","attendees":[],"location":null}],"pagination":{"hasMore":true,"nextCursor":"c2"}}'
      		local opts = {status = "upcoming", afterStart = "2026-10-14T00:00:00Z", eventTypeIds = "100,200", limit = 20, cursor = "c1"}
      		local page = cal.listBookings(opts)
      		assert(last().url == API .. "/bookings?status=upcoming&eventTypeIds=100%2C200&afterStart=2026-10-14T00%3A00%3A00Z&cursor=c1&limit=20", last().url)
      		assert(version() == "2026-05-01" and opts.limit == 20, "wrong version or modified options")
      		assert(page.pagination.nextCursor == "c2" and json.encode(page.data[1].attendees) == "[]" and page.data[1].location == NULL)
      
      		payload = '{"status":"success","data":[]}'
      		local empty = cal.listTeamBookings({teamId = 3, status = "upcoming,past", take = 50})
      		assert(last().url == API .. "/teams/3/bookings?status=upcoming%2Cpast&take=50" and version() == nil, last().url)
      		assert(json.encode(empty.data) == "[]")
      
      		cal.getBooking({bookingUid = "2NtaeaVcKfpmSZ4CthFdfk"})
      		assert(last().url == API .. "/bookings/2NtaeaVcKfpmSZ4CthFdfk" and version() == "2026-02-25")
      		cal.listBookingAttendees({bookingUid = "b1"})
      		assert(last().url == API .. "/bookings/b1/attendees" and version() == "2024-08-13")
      		cal.getEventType({eventTypeId = 123})
      		assert(last().url == API .. "/event-types/123" and version() == "2026-06-12")
      		cal.listPrivateLinks({eventTypeId = 123})
      		assert(version() == "2024-09-04")
      		cal.getSchedule({scheduleId = 9})
      		assert(last().url == API .. "/schedules/9" and version() == "2024-06-11")
      		cal.listWorkflows({take = 10, skip = 10})
      		assert(last().url == API .. "/workflows?take=10&skip=10" and version() == "2026-09-22")
      
      		payload = '{"status":"success","data":{"2026-10-15":[{"start":"2026-10-15T09:00:00.000+02:00"}]}}'
      		local slots = cal.getSlots({eventTypeId = 123, start = "2026-10-15", ["end"] = "2026-10-22", timeZone = "Europe/Paris"})
      		assert(last().url == API .. "/slots?start=2026-10-15&end=2026-10-22&timeZone=Europe%2FParis&eventTypeId=123", last().url)
      		assert(version() == "2024-09-04" and slots.data["2026-10-15"][1].start == "2026-10-15T09:00:00.000+02:00")
      
      		cal.getBusyTimes({dateFrom = "2026-10-15", dateTo = "2026-10-16", calendar = {"135,[email protected]", "200,[email protected]"}})
      		assert(last().url == API .. "/calendars/busy-times?dateFrom=2026-10-15&dateTo=2026-10-16&calendar=135%2Calice%40example.com&calendar=200%2Cbob%40example.com", last().url)
      
      		cal.calculateRoutingFormSlots({routingFormId = "form-1", start = "2026-10-15", ["end"] = "2026-10-16", answers = {company = "Acme", duration = "30 minutes"}})
      		assert(last().method == "POST" and last().url == API .. "/routing-forms/form-1/calculate-slots?start=2026-10-15&end=2026-10-16")
      		local answers = json.decode(last().body)
      		assert(answers.company == "Acme" and answers.duration == "30 minutes" and answers.start == nil and answers.answers == nil)
      
      		payload = ""
      		local ok, err = pcall(function() cal.getMe() end)
      		assert(not ok and string.find(tostring(err), "invalid JSON object", 1, true), "an empty GET response is not data")
      
      		rejected(function() cal.getBooking() end, "bookingUid must be an ID")
      		rejected(function() cal.getBooking({bookingUid = "../me"}) end, "bookingUid must be an ID")
      		rejected(function() cal.getBooking({bookingUid = ""}) end, "bookingUid must be an ID")
      		rejected(function() cal.getEventType({eventTypeId = 1.5}) end, "nonnegative integer")
      		rejected(function() cal.getEventType({eventTypeId = -1}) end, "nonnegative integer")
      		rejected(function() cal.getSlots({eventTypeId = 123, start = "2026-10-15"}) end, "end is required")
      		rejected(function() cal.getSlots({eventTypeId = 123, start = NULL, ["end"] = "x"}) end, "start is required")
      		rejected(function() cal.listBookings({statuz = "upcoming"}) end, "listBookings has no option statuz")
      		rejected(function() cal.getBusyTimes({dateFrom = "2026-10-15", dateTo = "2026-10-16"}) end, "calendar is required")
      		rejected(function() cal.getBusyTimes({dateFrom = "a", dateTo = "b", calendar = json.decode("[]")}) end, "calendar must not be an empty array")
      		rejected(function() cal.calculateRoutingFormSlots({routingFormId = "f", start = "a", ["end"] = "b"}) end, "answers must be an object")
      		rejected(function() cal.calculateRoutingFormSlots({routingFormId = "f", start = "a", ["end"] = "b", answers = {}, company = "Acme"}) end, "has no option company")
      		rejected(function() cal.listBookings({status = {upcoming = true}}) end, "array, not an object")
      		rejected(function() cal.listBookings({status = {{"upcoming"}}}) end, "must be a string, boolean, number")
      		rejected(function() cal.listBookings("upcoming") end, "opts must be an object")
      		rejected(function() cal.listBookings({"upcoming"}) end, "named fields")
      		assert(#requests == 13)
      	end,
      }
      
    • writes.luau
      return {
      	scenario = {publisher = {}, access = {data = "write"}, config = {}, auth_method = "api_key", auth_config = {token = "cal_live_fixture"}},
      	configure = function()
      		requests = {}
      		payload = '{"status":"success","data":{}}'
      		http = {request = function(req)
      			table.insert(requests, req)
      			return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(cal)
      		local API = "https://api.cal.com/v2"
      		local NULL = json.decode("null")
      		local function last() return requests[#requests] end
      		local function sent() return json.decode(last().body) end
      
      		local count = 0
      		for name in cal do if name ~= "help" then count += 1 end end
      		assert(count == 94, "wrong read-write surface: " .. count)
      
      		payload = '{"status":"success","data":{"uid":"b9","status":"accepted","guests":[],"location":null}}'
      		local booking = cal.createBooking({eventTypeId = 123, start = "2026-10-15T07:00:00Z",
      			attendee = {name = "Ana", email = "[email protected]", timeZone = "Europe/Paris"}, guests = json.decode("[]"), metadata = {source = "agent"}})
      		assert(last().method == "POST" and last().url == API .. "/bookings")
      		assert(last().headers["cal-api-version"][1] == "2026-02-25" and last().headers["Content-Type"][1] == "application/json")
      		local body = sent()
      		assert(body.eventTypeId == 123 and body.attendee.timeZone == "Europe/Paris" and json.encode(body.guests) == "[]")
      		assert(booking.data.uid == "b9" and booking.data.location == NULL)
      
      		cal.cancelBooking({bookingUid = "b9", cancellationReason = "Conflict"})
      		assert(last().url == API .. "/bookings/b9/cancel")
      		body = sent()
      		assert(body.cancellationReason == "Conflict" and body.bookingUid == nil, "path field leaked into the body")
      		cal.confirmBooking({bookingUid = "b9"})
      		assert(last().url == API .. "/bookings/b9/confirm" and last().body == nil and last().headers["Content-Type"] == nil)
      		local ok, err = pcall(function() cal.confirmBooking({bookingUid = "b9", reason = "typo"}) end)
      		assert(not ok and string.find(tostring(err), "confirmBooking has no option reason", 1, true))
      		cal.reassignBooking({bookingUid = "b9"})
      		assert(last().method == "POST" and last().url == API .. "/bookings/b9/reassign" and last().body == nil)
      		cal.reassignBookingToUser({bookingUid = "b9", userId = 42, reason = "Coverage"})
      		assert(last().url == API .. "/bookings/b9/reassign/42" and sent().reason == "Coverage" and sent().userId == nil)
      		cal.updateBookingLocation({bookingUid = "b9", location = {type = "address", address = "1 Main St"}})
      		assert(last().method == "PATCH" and last().headers["cal-api-version"][1] == "2024-08-13" and sent().location.type == "address")
      
      		cal.replaceBookingFields({eventTypeId = 123, bookingFields = json.decode("[]")})
      		assert(last().method == "PUT" and last().url == API .. "/event-types/123/booking-fields" and json.encode(sent().bookingFields) == "[]")
      		cal.deleteBookingField({eventTypeId = 123, slug = "company-size"})
      		assert(last().method == "DELETE" and last().url == API .. "/event-types/123/booking-fields/company-size" and last().body == nil)
      		cal.updateMe({bio = NULL, timeZone = "Europe/Paris"})
      		assert(last().method == "PATCH" and last().url == API .. "/me" and sent().bio == NULL and last().headers["cal-api-version"] == nil)
      		cal.updateSchedule({scheduleId = 9, availability = {{days = {"Monday"}, startTime = "09:00", endTime = "17:00"}}})
      		assert(last().url == API .. "/schedules/9" and sent().availability[1].days[1] == "Monday" and sent().scheduleId == nil)
      		cal.setDefaultConferencingApp({app = "google-meet"})
      		assert(last().method == "POST" and last().url == API .. "/conferencing/google-meet/default" and last().body == nil and last().headers["Content-Type"] == nil)
      		cal.deleteSlotReservation({reservationUid = "e2a7bcf9-cc7b-40a0-80d3-657d391775a6"})
      		assert(last().method == "DELETE" and last().url == API .. "/slots/reservations/e2a7bcf9-cc7b-40a0-80d3-657d391775a6")
      		cal.listWebhooks({take = 10})
      		assert(last().method == "GET" and last().url == API .. "/webhooks?take=10", "read-write connections read webhooks")
      		payload = ""
      		local deleted = cal.deleteWorkflow({workflowId = 5})
      		assert(last().method == "DELETE" and last().url == API .. "/workflows/5" and deleted.status == "success")
      		assert(#requests == 14)
      	end,
      }