# Fetch Work Queue Time Slots API V3 Developer Guide

## Overview

The Fetch Work Queue Time Slots API retrieves available time slots for one or more work queues. This guide includes successful single-ID and multiple-ID operations and validation responses for an empty identifier and requests exceeding the 50-identifier limit.

## Base URL

All API calls are sent to:

```
https://api3.sprinklr.com/{env}/api/v3
```

So the Callback resources in production are:

```
https://api3.sprinklr.com/{env}/api/v3/workQueue/timeSlot
```

Replace `{env}` with your assigned environment identifier (`prod0`, `prod2`, `prod11`, etc.).

## Authentication and common headers

API headers include the mandatory information sent with the request URL. They provide the request context and authorisation credentials required to access protected resources.

| Key | Value | Description |
|  --- | --- | --- |
| Authorization | `Bearer {token}` | Credential used by the API to authenticate a user with the server. |
| Key | `api-key` | API key used to authenticate the application with the server. |
| Content-Type | `application/json` | Identifies the media type associated with the request. |
| Accept | `application/json` | Determines the acceptable response type from the server. |


## API operations

# GET - Fetch Time Slots

Use this API to fetch the available time slots configured for a work queue.

## API endpoint

`GET /api/v3/workQueue/timeSlot`

## Query parameters

| Parameter | Required/Optional | Description | Type |
|  --- | --- | --- | --- |
| workQueueId | Required | Unique identifier of the work queue for which time slots are fetched. | String |


## Example request

```bash
curl -X GET \
  'https://api3.sprinklr.com/{env}/api/v3/workQueue/timeSlot?workQueueId={workQueueId}' \
  -H 'Authorization: Bearer {Enter your Access Token}' \
  -H 'Key: {Enter your API KEY}' \
  -H 'Accept: application/json'
```

## Example response

```json
{
  "data": [{
    "workQueueId": "699c3c253fae3c16fc415716",
    "workQueueName": "Test-queue-Vaibhav",
    "slotInformation": [{
      "startTime": 1787224200000,
      "endTime": 1787224800000,
      "available": true,
      "slotConfigId": "698c7d7cf2086c67c941573b",
      "slotDefinitionId": "698b3186d4fc1f5d4a5f884d"
    }]
  }],
  "errors": []
}
```

## Response parameters

| Parameter | Sub-parameter | Description | Type |
|  --- | --- | --- | --- |
| data |  | Contains the work queue time-slot details. | Array<Object> |
|  | workQueueId | Unique identifier of the work queue. | String |
|  | workQueueName | Name of the work queue. | String |
|  | slotInformation | List of time slots configured for the work queue. | Array<Object> |
| slotInformation | startTime | Start time of the time slot in epoch format. | Epoch |
|  | endTime | End time of the time slot in epoch format. | Epoch |
|  | available | Indicates whether the time slot is available. | Boolean |
|  | slotConfigId | Unique identifier of the slot configuration. | String |
|  | slotDefinitionId | Unique identifier of the slot definition. | String |
| errors |  | Contains errors encountered during request processing, if any. | Array |


# GET - Fetch Time Slots: Invalid Work Queue ID

Use this API to fetch available time slots for a work queue. This example shows the validation response returned when `workQueueId` is empty.

## API endpoint

`GET /api/v3/workQueue/timeSlot`

## Query parameters

| Parameter | Required/Optional | Description | Type |
|  --- | --- | --- | --- |
| workQueueId | Required | Work queue identifier. The parameter must contain at least one valid value. | String |


## Example request

```bash
curl -X GET \
  'https://api3.sprinklr.com/{env}/api/v3/workQueue/timeSlot?workQueueId=' \
  -H 'Authorization: Bearer {Enter your Access Token}' \
  -H 'Key: {Enter your API KEY}' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'
```

## Example response

```json
{
  "errors": [{
    "id": "699c3a32440ba77b14af2ad6",
    "code": 400,
    "message": "Invalid 'workQueueId' parameter. Must contain at least one valid value."
  }]
}
```

## Response parameters

| Parameter | Sub-parameter | Description | Type |
|  --- | --- | --- | --- |
| errors |  | Contains request-validation errors. | Array<Object> |
| errors | id | Internal identifier of the error instance. | String |
|  | code | Error code returned for the invalid request. | Integer |
|  | message | Description of the query-parameter validation failure. | String |


> **Developer note:** `workQueueId` is mandatory. If it is empty, the API returns a `400` validation error and no time-slot data.


# GET - Fetch Time Slots: Maximum Identifiers Exceeded

Use this API to fetch available time slots for one or more work queues. This example shows the response when more than 50 identifiers are supplied.

## API endpoint

`GET /api/v3/workQueue/timeSlot`

## Query parameters

