> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rxscale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Waiting Room

> Manage waiting room registrations via the Management API

# Waiting Room

Register patients for the virtual waiting room, check their queue status, and cancel registrations.

## Register Patient

Register a patient for the waiting room in a specific shop.

```bash theme={null}
POST /v1/management/waiting-room/register
```

**Required permission:** `waiting_room:write`

### Request Body

```json theme={null}
{
  "shop_uid": "shop-abc123",
  "patient_profile_uid": "pp-xyz789",
  "preferred_doctor_uid": "doc-456",
  "visit_reason": "Follow-up consultation"
}
```

| Field                  | Type   | Required | Description                               |
| ---------------------- | ------ | -------- | ----------------------------------------- |
| `shop_uid`             | string | Yes      | Shop UID where the patient is registering |
| `patient_profile_uid`  | string | Yes      | Patient profile UID                       |
| `preferred_doctor_uid` | string | No       | Preferred doctor UID                      |
| `visit_reason`         | string | No       | Reason for the visit                      |

### Example Request

```bash theme={null}
curl -X POST "https://api.rxscale.com/v1/management/waiting-room/register" \
  -H "X-API-Key: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "shop_uid": "shop-abc123",
    "patient_profile_uid": "pp-xyz789",
    "preferred_doctor_uid": "doc-456",
    "visit_reason": "Follow-up consultation"
  }'
```

### Response (201 Created)

```json theme={null}
{
  "queue_uid": "q-abc123",
  "position": 3,
  "estimated_wait_minutes": 15
}
```

## Check Queue Status

Get the current status of a queue entry, including position and estimated wait time.

```bash theme={null}
GET /v1/management/waiting-room/{queue_uid}/status
```

<ParamField path="queue_uid" type="string" required>
  The queue entry UID
</ParamField>

**Required permission:** `waiting_room:read`

### Example Request

```bash theme={null}
curl -X GET "https://api.rxscale.com/v1/management/waiting-room/q-abc123/status" \
  -H "X-API-Key: your-api-key-here"
```

### Response

```json theme={null}
{
  "queue_uid": "q-abc123",
  "status": "waiting",
  "position": 2,
  "estimated_wait_minutes": 10,
  "video_room_id": null,
  "allocated_at": null
}
```

### Status Values

| Status      | Description                            |
| ----------- | -------------------------------------- |
| `waiting`   | Patient is waiting in the queue        |
| `allocated` | Patient has been allocated to a doctor |
| `completed` | Consultation has been completed        |
| `cancelled` | Registration was cancelled             |

When a patient is allocated, `video_room_id` and `allocated_at` will be populated.

## Cancel Registration

Cancel a queue registration.

```bash theme={null}
DELETE /v1/management/waiting-room/{queue_uid}
```

<ParamField path="queue_uid" type="string" required>
  The queue entry UID to cancel
</ParamField>

**Required permission:** `waiting_room:write`

### Example Request

```bash theme={null}
curl -X DELETE "https://api.rxscale.com/v1/management/waiting-room/q-abc123" \
  -H "X-API-Key: your-api-key-here"
```

### Response

```json theme={null}
{
  "message": "Registration cancelled"
}
```
