## Get resource work hours

`GET /v1/booking-resources/:id/slots`

Returns the work hours of a booking resource — time intervals by day of the week when the resource accepts bookings.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Booking resource ID. List: [`GET /v1/booking-resources`](/docs/entities/booking-resources/list) |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/booking-resources/65/slots" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/booking-resources/65/slots" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-resources/65/slots', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
for (const slot of data.slots) {
  console.log(slot.weekDays.join(', '), `${slot.from}–${slot.to}`, slot.timezone)
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-resources/65/slots', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success |
| `data.slots` | array | Work hour intervals of the resource. For a resource without work hours — an empty array |
| `data.slots[].id` | number | Interval ID. Changes every time the work hours are written |
| `data.slots[].from` | number | Start of the interval in minutes from midnight: `600` is 10:00 |
| `data.slots[].to` | number | End of the interval in minutes from midnight: `1140` is 19:00 |
| `data.slots[].weekDays` | array | Days of the week the interval applies to: `Mon`, `Tue`, `Wed`, `Thu`, `Fri`, `Sat`, `Sun` |
| `data.slots[].slotSize` | number | Length of one booking slot in minutes |
| `data.slots[].timezone` | string | Time zone in which `from` and `to` are set — a name from the IANA time zone database |

## Response example

```json
{
  "success": true,
  "data": {
    "slots": [
      {
        "id": 67,
        "from": 600,
        "to": 1140,
        "weekDays": ["Mon", "Tue", "Wed", "Thu", "Fri"],
        "slotSize": 30,
        "timezone": "Europe/London"
      },
      {
        "id": 69,
        "from": 600,
        "to": 840,
        "weekDays": ["Sat"],
        "slotSize": 60,
        "timezone": "Europe/London"
      }
    ]
  }
}
```

## Error response example

404 — no resource with this `id` exists:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Booking resource not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `ENTITY_NOT_FOUND` | No resource with this `id` exists. Message `Booking resource not found` |
| 400 | `INVALID_PARAMS` | `id` is not a positive integer. Message `id must be a positive safe integer` |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key does not have the `booking` scope |
| 429 | `RATE_LIMITED` | Request rate exceeded. The effective cap is in the `x-ratelimit-limit` header |
| 502 | `BITRIX_RESPONSE_INVALID` | Bitrix24 returned work hours in an unexpected shape. Message `Bitrix24 returned an invalid booking response` |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**The interval `id` is not stable.** Every write of the work hours via [`PUT /v1/booking-resources/:id/slots`](/docs/entities/booking-resources/slots-set) recreates the intervals with new `id` values. Match intervals by days of the week and time, not by `id`.

## See also

- [Resource work hours](/docs/entities/booking-resources/slots)
- [Set resource work hours](/docs/entities/booking-resources/slots-set)
- [Remove resource work hours](/docs/entities/booking-resources/slots-delete)
- [Get a booking resource](/docs/entities/booking-resources/get)
- [List booking resources](/docs/entities/booking-resources/list)
