---
title: "GET /api/availability"
method: GET
path: "/api/availability"
---

# GET /api/availability

`GET /api/availability`

Retrieve availability slots for the given date and office, doctor, or exam room.

If the `exam_room` parameter is not specified, the response will include availability for all exam rooms in the payload, grouped by exam room.

**Example 1: Get availability for a single date**

Request:

```http
GET /api/availability?date=2026-01-29&office=338939&duration=30
```

Response:

```json
{
  "duration": 30,
  "date": "2026-01-29",
  "open_slots": [
    {
      "start": "09:00",
      "end": "17:00",
      "availability": [
        { "start": "09:00", "end": "09:30" },
        { "start": "09:30", "end": "10:00" },
        { "start": "10:00", "end": "10:30" }
      ]
    }
  ],
  "office": 338939
}
```

**Example 2: Get availability for a date range**

Request:

```http
GET /api/availability?date_range=2026-01-29/2026-01-30&office=338939&duration=30
```

Response:

```json
{
  "date_range": ["2026-01-29", "2026-01-30"],
  "duration": 30,
  "office": 338939,
  "dates": [
    {
      "date": "2026-01-29",
      "open_slots": [
        {
          "start": "09:00",
          "end": "17:00",
          "availability": [
            { "start": "09:00", "end": "09:30" },
            { "start": "09:30", "end": "10:00" }
          ]
        }
      ]
    },
    {
      "date": "2026-01-30",
      "open_slots": []
    }
  ]
}
```

**Example: Get availability for a specific exam room**

Request:

```http
GET /api/availability?date=2026-01-29&office=338939&duration=30&exam_room=2
```

Response:

```json
{
  "duration": 30,
  "date": "2026-01-29",
  "open_slots": [
    {
      "start": "09:00",
      "end": "17:00",
      "availability": [
        { "start": "09:00", "end": "09:30" },
        { "start": "09:30", "end": "10:00" },
        { "start": "10:00", "end": "10:30" }
      ]
    }
  ],
  "office": 338939,
  "exam_room": 2
}
```

## Query parameters

- `office` integer — Office ID.
- `doctor` integer — Doctor ID.
- `date` string — Date string.
- `date_range` string — Date range string.
- `duration` integer — Duration in minutes.
- `exam_room` integer — Exam room ID.

## Response `200`

OK

- union
  - object — Availability for a date range
    - `dates` object[]
      - `date` string — Date in YYYY-MM-DD format
      - `open_slots` object[]
        - `start` string — Start time (e.g., "09:00")
        - `end` string — End time (e.g., "17:00")
        - `availability` object[] — List of available slots within the range
          - `start` string — Slot start time (e.g., "09:00")
          - `end` string — Slot end time (e.g., "09:30")
    - `office` integer — Office ID
    - `doctor` integer — Doctor ID
    - `exam_room` integer — Exam room ID
    - `date_range` string[] — Array of two date strings [start, end]
    - `duration` integer — Slot duration in minutes
  - object — Availability for a single date
    - `office` integer — Office ID
    - `doctor` integer — Doctor ID
    - `open_slots` object[]
      - `start` string — Start time (e.g., "09:00")
      - `end` string — End time (e.g., "17:00")
      - `availability` object[] — List of available slots within the range
        - `start` string — Slot start time (e.g., "09:00")
        - `end` string — Slot end time (e.g., "09:30")
    - `exam_room` integer — Exam room ID
    - `duration` integer — Slot duration in minutes
    - `date` string — Date in YYYY-MM-DD format

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Permission Denied
- `404` — Not Found
- `405` — Method Not Allowed
- `500` — Internal Server Error

---

[API](https://skmtc.net/drchrono/apis/untitled-api.md) · [All operations](https://skmtc.net/drchrono/apis/untitled-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/drchrono/untitled-api/versions/e595797fe800/schema)
