# Book from the wait list

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

Creates a booking from a wait list record: the record's clients move to the new booking, and the record itself is removed from the wait list.

Fields go at the root of the JSON, without a `fields` wrapper. Messages to the client about the booking depend on the `is*NotificationOn` switches of the [booking resource](/docs/entities/booking-resources/get).

## Parameters

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

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `resourceIds` | number[] | yes | Identifiers of the resources the booking reserves. The array cannot be empty. List: [`GET /v1/booking-resources`](/docs/entities/booking-resources/list) |
| `datePeriod.from.timestamp` | number | yes | Booking start, Unix time in seconds |
| `datePeriod.from.timezone` | string | yes | Time zone of the start in IANA format, e.g. `UTC` |
| `datePeriod.to.timestamp` | number | yes | Booking end, Unix time in seconds. Must be later than the start |
| `datePeriod.to.timezone` | string | yes | Time zone of the end in IANA format |

The body accepts no other fields. The booking name and description are set by [updating the booking](/docs/entities/bookings/update).

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/booking-wait-list/27/booking" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceIds": [49],
    "datePeriod": {
      "from": { "timestamp": 1795158000, "timezone": "UTC" },
      "to": { "timestamp": 1795161600, "timezone": "UTC" }
    }
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/booking-wait-list/27/booking" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceIds": [49],
    "datePeriod": {
      "from": { "timestamp": 1795158000, "timezone": "UTC" },
      "to": { "timestamp": 1795161600, "timezone": "UTC" }
    }
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-wait-list/27/booking', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    resourceIds: [49],
    datePeriod: {
      from: { timestamp: 1795158000, timezone: 'UTC' },
      to: { timestamp: 1795161600, timezone: 'UTC' },
    },
  }),
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-wait-list/27/booking', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    resourceIds: [49],
    datePeriod: {
      from: { timestamp: 1795158000, timezone: 'UTC' },
      to: { timestamp: 1795161600, timezone: 'UTC' },
    },
  }),
})

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

## Response fields

On success, the HTTP status is `201 Created` and the response contains the card of the new booking — the same as [`GET /v1/bookings/:id`](/docs/entities/bookings/get) returns.

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success |
| `data.id` | number | Booking identifier. The booking's clients are returned by [`GET /v1/bookings/:id/clients`](/docs/entities/bookings/clients) |
| `data.name` | string \| null | Booking name |
| `data.description` | string \| null | Booking description |
| `data.resourceIds` | number[] | Identifiers of the reserved resources |
| `data.datePeriod` | object | Booking period: `from` and `to` are ISO 8601 date-time strings |

## Response example

```json
{
  "success": true,
  "data": {
    "datePeriod": {
      "from": "2026-11-20T07:00:00+00:00",
      "to": "2026-11-20T08:00:00+00:00"
    },
    "description": null,
    "id": 49,
    "name": null,
    "resourceIds": [
      49
    ]
  }
}
```

## Error response example

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

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

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `ENTITY_NOT_FOUND` | There is no wait list record with this `id`, including one already moved to a booking. Message `Booking record not found` |
| 400 | `MISSING_REQUIRED_FIELDS` | `resourceIds` or `datePeriod` is missing, or `resourceIds` is an empty array. Message `resourceIds and datePeriod are required` |
| 400 | `INVALID_PARAMS` | The body contains a field other than `resourceIds` and `datePeriod`. Message `Only resourceIds and datePeriod can be written` |
| 400 | `INVALID_PARAMS` | `resourceIds` contains a value that is not a positive integer. Message `resourceIds must contain positive integers` |
| 400 | `INVALID_PARAMS` | `from` or `to` has no `timestamp` or `timezone`. Message `datePeriod requires from/to with a finite timestamp and timezone` |
| 400 | `INVALID_PARAMS` | The time zone is not in IANA format. Message `timezone must be an IANA timezone` |
| 400 | `INVALID_PARAMS` | The body is not a JSON object. Message `Body must contain resourceIds and datePeriod` |
| 400 | `INVALID_PARAMS` | `id` is not a positive integer. Message `id must be a canonical positive safe integer` |
| 422 | `BITRIX_ERROR` | A resource from `resourceIds` does not exist. Message `Some resources were not found` with the resource IDs, `b24Code` `1038` |
| 422 | `BITRIX_ERROR` | The booking end is earlier than the start. Message `Invalid date period` |
| 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 booking after creation, the booking has already been created and the record removed from the wait list — find the booking in the [list of bookings](/docs/entities/bookings/list) before retrying |

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

## Known specifics

**A rejected request does not remove the record.** On a `400` or `422` response, the record stays in the wait list, and the move can be retried.

**The booking card does not return the note.** The record's note moves to the booking, but the booking card has no field for it, and `description` stays `null`. When the [booking is moved back to the wait list](/docs/entities/bookings/wait-list), the note returns to the new wait list record.

## See also

- [Move a booking to the wait list](/docs/entities/bookings/wait-list)
- [Wait list clients](/docs/entities/booking-wait-list/clients)
- [Get a booking](/docs/entities/bookings/get)
- [List booking resources](/docs/entities/booking-resources/list)
- [Errors](/docs/errors)
