getFreeBusy

Returns busy blocks for one or more calendars of one provider.

Use getFreeBusy when you need to know when someone is busy, not what their events are.

import { getFreeBusy } from '@cal-sdk/core';

const { calendars } = await getFreeBusy({
  calendar,
  calendarIds: ['primary', 'team@example.com'],
  timeMin: new Date(),
  timeMax: new Date(Date.now() + 7 * 86_400_000),
});

Google answers from its free/busy endpoint. Other providers are read from their events instead, with a compatibility warning: Find free time covers how the busy times are worked out.

Options

timeMinDate | string
timeMaxDate | string
calendarIds?string[]= ['primary']

Plus the common options.

Result

calendarsRecord<string, { busy: BusyBlock[]; error?: string }>
Keyed by requested calendar id. busy is merged, sorted and clipped to the window. error is set when that calendar could not be read.
warningsWarning[]

A BusyBlock is { start: string; end: string }, ISO 8601 instants with end exclusive.

On this page