← Public packages
@kentcdodds/cal-com
Cal.com helpers for booking pages, event types, slots, and webhooks.
src/get-available-slots.js
26 lines · 1.4 KB · JavaScriptimport { getAvailableSlots } from './cal-com.js'
/**
* Get bookable Cal.com slots for an event type over a date range.
* Accepts id, slug, or title (`eventTypeId` / `eventTypeSlug` / `name` aliases).
* With no selector, returns the same payload as `list-event-types`.
* @param {Object} [input]
* @param {number|string} [input.eventTypeId] Event type id (`id` accepted as alias).
* Non-numeric strings are treated as slug or title.
* @param {string} [input.eventTypeSlug] Event type slug (`slug` accepted as alias).
* @param {string} [input.start] Range start date.
* @param {string} [input.end] Range end date.
* @param {string} [input.timeZone] IANA timezone for slot formatting.
* @param {boolean} [input.smoke] When true, ignore caller selectors and fetch
* slots for a real catalog event type (or return the list when none exist).
* Use this instead of placeholder ids.
* @returns {Promise<unknown>} Available slots payload, or the event-type list when no selector is given.
* @example
* import getAvailableSlots from 'kody:@kentcdodds/cal-com/get-available-slots'
* const types = await getAvailableSlots()
* const result = await getAvailableSlots({ eventTypeId: types[0].id, start: '2026-06-01', end: '2026-06-08', timeZone: 'America/Denver' })
* // => { slots: { '2026-06-01': [{ time: '...' }] } }
*/
export default async function getAvailableSlotsEntrypoint(input = {}) {
return await getAvailableSlots(input)
}