# Calendar Search

The Calendar Search Data Operation is used to look up calendar appointments to find an available time slot in a calendar created in Airkit's Schedules Builder. It can be used to identify the next available time slot for a calendar.&#x20;

\#Use Cases

* Return the next available time slot of a specific calendar and automatically assign the time slot to a user
* Check to see if user is currently within business operating hours using the "Skip" restriction, and display a scheduler or allow user to call directly into the contact center
* Return the most recently available time slot of a calendar using the "Run in Previous Window" restriction

\#Data Operation Properties

### Availability Schedule

This is the base calendar that the Data Operation performs a search on. The Calendar is a dropdown of available calendars to your app.

### Restriction

* None
  * Returns an available time slot if the **Time** is within the bounding time boxes of the calendar and within the **Search Window.** If the Time is outside of the bounding time boxes of the calendar, then returns null.
* Run in next window
  * Returns the next available time slot from the given **Time** and in the specified **Search Window**.
* Skip
  * Returns an available time slot if the **Time** is within the bounding time boxes of the calendar and within the \*\*Search Window.\*\*If the Time is outside of the bounding time boxes of the calendar, then returns null.
* Run in previous window
  * Returns the most recent available time slot in the past from the given **Time** and in the specified **Search Window**.

### Time

Expects type `DateTime`.

The DateTime in which the calendar search data operations starts from. This is required in order to use the calendar search data operation.

### Search Window

Expects type `number`.

The amount of time into the future and into the past to search for that the next available appointment time slot. **Search Window** expects an integer in milliseconds.&#x20;

## Run Results

If an available time slot is found, the Data Operation returns the start DateTime, end DateTime, and booking information. If no available time slot is found (using the Skip or None restriction), the Data Operation returns null.
