Para agentes de IA: markdown desta página — /docs-content-en/entities/booking-resources.md índice da documentação — /llms.txt

Os artigos da documentação estão disponíveis atualmente em inglês.

Booking resources

GET /v1/booking-resources

Returns the booking resources available to the key. This is the only way to learn the values for the mandatory resourceIds field when creating a booking — start here if you are creating your first booking.

The method returns the whole catalog at once and accepts no pagination parameters: meta.total always equals the length of data, and meta.hasMore is always false.

Parameters

Parameter Type Req. Default Description
typeId (query) number no Keep only resources of one type. A positive integer in canonical form
searchQuery (query) string no Bitrix24 substring search. A non-empty string of at most 200 characters

The parameters may be combined. Any other parameter, a repeated parameter, or an array- or object-shaped form (typeId[], filter[typeId]) is rejected with 400 INVALID_PARAMS before Bitrix24 is contacted.

Sorting is deliberately not exposed: the walk always goes by ascending id, and a caller-controlled order would break the completeness guarantee of the response.

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/booking-resources?typeId=1" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/booking-resources?typeId=1" \
  -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/booking-resources?typeId=1', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { data, meta } = await res.json()
console.log(`Resources available: ${meta.total}`)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-resources?typeId=1', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data, meta } = await res.json()
console.log(`Resources available: ${meta.total}`)

From the resource list to a booking, in one scenario:

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/booking-resources?searchQuery=meeting', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { data } = await res.json()
console.log(`Resources available: ${data.length}`)

const room = data.find(r => r.isMain === 'Y') ?? data[0]

await fetch('https://vibecode.bitrix24.com/v1/bookings', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    resourceIds: [room.id],
    datePeriod: {
      from: { timestamp: 1723446900, timezone: 'Europe/Berlin' },
      to: { timestamp: 1723447800, timezone: 'Europe/Berlin' },
    },
  }),
})

Response fields

Field Type Description
success boolean Always true on success
data[].id number Resource identifier. This is the value that goes into a booking's resourceIds
data[].name string Resource name
data[].typeId number Resource type identifier. The same value the typeId filter accepts
data[].isMain string The main-resource flag of the Bitrix24 record: "Y" or "N"
meta.total number Number of returned records. Always equals the length of data
meta.hasMore boolean Always false — a successful response holds the whole catalog within the cap

The description field is withheld deliberately: it is free-form text from the Bitrix24 account that may contain personal data and internal notes, and it is not needed to pick a resource. Notification and template settings are not returned either.

The response carries the Cache-Control: private, no-store header — the content is bound to the Bitrix24 account and to the identity of the key.

Response example

JSON
{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Meeting room for 6",
      "typeId": 1,
      "isMain": "Y"
    },
    {
      "id": 3,
      "name": "Meeting room with a projector",
      "typeId": 1,
      "isMain": "N"
    }
  ],
  "meta": {
    "total": 2,
    "hasMore": false
  }
}

Error response example

400 — an unknown parameter was passed:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Only typeId and searchQuery are supported query parameters."
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS An unknown, repeated, array-shaped or malformed query parameter. The same code arrives when Bitrix24 itself rejected the filters
401 MISSING_API_KEY The X-Api-Key header was not sent
401 TOKEN_MISSING The key has no Bitrix24 tokens configured
403 SCOPE_DENIED The key does not have the booking scope
403 BITRIX_ACCESS_DENIED Bitrix24 denied access
403 B24_TARIFF_RESTRICTION The Bitrix24 plan does not include booking resources
422 BITRIX_METHOD_NOT_FOUND The booking module is unavailable on the portal
422 BITRIX_ERROR Bitrix24 rejected the request
429 RATE_LIMITED The limit of 20 requests per minute per portal for this endpoint was exceeded, or the request rate limit to Bitrix24 was hit. See Retry-After
429 OPERATION_TIME_LIMIT The Bitrix24 operation-time limit was exceeded
429 QUEUE_OVERFLOW The portal's Bitrix24 queue is full and the request was refused immediately. See Retry-After
429 QUEUE_TIMEOUT The request waited in the Bitrix24 queue past its timeout. See Retry-After
502 BITRIX_RESPONSE_INVALID Bitrix24 returned a response of an unexpected shape
502 BITRIX_PAGINATION_INCOMPLETE The catalog walk did not converge, completeness is not guaranteed
502 BITRIX_RESULT_TOO_LARGE The portal holds more than 500 resources. Narrow the lookup with typeId or searchQuery
502 BITRIX_UNAVAILABLE Bitrix24 is temporarily unavailable
503 BITRIX_TIMEOUT Bitrix24 did not answer in time

No refusal contains partially collected data: the response is either complete or an error.

The full list of common API errors — Errors.

Known specifics

A truncated catalog is never returned. A Bitrix24 account whose catalog does not fit the cap gets a refusal rather than the first records: an incomplete list with no sign of incompleteness would read as the whole catalog. Narrow the lookup with filters.

Completeness is guaranteed for a catalog that did not change during the request. Bitrix24 provides no snapshot of the collection, so creating or deleting a resource while the walk is in progress can shift a page. The response then stays well-formed but may omit a just-created resource or still contain a just-deleted one.

Visibility is decided by Bitrix24. The method returns what the account shows to the identity behind the key. An employee key with the booking scope may call the method; whether its list matches an administrator's is decided by Bitrix24, not by the platform.

A read-only key works. The method only reads data, so read-only mode does not block it.

See also