| Parameter | Required/Optional | Description | Type |
|  --- | --- | --- | --- |
| workQueueId | Required | Work queue ID or comma-separated IDs. A maximum of 50 identifiers is supported. | String |


## Example request

```bash
curl -X GET \
  'https://api3.sprinklr.com/{env}/api/v3/workQueue/timeSlot?workQueueId=id1,id2,id3,id4,id5,id6,id7,id8,id9,id10,id11,id12,id13,id14,id15,id16,id17,id18,id19,id20,id21,id22,id23,id24,id25,id26,id27,id28,id29,id30,id31,id32,id33,id34,id35,id36,id37,id38,id39,id40,id41,id42,id43,id44,id45,id46,id47,id48,id49,id50,id51' \
  -H 'Authorization: Bearer {Enter your Access Token}' \
  -H 'Key: {Enter your API KEY}' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'
```

## Example response

```json
{
  "errors": [{
    "id": "699c3a19440ba77b14af2ad1",
    "code": 400,
    "message": "Maximum of 50 work_queue_time_slots identifiers supported per request. Provided: 51. Consider splitting you request in batches of 50 identifiers per request"
  }]
}
```

## Response parameters

| Parameter | Sub-parameter | Description | Type |
|  --- | --- | --- | --- |
| errors |  | Contains request-validation errors. | Array<Object> |
| errors | id | Internal identifier of the error instance. | String |
|  | code | Error code returned for the invalid request. | Integer |
|  | message | Description of the identifier-limit validation failure. | String |


> **Developer note:** A request supports up to 50 `workQueueId` values. Split larger lists into batches containing no more than 50 identifiers.


# GET - Fetch Work Queue Time Slots

Use this API to fetch available time slots configured for a work queue.

## API endpoint

`GET /api/v3/workQueue/timeSlot`

## Query parameters

| Parameter | Required/Optional | Description | Type |
|  --- | --- | --- | --- |
| workQueueId | Required | Unique identifier of the work queue for which available time slots are fetched. | String |


## Example request

```bash
curl -X GET \
  'https://api3.sprinklr.com/{env}/api/v3/workQueue/timeSlot?workQueueId={workQueueId}' \
  -H 'Authorization: Bearer {Enter your Access Token}' \
  -H 'Key: {Enter your API KEY}' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'
```

## Example response

```json
{
  "data": [{
    "workQueueId": "698b10b8d4fc1f5d4a4368fb",
    "workQueueName": "Test-queue-Dinesh",
    "slotInformation": [
      {"startTime": 1771847400000, "endTime": 1771848000000, "available": true, "slotConfigId": "698c7d7cf2086c67c941573b", "slotDefinitionId": "698b3186d4fc1f5d4a5f884d"},
      {"startTime": 1771848000000, "endTime": 1771848600000, "available": true, "slotConfigId": "698c7d7cf2086c67c941573b", "slotDefinitionId": "698b3186d4fc1f5d4a5f884d"},
      {"startTime": 1771848600000, "endTime": 1771849200000, "available": true, "slotConfigId": "698c7d7cf2086c67c941573b", "slotDefinitionId": "698b3186d4fc1f5d4a5f884d"},
      {"startTime": 1772450400000, "endTime": 1772451000000, "available": true, "slotConfigId": "698c7d7cf2086c67c941573b", "slotDefinitionId": "698b3186d4fc1f5d4a5f884d"}
    ]
  }],
  "errors": []
}
```

## Response parameters

| Parameter | Sub-parameter | Description | Type |
|  --- | --- | --- | --- |
| data |  | Contains work queue time-slot details. | Array<Object> |
|  | workQueueId | Unique identifier of the work queue. | String |
|  | workQueueName | Name of the work queue. | String |
|  | slotInformation | List of available time slots. | Array<Object> |
| slotInformation | startTime | Start time in epoch milliseconds. | Epoch |
|  | endTime | End time in epoch milliseconds. | Epoch |
|  | available | Indicates whether the slot is available. | Boolean |
|  | slotConfigId | Unique identifier of the slot configuration. | String |
|  | slotDefinitionId | Unique identifier of the slot definition. | String |
| errors |  | Contains processing errors, if any. | Array |


> **Developer note:** Each `slotInformation` object represents one configured time window. Multiple available slots can reference the same configuration and definition IDs.


# GET - Fetch Work Queue Time Slots by Multiple IDs

Use this API to fetch available time slots for multiple work queues using comma-separated identifiers.

## API endpoint

`GET /api/v3/workQueue/timeSlot`

## Query parameters

| Parameter | Required/Optional | Description | Type |
|  --- | --- | --- | --- |
| workQueueId | Required | Comma-separated list of unique work queue identifiers. | String |


## Example request

```bash
curl -X GET \
  'https://api3.sprinklr.com/{env}/api/v3/workQueue/timeSlot?workQueueId={workQueueId1},{workQueueId2}' \
  -H 'Authorization: Bearer {Enter your Access Token}' \
  -H 'Key: {Enter your API KEY}' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'
```

