Get Calendar List calendar.section.get
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:
calendarWho can execute the method: any user
This method retrieves a list of calendars.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
type* |
Calendar type:
|
|
ownerId* |
Identifier of the calendar owner. This parameter can be omitted if the calendar type is For the |
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"type":"user","ownerId":1}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/calendar.section.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"type":"user","ownerId":1,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/calendar.section.get
// 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, ISODate } from '@bitrix24/b24jssdk'
declare const $b24: B24Frame
// Shape of each CalendarSection returned in result[]
type CalendarSection = {
ID: string
NAME: string
GAPI_CALENDAR_ID: string | null
DESCRIPTION: string
COLOR: string
TEXT_COLOR: string
EXPORT: { ALLOW: boolean }
CAL_TYPE: string
OWNER_ID: string
CREATED_BY: string
DATE_CREATE: ISODate | null
TIMESTAMP_X: ISODate | null
CAL_DAV_CON: string | null
SYNC_TOKEN: string | null
PAGE_TOKEN: string | null
EXTERNAL_TYPE: string
ACCESS: Record<string, number>
IS_COLLAB: boolean
PERM: {
view_time: boolean
view_title: boolean
view_full: boolean
add: boolean
edit: boolean
edit_section: boolean
access: boolean
}
}
try {
// calendar.section.get 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<CalendarSection[]>({
method: 'calendar.section.get',
params: {
type: 'user',
ownerId: 1,
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('Sections count:', result.length, 'first section:', result[0])
}
} 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 getCalendarSections() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
// calendar.section.get 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.section.get',
params: {
type: 'user',
ownerId: 1,
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('Sections count:', result.length, 'first section:', result[0])
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getCalendarSections)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.calendar.section.get(
type="user",
owner_id=1,
).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.section.get',
[
'type' => 'user',
'ownerId' => 1
]
);
$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 getting calendar section: ' . $e->getMessage();
}
BX24.callMethod(
'calendar.section.get',
{
type: 'user',
ownerId: 1
}
);
require_once('crest.php');
$result = CRest::call(
'calendar.section.get',
[
'type' => 'user',
'ownerId' => 1
]
);
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.section.get", b24.Params{
"type": "user",
"ownerId": 1,
}, b24.WithIdempotent())
if err != nil {
return fmt.Errorf("calendar.section.get: %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": "190",
"NAME": "New Section",
"GAPI_CALENDAR_ID": null,
"DESCRIPTION": "Description for section",
"COLOR": "#9cbeee",
"TEXT_COLOR": "#283000",
"EXPORT": {
"ALLOW": true
},
"CAL_TYPE": "user",
"OWNER_ID": "1",
"CREATED_BY": "1",
"DATE_CREATE": "2024-12-10 06:36:00",
"TIMESTAMP_X": "2024-12-10 06:36:00",
"CAL_DAV_CON": null,
"SYNC_TOKEN": null,
"PAGE_TOKEN": null,
"EXTERNAL_TYPE": "local",
"ACCESS": {
"D114": 17,
"G2": 13,
"U2": 15,
"U1": 19
},
"IS_COLLAB": false,
"PERM": {
"view_time": true,
"view_title": true,
"view_full": true,
"add": true,
"edit": true,
"edit_section": true,
"access": true
}
},
{
"ID": "191",
...
}
{
"ID": "192",
...
}
],
"time": {
"start": 1733828946.418185,
"finish": 1733828946.650208,
"duration": 0.23202300071716309,
"processing": 0.0054471492767333984,
"date_start": "2024-12-08T11:09:06+00:00",
"date_finish": "2024-12-08T11:09:06+00:00"
}
}
Returned Data
|
Name |
Description |
|
result |
Array of calendars |
|
ID |
Calendar identifier |
|
NAME |
Calendar name |
|
GAPI_CALENDAR_ID |
Synchronization identifier |
|
DESCRIPTION |
Calendar description |
|
COLOR |
Calendar color |
|
TEXT_COLOR |
Text color in the calendar |
|
EXPORT |
Object with calendar export parameters |
|
CAL_TYPE |
Calendar type |
|
OWNER_ID |
Identifier of the calendar owner. For the user calendar type |
|
CREATED_BY |
Identifier of the calendar creator |
|
DATE_CREATE |
Calendar creation date |
|
TIMESTAMP_X |
Calendar modification date |
|
CAL_DAV_CON |
Synchronization identifier |
|
SYNC_TOKEN |
Synchronization identifier |
|
PAGE_TOKEN |
Synchronization identifier |
|
EXTERNAL_TYPE |
Provider type for synchronization |
|
ACCESS |
Object containing access data for the calendar. The object key is the access permission identifier. You can obtain the name of the access permission using the access.name method. Determine access rights for the current user using the user.access method. The object value contains a numerical identifier of the access permission. Access permission identifiers differ across different accounts. Currently, only the portal administrator in the on-premise version of Bitrix24 can retrieve all identifiers. |
|
IS_COLLAB |
Flag indicating whether the calendar belongs to a collaboration |
|
PERM |
Object containing access permissions for the current user to the calendar |
EXPORT Object
|
Name |
Description |
|
ALLOW |
Calendar export is allowed |
PERM Object
|
Name |
Description |
|
view_time |
View calendar event times |
|
view_title |
View calendar event titles |
|
view_full |
Full access to event information in the calendar |
|
add |
Add events to the calendar |
|
edit |
Edit events in the calendar |
|
edit_section |
Edit the calendar |
|
access |
Full access to the calendar |
Error Handling
HTTP Status: 400
{
"error": "",
"error_description": "The required parameter \"type\" for the method \"calendar.section.get\" is not set"
}
|
Name |
Description |
|
error |
String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only |
|
error_description |
Error message for the developer. Do not show it to the end user without processing |
Possible Error Codes
|
Code |
Error Message |
Description |
|
Empty value |
The required parameter "type" for the method "calendar.section.get" is not set |
The required parameter |
|
Empty value |
The required parameter "ownerId" for the method "calendar.section.get" is not set |
The required parameter |
|
Empty value |
Access denied |
Access to the method is prohibited for external users |
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 |
Description |
|
|
|
An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
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 |
|
|
|
The request contains no authorization data: neither an access token nor a webhook code was passed |
|
|
|
Methods are called over the HTTPS protocol only |
|
|
|
The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support |
|
|
|
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 — |
|
|
|
No active webhook with the specified user identifier and secret code was 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 |
|
|
|
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 |
|
|
|
The access token has expired |
|
|
|
The application is installed, but the Bitrix24 administrator has granted access to it only to specific users |
|
|
|
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 |