# Get availability

> **GET** `https://api.us.nylas.com/v3/scheduling/availability`

Source: https://developer.nylas.com/docs/reference/api/availability/get-availability/

Gets available time slots within the given time range, using the rules defined in the specified
Configuration object. If the Configuration `type` is `group`, Nylas returns only valid group events
within the time range, including recurring events.

Nylas validates the provided session ID and uses it to retrieve the related
[Configuration object](/docs/reference/api/configurations/). If you created a public
Configuration, you don't need to include the `Authorization` request header with a session ID, but
you do need to pass the Configuration object ID as a query parameter.

**Authentication:** SCHEDULER_SESSION_TOKEN

## Parameters

### Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `start_time` | string | Yes | The time from which to check availability, in seconds using the Unix timestamp format. |
| `end_time` | string | Yes | The time until which to check availability, in seconds using the Unix timestamp format. |
| `configuration_id` | string | No | The ID of the Configuration object used for calculating availability. If you're using session authentication (`requires_session_auth: true`), the `configuration_id` isn't required. |
| `slug` | string | No | The Configuration object slug. You can use this with the `client_id` instead of using the `configuration_id`. If you're using session authentication (`requires_session_auth: true`) or using the `configuration_id`, `slug` isn't required. |
| `client_id` | string | No | The client ID that was used to create the Configuration object. Required only if you're using `slug`. |
| `booking_id` | string | No | The ID of the booking to reschedule, if you're checking availability to reschedule a round-robin booking. Required only if `availability_method` is `max-fairness` or `max-availability`. See [Retrieve booking IDs](/docs/v3/scheduler/retrieve-booking-ids/) for more information. |

## Responses

### 200 - Return availability

- `request_id` (string) - The request ID.
- `data` (object) - The response to a successful request to get availability for a participant.
  - `order` (array) - (Round-robin events only) The order of participants in line to attend the proposed meeting.
  - `time_slots` (array,null) - An array of the available time slots when you can create a meeting using the requested settings.
This field may be `null` if no time slots are available. Treat `null` the same as an empty array.

### 400 - Bad Request

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 404 - Not Found

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The raw error from the provider, if available
    - `code` (string)
    - `message` (string)

### 429 - Rate Limit

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 504 - Provider Failure

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL (Public)

```bash
curl --compressed --request GET \
  --url 'https://api.us.nylas.com/v3/scheduling/availability?start_time=1709643600&end_time=1709665200&configuration_id=<SCHEDULER_CONFIG_ID>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json'
```

### cURL (Private)

```bash
curl --compressed --request GET \
  --url 'https://api.us.nylas.com/v3/scheduling/availability?start_time=1709643600&end_time=1709665200' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <SCHEDULER_SESSION_ID>' \
  --header 'Content-Type: application/json' 
```

### Node.js SDK

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
});

async function getAvailability() {
  try {
    const availability = await nylas.scheduler.availability.get({
      queryParams: {
        configurationId: "<CONFIGURATION_ID>",
        startTime: 1748908800,
        endTime: 1748995200,
      },
    });

    console.log("Availability:", availability);
  } catch (error) {
    console.error("Error getting availability:", error);
  }
}

getAvailability();

```
