Skip to content
← Public packages

@kentcdodds/cal-com

Cal.com helpers for booking pages, event types, slots, and webhooks.

src/create-booking.js

19 lines · 995 B · JavaScript
import { createBooking } from './cal-com.js'

/**
 * Create a Cal.com booking for an event type and attendee.
 * @param {Object} input
 * @param {number|string} input.eventTypeId Event type to book.
 * @param {string} input.start UTC ISO start time.
 * @param {{ name: string, email: string, timeZone?: string }} input.attendee Attendee details. `timeZone` defaults to UTC when omitted.
 * @returns {Promise<Record<string, unknown>>} Created booking payload.
 * @example
 * import listEventTypes from 'kody:@kentcdodds/cal-com/list-event-types'
 * import createBooking from 'kody:@kentcdodds/cal-com/create-booking'
 * const types = await listEventTypes()
 * const result = await createBooking({ eventTypeId: types[0].id, start: '2026-06-01T16:00:00Z', attendee: { name: 'Ada', email: 'ada@example.com', timeZone: 'America/Denver' } })
 * // => { uid: '...', status: 'accepted', ... }
 */
export default async function createBookingEntrypoint(input = {}) {
  return await createBooking(input)
}