Get Resource Bookings by Filter calendar.resource.booking.list

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

Scope: calendar

Who can execute the method: any user

This method retrieves resource bookings based on a filter.

Method Parameters

Required parameters are marked with *

Name
type

Description

filter*
object

Filter fields

Filter Parameter

Required parameters are marked with *

Name
type

Description

resourceTypeIdList*
array

List of resource identifiers.

Identifiers can be obtained using the method calendar.resource.list

from
date

Start date of the period

to
date

End date of the period

resourceIdList*
array

List of resource booking identifiers from the custom field of type resourcebooking in leads or deals in CRM.

Identifiers can be obtained via:

To find out which custom fields have the type resourcebooking, you can use the method crm.lead.userfield.list for leads and the method crm.deal.userfield.list for deals

In the method calendar.resource.booking.list, you must use only one of the two required parameters: resourceTypeIdList or resourceIdList. Both parameters cannot be used together.

Code Examples

Example 1. Assess resource availability over a period, for instance, to create custom views of availability or for use in application logic.

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"filter":{"resourceTypeIdList":[10852,10888,10873,10871,10853],"from":"2024-06-20","to":"2024-08-20"}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/calendar.resource.booking.list
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"filter":{"resourceTypeIdList":[10852,10888,10873,10871,10853],"from":"2024-06-20","to":"2024-08-20"},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/calendar.resource.booking.list
        