## Example response

```json
{
  "data": [{
    "workQueueId": "698b10b8d4fc1f5d4a4368fb",
    "workQueueName": "Test-queue-Dinesh",
    "slotInformation": [
      {"startTime": 1771848000000, "endTime": 1771848600000, "available": true, "slotConfigId": "698c7d7cf2086c67c941573b", "slotDefinitionId": "698b3186d4fc1f5d4a5f884d"},
      {"startTime": 1772451000000, "endTime": 1772451600000, "available": true, "slotConfigId": "698c7d7cf2086c67c941573b", "slotDefinitionId": "698b3186d4fc1f5d4a5f884d"}
    ]
  }],
  "errors": []
}
```

## Response parameters

| Parameter | Sub-parameter | Description | Type |
|  --- | --- | --- | --- |
| data |  | Contains time-slot details for work queues with matching slot information. | Array<Object> |
|  | workQueueId | Unique identifier of the work queue. | String |
|  | workQueueName | Name of the work queue. | String |
|  | slotInformation | List of available time slots. | Array<Object> |
| slotInformation | startTime | Start time in epoch milliseconds. | Epoch |
|  | endTime | End time in epoch milliseconds. | Epoch |
|  | available | Indicates whether the slot is available. | Boolean |
|  | slotConfigId | Unique identifier of the slot configuration. | String |
|  | slotDefinitionId | Unique identifier of the slot definition. | String |
| errors |  | Contains processing errors, if any. | Array |


> **Developer note:** Multiple IDs can be supplied as a comma-separated list. The response includes only work queues that return time-slot information.


### Use cases

The Fetch Work Queue Time Slots API can be used to retrieve and evaluate available time slots configured for one or more work queues. The following are common use cases.

#### 1. Fetch available time slots for a work queue

Use the **Fetch Work Queue Time Slots** API to retrieve the available time slots configured for a specific work queue.

This is useful when:

- An application needs to display available time slots for a selected work queue.
- A workflow needs to determine which configured time windows are currently available.
- Available slots need to be retrieved before performing a subsequent scheduling operation.
- An application needs the slot configuration and definition identifiers associated with available time windows.


The work queue is identified using its unique `workQueueId`.

**API:** `GET /api/v3/workQueue/timeSlot?workQueueId={workQueueId}`

#### 2. Fetch available time slots for multiple work queues

Use the **Fetch Work Queue Time Slots** API with multiple comma-separated work queue identifiers to retrieve time-slot information for multiple work queues in a single request.

This is useful when:

- An application needs to check availability across multiple work queues.
- A workflow needs to retrieve available time slots from different work queues before selecting a queue.
- Time-slot availability needs to be retrieved in bulk instead of making an individual request for each work queue.


Multiple work queues can be specified as a comma-separated list of `workQueueId` values.

**API:** `GET /api/v3/workQueue/timeSlot?workQueueId={workQueueId1},{workQueueId2}`

#### 3. Determine whether a time slot is available

Use the `available` field in the `slotInformation` response to determine whether a configured time slot is available.

This is useful when:

- An application needs to identify which returned time windows are available.
- Available time slots need to be presented for selection in an application or workflow.
- Downstream processing needs to consider only available time slots.


Each `slotInformation` object provides the `startTime`, `endTime`, `available`, `slotConfigId`, and `slotDefinitionId` associated with the time slot.

#### 4. Retrieve time-slot configuration details

Use the response from the API to obtain the configuration and definition identifiers associated with each returned time slot.

This is useful when:

- A workflow needs to identify the slot configuration associated with an available time window.
- An application needs to retain the `slotConfigId` or `slotDefinitionId` for subsequent processing.
- Multiple time slots need to be associated with their underlying slot configuration and definition.


Multiple available time slots can reference the same `slotConfigId` and `slotDefinitionId`.

#### 5. Validate work queue identifiers before fetching time slots

Ensure that at least one valid `workQueueId` is supplied when requesting time slots.

This is useful when:

- An integration needs to validate input before sending the API request.
- An application needs to handle missing or empty work queue identifiers.
- Error-handling logic needs to identify invalid requests before retrying them.


If `workQueueId` is empty, the API returns a `400` validation error and no time-slot data.

#### 6. Retrieve time slots in batches for large sets of work queues

When time slots need to be retrieved for more than 50 work queues, split the work queue identifiers into multiple requests.

This is useful when:

- An integration needs to retrieve time-slot information for a large number of work queues.
- Bulk processing involves more work queues than can be included in a single request.
- An application needs to avoid validation errors caused by exceeding the supported identifier limit.


A single request supports a maximum of **50 `workQueueId` values**. Larger lists must be divided into batches containing no more than 50 identifiers per request.