1.0.1
Authentication for the Turbo Scheduler API
All API requests require authentication using your API key. There are two ways to authenticate:
Important: Unless otherwise specified, if no timezone is provided in API requests, the system defaults to "America/New_York" (Eastern Time).
Direct API Usage
For direct API calls, include your API key in the request headers.
Add the following header to all API requests:
x-api-key: YOUR_API_KEY_HERE
Note: Do not include "Bearer" or any other prefix. Use the API key directly as the header value.
curl -X GET "https://your-api-endpoint.com/getAccount" \
-H "x-api-key: your_actual_api_key_here" \
-H "Content-Type: application/json"
Using the Turbo Scheduler SDK
When using the SDK, authentication is handled automatically after initialization.
Initialize the SDK with your API key:
const turbo = new TurboApiClient({
apiKey: 'your_actual_api_key_here',
// baseUrl: 'http://localhost:3001' // Optional: For local development
});
Once initialized, all SDK method calls will automatically include the proper authentication headers.
// Get account information
const account = await turbo.account.getAccount();
// Add a new user
const newUser = await turbo.user.addUser({
id: 'user-123',
name: 'John Doe'
});
/account
CRUD actions for accounts. An "account" is the ownership entity that all users belong to.
/user
CRUD actions for users. A "user" is any entity that will have it's own scheduling.
/getUserByAccountId
GET
Returns all users associated with the account id present in the request header.
Array
: An array of User objects containing the details of each user.
/updateUser
PUT
Updates the name and/or time zone for an existing user.
(Object)
The JSON request body
Name | Description |
---|---|
body.name
string?
|
The new name for the user. |
body.timeZone TimeZone?
|
The new time zone for the user. (ALASKA, CENTRAL, EASTERN, HAWAII, MOUNTAIN, MOUNTAIN_NO_DST, PACIFIC). Default: If no timezone is provided, the system defaults to "America/New_York" (Eastern Time). |
Object
: The updated User.
/recurringAvailability
CRUD actions for recurring availability entries.
/addRecurringAvailability
POST
Adds a RecurringAvailability entry for the given user.
(Object)
The JSON request body
Name | Description |
---|---|
body.userId
string
|
The user id to add the availability exception for. |
body.daysOfWeek
Array<string>
|
An array of days of the week (all caps) that this availability should occur on. Example: ["MONDAY", "TUESDAY", "FRIDAY"]. Valid values: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. |
body.startTime
Date
|
The start time during the day for this availability. This is a DateTime but the date doesn't matter. Only the time itself will be used in calculations. |
body.endTime
Date
|
The end time during the day for this availability. This is a DateTime but the date doesn't matter. Only the time itself will be used in calculations. |
body.expiration
Date
|
The expiration date for this recurring availability. If expiration is left null, this recurring availability is considered infinite, meaning that it will be considered a valid form of availability until it is deleted, or until an expiration date is set and reached. |
Object
: The newly created RecurringAvailability.
/updateRecurringAvailability
PUT
Updates a RecurringAvailability entry for the given user.
(Object)
The JSON request body
Name | Description |
---|---|
body.id
string
|
The id of the RecurringAvailability entry that is being updated. |
body.userId
string
|
The user id to add the recurring availability exception for. |
body.daysOfWeek
Array<string>?
|
An array of days of the week (all caps) that this recurring availability should occur on. Example: ["MONDAY", "TUESDAY", "FRIDAY"]. Valid values: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. |
body.startTime
Date?
|
The start time during the day for this recurring availability. This is a DateTime but the date doesn't matter. Only the time itself will be used in calculations. |
body.endTime
Date?
|
The end time during the day for this recurring availability. This is a DateTime but the date doesn't matter. Only the time itself will be used in calculations. |
body.expiration
Date?
|
The new expiration date for this recurring availability. |
body.makeInfinite
Boolean?
|
This recurring availability's expiration date will be set to null, making it infinite, if this parameter is set to true. |
Array<Object>
: The updated RecurringAvailability.
/booking
CRUD actions for booking entries.
/getBookingsByIds
POST
Returns the bookings associated with the passed in booking ids.
Even though this endpoint is fetching data and should, technically, be a GET, most consumers are not accustomed to sending a body in a GET request. The http spec allows for it but to ensure that users expect to add a body, we are setting this endpoint as a POST. (for now)
Array<Object>
: An array of objects with each containing an "id", "start", and "end".
/addBooking
POST
Adds a Booking entry for the given user.
(Object)
The JSON request body
Name | Description |
---|---|
body.users
Array<string>
|
An array of user ids associated with this booking. |
body.start
Date
|
The start time for the booking. |
body.end
Date
|
The end time for the booking. |
body.allowDoubleBooking
boolean
|
(optional = defaults to false) Whether or not to allow double bookings in this request. |
Object
: The newly created Booking.
/availabilityExceptions
CRUD actions for availability exceptions.
/addAvailabilityException
POST
Adds an AvailabilityException entry for the given user.
Object
: The newly created AvailabilityException.
/addRecurringAvailabilityException
POST
Adds an AvailabilityException entry for the given user.
(Object)
The JSON request body
Name | Description |
---|---|
body.userId
string
|
The user id to add the availability exception for. |
body.start
Date
|
The start DateTime to add the availability exception for. |
body.end
Date
|
The end DateTime to add the availability exception up to. |
body.numberOfWeeks
number
|
The number of weeks that this availability exception should recurr for. |
Array<Object>
: The newly created AvailabilityExceptions.
/updateAvailabilityException
PUT
Updates an AvailabilityException entry for the given user.
(Object)
The JSON request body
Name | Description |
---|---|
body.userId
string
|
The user id to add the availability for. |
body.start
Date
|
The start DateTime to add the availability for. |
body.end
Date
|
The end DateTime to add the availability up to. |
body.availabilityExceptionId
string
|
The id of the existing AvailabilityException that we are updating. |
Array<Object>
: The updated AvailabilityException.
/availability
CRUD actions for one-off availability entries. Also contains the routes used for getting calculated availability.
/getAvailability
GET
Returns the calculated availability for the passed in user. One off availability and recurring availability are pulled and combined. If the query param "includeExceptions" is "true", then the computed availability is compared with any availability exceptions and bookings to calculate the user's true availability for the given dates.
Array<Object>
: An array of objects with each containing a "start" and "end" DateTime. Each of these objects
represents a chunk of continuous availability.
/getMultiUserCalculatedAvailability
POST
Returns the calculated availability for the passed in users. Similar functionality to the /getAvailability endpoint except this supports multiple users and always includes exceptions/bookings.
Even though this endpoint is fetching data and should, technically, be a GET, most consumers are not accustomed to sending a body in a GET request. The http spec allows for it but to ensure that users expect to add a body, we are setting this endpoint as a POST. (for now)
Array<Object>
: An array of objects with each containing a "userId" and "availability" field. The "availability"
value is an object containing a "start" and "end" DateTime. Each of these availability objects
represents a chunk of continuous availability for that user.
/getRecurringAvailabilityByDate
POST
Beginning with the startDate, checks calculated availability for the passed in userId. Then, this uses the cadence, frequency, and numberOfOccurrences to look ahead and see what calculated availability the user has in the future.
Even though this endpoint is fetching data and should, technically, be a GET, most consumers are not accustomed to sending a body in a GET request. The http spec allows for it but to ensure that users expect to add a body, we are setting this endpoint as a POST. (for now)
(Object)
The JSON request body
Name | Description |
---|---|
body.userId
string
|
The id of the user to check. |
body.startDate
Date
|
The start date to check from. |
body.cadence
string
|
"DAILY" or "WEEKLY" |
body.frequency
number
|
How often the cadence occurs. Example: If the above cadence is "WEEKLY" and the "frequency" is 2, then this will check for every other week. If the frequency was a 1, it would check every week. |
body.numberOfOccurrences
number
|
How many times the cadence/frequency should be checked. |
Array<Object>
: An array of arrays with each secondary array representing a day that was checked according to the
frequency and cadence passed in. Each of these secondary arrays contains objects that have a "start"
and "end" DateTime. Each of these availability objects represents a chunk of continuous availability
for that user.
/getMatchingAvailabilityByDate
POST
Beginning with the startDate, checks calculated availability for all passed in userIds. It will only return available time where all userIds are available. Will return time from the startDate up through the endDate. If no endDate is passed in, will only check the full day of the startDate.
Even though this endpoint is fetching data and should, technically, be a GET, most consumers are not accustomed to sending a body in a GET request. The http spec allows for it but to ensure that users expect to add a body, we are setting this endpoint as a POST. (for now)
Array<Object>
: An array of objects that have a "start" and "end" DateTime. Each of these availability objects
represents a chunk of continuous availability for all passed in users.
/updateAvailability
PUT
Updates an Availability entry for the given user.
(Object)
The JSON request body
Name | Description |
---|---|
body.userId
string
|
The user id to update the availability for. |
body.start
Date
|
The start DateTime to update the availability for. |
body.end
Date
|
The end DateTime to update the availability up to. |
body.availabilityId
string
|
The id of the existing Availability that we are updating. |
Array<Object>
: The updated Availability.