# Move a booking to the wait list

`POST /v1/bookings/:id/wait-list`

Moves a booking to the wait list: creates a wait list record with the booking's clients and deletes the booking itself, freeing up the resource's time slot.

## Parameters

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

No request body is needed.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/bookings/49/wait-list" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/bookings/49/wait-list" \
  -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/bookings/49/wait-list', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
console.log('Wait list record ID:', data.id)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bookings/49/wait-list', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
console.log('Wait list record ID:', data.id)
```

## Response fields

On success, the HTTP status is `201 Created` and the response contains the new wait list record.

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success |
| `data.id` | number | Identifier of the new wait list record. The record's clients are returned by [`GET /v1/booking-wait-list/:id/clients`](/docs/entities/booking-wait-list/clients) |
| `data.note` | string \| null | Note on the record. `null` — no note |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 33,
    "note": "Call back after 16:00"
  }
}
```

## Error response example

404 — there is no booking with this `id`, for example because it has already been moved to the wait list:

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

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `ENTITY_NOT_FOUND` | There is no booking with this `id`, including one already moved to the wait list. Message `Booking record not found` |
| 400 | `INVALID_PARAMS` | `id` is not a positive integer. Message `id must be a canonical positive safe integer` |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is not passed |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key does not have the `booking` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 429 | `RATE_LIMITED` | Request rate exceeded. The effective cap is in the `x-ratelimit-limit` header |
| 502 | `BITRIX_RESPONSE_INVALID` | Bitrix24 returned a response of an unexpected shape. If this happened while re-reading the record after the move, the booking has already been deleted and the wait list record created — find it in the [list of wait list records](/docs/entities/booking-wait-list/list) before retrying |

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

## Known specifics

**The wait list record is created anew.** The new record has its own `id`. If the booking was created [from the wait list](/docs/entities/booking-wait-list/booking), the new record gets the previous note.

## See also

- [Book from the wait list](/docs/entities/booking-wait-list/booking)
- [Booking wait list](/docs/entities/booking-wait-list)
- [Get a booking](/docs/entities/bookings/get)
- [Booking clients](/docs/entities/bookings/clients)
- [Errors](/docs/errors)
