
## Booking fields

`GET /v1/bookings/fields`

Returns a description of all booking fields with their types and attributes.

## Examples

### curl — personal key

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

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/bookings/fields" \
  -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/fields', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { success, data } = await res.json()
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bookings/fields', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const { success, data } = await res.json()
```

## Response fields

| Field | Type | RO | Description |
|------|-----|:--:|---------|
| `id` | number | yes | Booking id |
| `name` | string | | Booking name. May be `null` |
| `description` | string | | Booking description. May be `null` |
| `resourceIds` | array | | Ids of the reserved resources. Required on create, the array cannot be empty |
| `datePeriod` | object | | Booking period. Required on create: `from` and `to`, each with `timestamp` in Unix seconds and `timezone` in IANA format |

## Response example

`GET /v1/bookings/fields` returns field descriptions under the `data.fields` key, where each field is `{ type, readonly, label, description }`, and fields required on creation also carry `required: true`. Field names are camelCase, as in API responses. Plus `data.batch` with the list of available batch operations.

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": { "type": "number", "readonly": true, "label": "Booking ID", "description": "Unique booking identifier." },
      "name": { "type": "string", "readonly": false, "label": "Name", "description": "Booking name set by the user." },
      "description": { "type": "string", "readonly": false, "label": "Description", "description": "Text description of the booking with additional details." },
      "resourceIds": { "type": "array", "readonly": false, "required": true, "label": "Resource IDs", "description": "List of identifiers of the resources reserved by this booking." },
      "datePeriod": { "type": "object", "readonly": false, "required": true, "label": "Booking period", "description": "Time interval of the booking with the start and end date and time." }
    },
    "batch": ["create", "update", "delete"]
  }
}
```

## Error response example

403 — missing scope:

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'booking' scope"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 403 | `SCOPE_DENIED` | API key does not have the `booking` scope |
| 401 | `MISSING_API_KEY` | Request sent without the `X-Api-Key` header |
| 401 | `TOKEN_MISSING` | API key has no configured tokens |

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

## See also

- [Bookings](/docs/entities/bookings)
- [Create a booking](/docs/entities/bookings/create)
- [Update a booking](/docs/entities/bookings/update)
