createSession( )


Creates a session.

The createSession() function returns a Promise that resolves when a session is created.

A session is one of the following:

  • "EVENT": Reserved period of time on any schedule. For example, an appointment, class, or course. Events are visible in the Dashboard in the Bookings app's Booking Calendar page. Set type to "EVENT" when creating sessions that reserve time on a service's schedule, or when creating a blocked time for a resource.
  • "WORKING_HOURS": Placeholder for available time on a resource’s schedule. Set type to "WORKING_HOURS" when creating sessions for resource availability.

Sessions belong to a schedule. Schedules are owned by a resource or a service.

A session may be an individual session or a recurring session. An individual session has a discrete start and end date, while a recurring session defines a series of repeating sessions. An instance of a recurring session is a specific session in a series of repeating sessions, generated according to the recurrence rule. The start and end properties set the time and duration of the session. For non-recurring sessions, you can use either the timestamp or localDateTime properties. For recurring sessions, use the localDateTime property only. For recurring sessions, the start property sets the date and time of the first recurring session, subject to the recurrence rule. For example, if you set the start to Saturday, May 1 and your recurrence rule says every second Monday, then the first session will only be on Monday, May 10.

The year, monthOfYear and dayOfMonth properties in the end property are used with the hourOfDay and minutesOfHour properties to set the duration of each session relative to the start. The UNTIL keyword in the recurrence property sets the date for the last recurring session.

You can create a session that blocks hours on the resource's calendar, making the resource unavailable. Create a non-recurring session of type "EVENT", and add "Blocked" to the tags array.

Notes:

  • For properties where there is no explicit timezone information, the timezone used is the business’s timezone.
  • Only users with Bookings Admin permissions can create a session. You can override the permissions by setting the suppressAuth option to true.

Permissions

This endpoint requires the Manage Bookings permissions scope

Method Declaration
Copy
Method Parameters
sessionInfoSessionInfoRequired

Information to use when creating a session..


optionsOptions

An object representing the available options for creating a session.

Returns
Return Type:Promise<Session>
Did this help?