createEvent

Creates an event or a recurring series and returns it as the provider stored it.

Keep the returned id for later updates, and check warnings for anything the provider changed or ignored, such as the title Cal.com replaces with its event type's name.

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

const { event } = await createEvent({
  calendar,
  event: {
    title: 'Design review',
    start: { dateTime: '2026-11-03T10:00:00', timeZone: 'Asia/Kolkata' },
    end: { dateTime: '2026-11-03T10:30:00', timeZone: 'Asia/Kolkata' },
  },
});

Options

eventEventInput
The event to create. See below.
calendarId?string= 'primary'
sendUpdates?'all' | 'externalOnly' | 'none'
Whether attendees get an invitation. The provider default when left out.

Plus the common options. Only rate limits are retried: retrying after a server error could create the event twice.

EventInput

startEventTime
{ dateTime, timeZone } or { date }. A dateTime without an offset is wall-clock time in timeZone.
endEventTime
The same form as start. All-day end dates are exclusive.
title?string
description?string
location?string
recurrence?string[]
RFC 5545 lines, such as ['RRULE:FREQ=WEEKLY;BYDAY=MO;COUNT=10'].
showAs?'busy' | 'free'= 'busy'
visibility?'default' | 'public' | 'private'
attendees?{ email: string; name?: string; optional?: boolean }[]
createConference?boolean
Ask the provider for a video link: Meet on Google, Teams on Outlook.
reminders?{ useDefault: boolean; overrides?: { method: 'popup' | 'email'; minutesBefore: number }[] }
color?string
Hex color, '#RRGGBB'. Providers with a fixed palette pick the nearest and warn.

Result

eventCalendarEvent
The stored event, with its id, and an etag where the provider has one.
warningsWarning[]
Fields the provider ignored or changed.

Throws

  • InvalidArgumentError when end is not after start, start and end mix timed and all-day, the time zone is unknown or a Windows name, a recurrence line is malformed, or a color or email is invalid.
  • UnsupportedFunctionalityError when the provider cannot store the event as given, such as a rule Outlook cannot repeat or an all-day Zoom meeting.

On this page