// This snippet is an ES module: top-level await requires type="module" or a bundler.
        // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
        import { Text } from '@bitrix24/b24jssdk'
        import type { B24Frame } from '@bitrix24/b24jssdk'
        
        declare const $b24: B24Frame
        
        // Shape of each booking returned in result[]
        type ResourceBooking = {
          ID: string
          PARENT_ID: string
          DELETED: string
          CAL_TYPE: string
          OWNER_ID: string
          NAME: string
          DATE_FROM: string
          DATE_TO: string
          TZ_FROM: string
          TZ_TO: string
          TZ_OFFSET_FROM: string
          TZ_OFFSET_TO: string
          DATE_FROM_TS_UTC: string
          DATE_TO_TS_UTC: string
          DT_SKIP_TIME: string
          DT_LENGTH: number
          EVENT_TYPE: string
          CREATED_BY: string
          DATE_CREATE: string
          TIMESTAMP_X: string
          DESCRIPTION: string
          IS_MEETING: boolean
          MEETING_STATUS: string
          MEETING_HOST: string
          VERSION: string
          SECTION_ID: string
          DATE_FROM_FORMATTED: string
          DATE_TO_FORMATTED: string
          SECT_ID: string
          RESOURCE_BOOKING_ID: string
        }
        
        try {
          // calendar.resource.booking.list returns a single page (max 50 records). For the whole result set
          // use a list helper: $b24.actions.v2.callList.make() returns every record as one
          // array, $b24.actions.v2.fetchList.make() yields them in chunks (async generator).
          // NOTE: the list helpers do not accept `order` (it is excluded from their params, so
          // passing it is a TS error) — keep this call.make + `start` variant when sort matters.
          const response = await $b24.actions.v2.call.make<ResourceBooking[]>({
            method: 'calendar.resource.booking.list',
            params: {
              filter: {
                resourceTypeIdList: [10852, 10888, 10873, 10871, 10853],
                from: '2024-06-20',
                to: '2024-08-20',
              },
              start: 0,
            },
            requestId: Text.getUuidRfc4122()
          })
        
          // The payload is available only on a successful response
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
          } else {
            const result = response.getData()!.result
            console.info('Bookings on this page:', result.length, result)
          }
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
        
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
        <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
        <script>
          async function fetchResourceBookings() {
            try {
              // Initialize the SDK inside a Bitrix24 frame
              const $b24 = await B24Js.initializeB24Frame()
        
              // calendar.resource.booking.list returns a single page (max 50 records). For the whole result set
              // use a list helper: $b24.actions.v2.callList.make() returns every record as one
              // array, $b24.actions.v2.fetchList.make() yields them in chunks (async generator).
              // NOTE: the list helpers do not accept `order` (it is excluded from their params, so
              // passing it is a TS error) — keep this call.make + `start` variant when sort matters.
              const response = await $b24.actions.v2.call.make({
                method: 'calendar.resource.booking.list',
                params: {
                  filter: {
                    resourceTypeIdList: [10852, 10888, 10873, 10871, 10853],
                    from: '2024-06-20',
                    to: '2024-08-20',
                  },
                  start: 0,
                },
                requestId: B24Js.Text.getUuidRfc4122()
              })
        
              // The payload is available only on a successful response
              if (!response.isSuccess) {
                console.error(response.getErrorMessages().join('; '))
                return
              }
        
              const result = response.getData().result
              console.info('Bookings on this page:', result.length, result)
            } catch (error) {
              // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
              console.error(error)
            }
          }
        
          document.addEventListener('DOMContentLoaded', fetchResourceBookings)
        </script>
        
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.calendar.resource.booking.list(
                filter={
                    "resourceTypeIdList": [
                        10852,
                        10888,
                        10873,
                        10871,
                        10853,
                    ],
                    "from": "2024-06-20",
                    "to": "2024-08-20",
                },
            ).response
            result = bitrix_response.result
            print(result)
        except BitrixAPIError as error:
            print(
                "Bitrix API error",
                f"error: {error.error}",
                f"error_description: {error.error_description}",
                sep="\n",
            )
        except BitrixSDKException as error:
            print(f"Bitrix SDK error: {error.message}")
        except Exception as error:
            print(f"Unexpected error: {error}")
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'calendar.resource.booking.list',
                    [
                        'filter' => [
                            'resourceTypeIdList' => [10852, 10888, 10873, 10871, 10853],
                            'from'              => '2024-06-20',
                            'to'                => '2024-08-20',
                        ],
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            // Your logic for processing data
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error fetching resource booking list: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'calendar.resource.booking.list',
            {
                filter: {
                    resourceTypeIdList: [10852, 10888, 10873, 10871, 10853],
                    from: '2024-06-20',
                    to: '2024-08-20',
                }
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'calendar.resource.booking.list',
            [
                'filter' => [
                    'resourceTypeIdList' => [10852, 10888, 10873, 10871, 10853],
                    'from' => '2024-06-20',
                    'to' => '2024-08-20'
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "calendar.resource.booking.list", b24.Params{
        	"filter": b24.Params{
        		"resourceTypeIdList": []int{10852, 10888, 10873, 10871, 10853},
        		"from":               "2024-06-20",
        		"to":                 "2024-08-20",
        	},
        }, b24.WithIdempotent())
        if err != nil {
        	return fmt.Errorf("calendar.resource.booking.list: %w", err)
        }
        
        // The response arrives as json.RawMessage — unmarshal it
        // into a struct matching the response shape shown below on this page.
        fmt.Printf("%s\n", res.Result)
        

Example 2. Select bookings by their identifiers from CRM custom fields.

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"filter":{"resourceIdList":[10,18,17]}}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/calendar.resource.booking.list
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"filter":{"resourceIdList":[10,18,17]},"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/calendar.resource.booking.list
        
// This snippet is an ES module: top-level await requires type="module" or a bundler.
        // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
        import { Text } from '@bitrix24/b24jssdk'
        import type { B24Frame } from '@bitrix24/b24jssdk'
        
        declare const $b24: B24Frame
        
        // Shape of each booking returned in result[]
        type ResourceBooking = {
          ID: string
          PARENT_ID: string
          DELETED: string
          CAL_TYPE: string
          OWNER_ID: string
          NAME: string
          DATE_FROM: string
          DATE_TO: string
          TZ_FROM: string
          TZ_TO: string
          TZ_OFFSET_FROM: string
          TZ_OFFSET_TO: string
          DATE_FROM_TS_UTC: string
          DATE_TO_TS_UTC: string
          DT_SKIP_TIME: string
          DT_LENGTH: number
          EVENT_TYPE: string
          CREATED_BY: string
          DATE_CREATE: string
          TIMESTAMP_X: string
          DESCRIPTION: string
          IS_MEETING: boolean
          MEETING_STATUS: string
          MEETING_HOST: string
          VERSION: string
          SECTION_ID: string
          DATE_FROM_FORMATTED: string
          DATE_TO_FORMATTED: string
          SECT_ID: string
          RESOURCE_BOOKING_ID: string
        }
        
        try {
          // calendar.resource.booking.list returns a single page (max 50 records). For the whole result set
          // use a list helper: $b24.actions.v2.callList.make() returns every record as one
          // array, $b24.actions.v2.fetchList.make() yields them in chunks (async generator).
          // NOTE: the list helpers do not accept `order` (it is excluded from their params, so
          // passing it is a TS error) — keep this call.make + `start` variant when sort matters.
          const response = await $b24.actions.v2.call.make<ResourceBooking[]>({
            method: 'calendar.resource.booking.list',
            params: {
              filter: {
                resourceIdList: [10, 18, 17],
              },
              start: 0,
            },
            requestId: Text.getUuidRfc4122()
          })
        
          // The payload is available only on a successful response
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
          } else {
            const result = response.getData()!.result
            console.info('Bookings on this page:', result.length, result)
          }
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
        
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
        <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
        <script>
          async function fetchResourceBookings() {
            try {
              // Initialize the SDK inside a Bitrix24 frame
              const $b24 = await B24Js.initializeB24Frame()
        
              // calendar.resource.booking.list returns a single page (max 50 records). For the whole result set
              // use a list helper: $b24.actions.v2.callList.make() returns every record as one
              // array, $b24.actions.v2.fetchList.make() yields them in chunks (async generator).
              // NOTE: the list helpers do not accept `order` (it is excluded from their params, so
              // passing it is a TS error) — keep this call.make + `start` variant when sort matters.
              const response = await $b24.actions.v2.call.make({
                method: 'calendar.resource.booking.list',
                params: {
                  filter: {
                    resourceIdList: [10, 18, 17],
                  },
                  start: 0,
                },
                requestId: B24Js.Text.getUuidRfc4122()
              })
        
              // The payload is available only on a successful response
              if (!response.isSuccess) {
                console.error(response.getErrorMessages().join('; '))
                return
              }
        
              const result = response.getData().result
              console.info('Bookings on this page:', result.length, result)
            } catch (error) {
              // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
              console.error(error)
            }
          }
        
          document.addEventListener('DOMContentLoaded', fetchResourceBookings)
        </script>
        
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.calendar.resource.booking.list(
                filter={
                    "resourceIdList": [
                        10,
                        18,
                        17,
                    ],
                },
            ).response
            result = bitrix_response.result
            print(result)
        except BitrixAPIError as error:
            print(
                "Bitrix API error",
                f"error: {error.error}",
                f"error_description: {error.error_description}",
                sep="\n",
            )
        except BitrixSDKException as error:
            print(f"Bitrix SDK error: {error.message}")
        except Exception as error:
            print(f"Unexpected error: {error}")
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'calendar.resource.booking.list',
                    [
                        'filter' => [
                            'resourceIdList' => [10, 18, 17]
                        ]
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            // Your logic for processing data
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error fetching resource booking list: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'calendar.resource.booking.list',
            {
                filter: {
                    resourceIdList: [10, 18, 17]
                }
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'calendar.resource.booking.list',
            [
                'filter' => [
                    'resourceIdList' => [10, 18, 17]
                ]
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "calendar.resource.booking.list", b24.Params{
        	"filter": b24.Params{
        		"resourceIdList": []int{10, 18, 17},
        	},
        }, b24.WithIdempotent())
        if err != nil {
        	return fmt.Errorf("calendar.resource.booking.list: %w", err)
        }
        
        // The response arrives as json.RawMessage — unmarshal it
        // into a struct matching the response shape shown below on this page.
        fmt.Printf("%s\n", res.Result)
        

Response Handling

HTTP Status: 200

{
            "result": [
                {
                    "ID": "1408",
                    "PARENT_ID": "1408",
                    "DELETED": "N",
                    "CAL_TYPE": "resource",
                    "OWNER_ID": "0",
                    "NAME": "Booking",
                    "DATE_FROM": "20.12.2024 00:00:00",
                    "DATE_TO": "21.12.2024 00:00:00",
                    "TZ_FROM": "Europe/Riga",
                    "TZ_TO": "Europe/Riga",
                    "TZ_OFFSET_FROM": "7200",
                    "TZ_OFFSET_TO": "7200",
                    "DATE_FROM_TS_UTC": "1734652800",
                    "DATE_TO_TS_UTC": "1734739200",
                    "DT_SKIP_TIME": "Y",
                    "DT_LENGTH": 172800,
                    "EVENT_TYPE": "#resourcebooking#",
                    "CREATED_BY": "1",
                    "DATE_CREATE": "18.12.2024 13:55:35",
                    "TIMESTAMP_X": "18.12.2024 13:55:35",
                    "DESCRIPTION": "Service: some",
                    "IS_MEETING": false,
                    "MEETING_STATUS": "Y",
                    "MEETING_HOST": "0",
                    "VERSION": "1",
                    "SECTION_ID": "198",
                    "DATE_FROM_FORMATTED": "Fri Dec 20 2024",
                    "DATE_TO_FORMATTED": "Sat Dec 21 2024",
                    "SECT_ID": "198",
                    "RESOURCE_BOOKING_ID": "10"
                },
                {
                    "ID": "1409",
                    ...
                }
            ],
            "time": {
                "start": 1733318565.183275,
                "finish": 1733318565.695058,
                "duration": 0.5117831230163574,
                "processing": 0.29406094551086426,
                "date_start": "2024-12-04T13:22:45+00:00",
                "date_finish": "2024-12-04T13:22:45+00:00"
            }
        }
        

Returned Data

Name
type

Description

result
array

Array of objects. Each object describes a booking

Booking Object

Technically, a booking is a calendar event. The method retrieves a set of fields similar to those of a calendar event. Some fields remain empty as they are not relevant for bookings. Below are only the relevant or filled fields.

Name
type

Description

ID
string

Booking identifier

PARENT_ID
string

For a booking object, always equal to the ID field

DELETED
string

Flag indicating whether the booking is deleted. Possible values:

  • Y — booking deleted
  • N — booking not deleted

CAL_TYPE
string

Type of calendar in which the booking is located

OWNER_ID
string

For a booking object, always equals '0'

NAME
string

Name of the booking

DATE_FROM
datetime

Start date of the booking

DATE_TO
datetime

End date of the booking

TZ_FROM
string

Timezone of the start date of the booking

TZ_TO
string

Timezone of the end date of the booking

TZ_OFFSET_FROM
string

Time offset of the start of the booking relative to UTC in seconds

TZ_OFFSET_TO
string

Time offset of the end of the booking relative to UTC in seconds

DATE_FROM_TS_UTC
string

Start date and time of the booking in UTC in timestamp format

DATE_TO_TS_UTC
string

End date and time of the booking in UTC in timestamp format

DT_SKIP_TIME
string

Flag indicating whether the booking lasts all day. Possible values:

  • Y — all day
  • N — not all day

DT_LENGTH
integer

Duration of the booking in seconds

EVENT_TYPE
string

Type of booking

CREATED_BY
string

Identifier of the user who created the booking

DATE_CREATE
datetime

Creation date of the booking

TIMESTAMP_X
datetime

Date of modification of the booking

DESCRIPTION
string

Description of the booking

IS_MEETING
boolean

For a booking object, always false

MEETING_STATUS
string

For a booking object, always 'Y'

MEETING_HOST
string

For a booking object, always '0'

VERSION
string

Version of booking changes

SECTION_ID
string

Identifier of the resource in which the booking is located

DATE_FROM_FORMATTED
string

Formatted start date of the booking

DATE_TO_FORMATTED
string

Formatted end date of the booking

SECT_ID
string

Identifier of the resource in which the booking is located

RESOURCE_BOOKING_ID
integer

Booking identifier

Error Handling

HTTP Status: 400

{
            "error": "",
            "error_description": "The required parameter \"filter['resourceTypeIdList']\" is not set for the method \"calendar.resource.booking.list\""
        }
        

Name
type

Description

error
string

String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only error_description shows the reason

error_description
string

Error message for the developer. Do not show it to the end user without processing

Possible Error Codes

Code

Error Message

Description

Empty value

Access denied

Access to the method is prohibited for external users

Empty value

The required parameter "filter['resourceTypeIdList']" is not set for the method "calendar.resource.booking.list"

Neither of the required parameters resourceTypeIdList or resourceIdList was provided

Statuses and System Error Codes

HTTP Status: 4xx, 5xx

The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

429

OPERATION_TIME_LIMIT
Method is blocked due to operation time limit

The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit

401

NO_AUTH_FOUND
Wrong authorization data

The request contains no authorization data: neither an access token nor a webhook code was passed

401

INVALID_REQUEST
Https required

Methods are called over the HTTPS protocol only

401

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support

401

ACCESS_DENIED
REST is available only on commercial plans

REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — REST is available only by subscription

401

INVALID_CREDENTIALS
Invalid request credentials

No active webhook with the specified user identifier and secret code was found

404

ERROR_METHOD_NOT_FOUND
Method not found!

No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope

401

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with provided by the access token

401

expired_token
The access token provided has expired

The access token has expired

401

user_access_error
The user does not have access to the application

The application is installed, but the Bitrix24 administrator has granted access to it only to specific users

403

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning