Add Event calendar.event.add
Scope:
calendarWho can execute the method: any user
This method adds a new event to the calendar.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
type* |
Calendar type:
|
|
ownerId* |
Identifier of the calendar owner. For the company calendar, the |
|
from* |
Start date and time of the event. You can specify a date without a time. To do this, pass the value |
|
to* |
End date of the event. You can specify a date without a time. To do this, pass the value |
|
from_ts |
Date and time in timestamp format. Can be used instead of the |
|
to_ts |
Date and time in timestamp format. Can be used instead of the |
|
section* |
Calendar identifier |
|
name* |
Event name |
|
skip_time |
Pass the date value without time in the
Date format according to ISO-8601 |
|
timezone_from |
Timezone of the start date and time of the event. Default is the current user's timezone. The value should be passed as a string, for example, |
|
timezone_to |
Timezone of the end date and time of the event. Default value is the current user's timezone. The value should be passed as a string, for example, |
|
description |
Event description |
|
color |
Background color of the event. The |
|
text_color |
Text color of the event. The |
|
accessibility |
Availability during the event time:
|
|
importance |
Importance of the event:
|
|
private_event |
Mark indicating that the event is private. Possible values:
|
|
rrule |
Recurrence of the event as an object in terms of the iCalendar standard. The structure is described below |
|
is_meeting |
Indicator of a meeting with event participants. Possible values:
For a meeting with participants, you must specify the list of participants |
|
location |
Location |
|
remind |
Array of objects describing reminders for the event. The structure is described below |
|
attendees* |
List of identifiers of event participants. This field is required if |
|
host* |
Identifier of the event organizer. This field is required if |
|
meeting |
Object with meeting parameters. The structure is described below |
|
crm_fields |
Array of identifiers of CRM objects to link to the event. To link objects, list their identifiers with prefixes:
|
Timezone Handling Features
When working with event dates and times, you can use two approaches:
-
Full date format with timezone.
Use the ISO-8601 format with timezone specified in the
fromandtoparameters:2025-03-20T15:00:00+02:00— with offset2025-08-05T10:00:00+11:00— with offset2025-08-04T23:00:00Z— with UTC specified
The
timezone_fromandtimezone_toparameters are ignored, as the timezone is already specified in the date. -
Simple date format with separate timezone parameters.
Use a simple format in the
fromandtoparameters:2025-03-20 15:00:002025-08-05 10:00:002025-08-05T10:00:00
Specify the timezone in the
timezone_fromandtimezone_toparameters:Europe/RigaAmerica/New_YorkAsia/Tokyo
If only
timezone_fromis specified, its value will be used fortimezone_to.
Priority of timezone parameter processing:
- Highest priority. If the
fromandtoparameters are specified in full format with timezone, thetimezone_fromandtimezone_toparameters are ignored - Medium priority. If a simple date format is used and
timezone_fromandtimezone_toparameters are specified, they are used - Lowest priority. If the date format is simple and timezone parameters are not specified, the current user's timezone is used
rrule Parameter
|
Name |
Description |
|
FREQ |
Recurrence frequency
|
|
COUNT |
Number of recurrences |
|
INTERVAL |
Interval between recurrences |
|
BYDAY |
Days of the week
|
|
UNTIL |
End date of recurrences |
remind Parameter
|
Name |
Description |
|
type |
Time type of reminder
|
|
count |
Numerical value of the time interval |
meeting Parameter
|
Name |
Description |
|
notify |
Flag for notification of confirmation or refusal by participants |
|
reinvite |
Flag for requesting re-confirmation of participation when editing the event |
|
allow_invite |
Flag for allowing participants to invite others to the event |
|
hide_guests |
Flag for hiding the list of participants |
Code Examples
How to Use Examples in Documentation
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"type":"user","ownerId":2,"name":"New Event Name","description":"Description for event","from":"2024-06-14","to":"2024-06-14","skip_time":"Y","section":5,"color":"#9cbe1c","text_color":"#283033","accessibility":"absent","importance":"normal","is_meeting":"Y","private_event":"N","remind":[{"type":"min","count":20}],"location":"London","attendees":[1,2,3],"host":2,"meeting":{"notify":true,"reinvite":false,"allow_invite":false,"hide_guests":false},"rrule":{"FREQ":"WEEKLY","BYDAY":["MO","WE"],"COUNT":10,"INTERVAL":1},"crm_fields":["C_5","L_11"]}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/calendar.event.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"type":"user","ownerId":2,"name":"New Event Name","description":"Description for event","from":"2024-06-14","to":"2024-06-14","skip_time":"Y","section":5,"color":"#9cbe1c","text_color":"#283033","accessibility":"absent","importance":"normal","is_meeting":"Y","private_event":"N","remind":[{"type":"min","count":20}],"location":"London","attendees":[1,2,3],"host":2,"meeting":{"notify":true,"reinvite":false,"allow_invite":false,"hide_guests":false},"rrule":{"FREQ":"WEEKLY","BYDAY":["MO","WE"],"COUNT":10,"INTERVAL":1},"crm_fields":["C_5","L_11"],"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/calendar.event.add
try
{
const response = await $b24.callMethod(
'calendar.event.add',
{
type: 'user',
ownerId: 2,
name: 'New Event Name',
description: 'Description for event',
from: '2024-06-14',
to: '2024-06-14',
skip_time: 'Y',
section: 5,
color: '#9cbe1c',
text_color: '#283033',
accessibility: 'absent',
importance: 'normal',
is_meeting: 'Y',
private_event: 'N',
remind: [
{
type: 'min',
count: 20
}
],
location: 'London',
attendees: [1, 2, 3],
host: 2,
meeting: {
notify: true,
reinvite: false,
allow_invite: false,
hide_guests: false,
},
rrule: {
FREQ: 'WEEKLY',
BYDAY: ['MO', 'WE'],
COUNT: 10,
INTERVAL: 1,
},
crm_fields: ['C_5', 'L_11']
}
);
const result = response.getData().result;
console.log('Created event with ID:', result);
// Your data processing logic
processResult(result);
}
catch( error )
{
console.error('Error:', error);
}
try {
$response = $b24Service
->core
->call(
'calendar.event.add',
[
'type' => 'user',
'ownerId' => 2,
'name' => 'New Event Name',
'description' => 'Description for event',
'from' => '2024-06-14',
'to' => '2024-06-14',
'skip_time' => 'Y',
'section' => 5,
'color' => '#9cbe1c',
'text_color' => '#283033',
'accessibility' => 'absent',
'importance' => 'normal',
'is_meeting' => 'Y',
'private_event' => 'N',
'remind' => [
[
'type' => 'min',
'count' => 20
]
],
'location' => 'London',
'attendees' => [1, 2, 3],
'host' => 2,
'meeting' => [
'notify' => true,
'reinvite' => false,
'allow_invite' => false,
'hide_guests' => false,
],
'rrule' => [
'FREQ' => 'WEEKLY',
'BYDAY' => ['MO', 'WE'],
'COUNT' => 10,
'INTERVAL' => 1,
],
'crm_fields' => ['C_5', 'L_11']
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
// Your data processing logic
processData($result);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error adding calendar event: ' . $e->getMessage();
}
BX24.callMethod(
'calendar.event.add',
{
type: 'user',
ownerId: 2,
name: 'New Event Name',
description: 'Description for event',
from: '2024-06-14',
to: '2024-06-14',
skip_time: 'Y',
section: 5,
color: '#9cbe1c',
text_color: '#283033',
accessibility: 'absent',
importance: 'normal',
is_meeting: 'Y',
private_event: 'N',
remind: [
{
type: 'min',
count: 20
}
],
location: 'London',
attendees: [1, 2, 3],
host: 2,
meeting: {
notify: true,
reinvite: false,
allow_invite: false,
hide_guests: false,
},
rrule: {
FREQ: 'WEEKLY',
BYDAY: ['MO', 'WE'],
COUNT: 10,
INTERVAL: 1,
},
crm_fields: ['C_5', 'L_11']
}
);
require_once('crest.php');
$result = CRest::call(
'calendar.event.add',
[
'type' => 'user',
'ownerId' => 2,
'name' => 'New Event Name',
'description' => 'Description for event',
'from' => '2024-06-14',
'to' => '2024-06-14',
'skip_time' => 'Y',
'section' => 5,
'color' => '#9cbe1c',
'text_color' => '#283033',
'accessibility' => 'absent',
'importance' => 'normal',
'is_meeting' => 'Y',
'private_event' => 'N',
'remind' => [
[
'type' => 'min',
'count' => 20
]
],
'location' => 'London',
'attendees' => [1, 2, 3],
'host' => 2,
'meeting' => [
'notify' => true,
'reinvite' => false,
'allow_invite' => false,
'hide_guests' => false,
],
'rrule' => [
'FREQ' => 'WEEKLY',
'BYDAY' => ['MO', 'WE'],
'COUNT' => 10,
'INTERVAL' => 1,
],
'crm_fields' => ['C_5', 'L_11']
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
How to Add a Recurring Event to the Company Calendar
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"type":"company_calendar","ownerId":"","from":"2025-01-31T18:00:00","to":"2025-01-31T20:00:00","section":1,"name":"Important Meeting","skip_time":"N","timezone_from":"Europe/Berlin","timezone_to":"Europe/Berlin","description":"Event description","color":"#FF0000","text_color":"#000000","accessibility":"busy","importance":"high","private_event":"N","rrule":{"FREQ":"WEEKLY","COUNT":10,"INTERVAL":1,"BYDAY":["MO","WE","FR"]},"is_meeting":"Y","location":"Conference Room","remind":[{"type":"min","count":30}],"attendees":[29,93],"host":1,"meeting":{"notify":true,"reinvite":false,"allow_invite":true,"hide_guests":false}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/calendar.event.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"type":"company_calendar","ownerId":"","from":"2025-01-31T18:00:00","to":"2025-01-31T20:00:00","section":1,"name":"Important Meeting","skip_time":"N","timezone_from":"Europe/Berlin","timezone_to":"Europe/Berlin","description":"Event description","color":"#FF0000","text_color":"#000000","accessibility":"busy","importance":"high","private_event":"N","rrule":{"FREQ":"WEEKLY","COUNT":10,"INTERVAL":1,"BYDAY":["MO","WE","FR"]},"is_meeting":"Y","location":"Conference Room","remind":[{"type":"min","count":30}],"attendees":[29,93],"host":1,"meeting":{"notify":true,"reinvite":false,"allow_invite":true,"hide_guests":false},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/calendar.event.add
try
{
const response = await $b24.callMethod(
'calendar.event.add',
{
type: 'company_calendar',
ownerId: '',
from: '2025-01-31T18:00:00',
to: '2025-01-31T20:00:00',
section: 1,
name: 'Important Meeting',
skip_time: 'N',
timezone_from: 'Europe/Berlin',
timezone_to: 'Europe/Berlin',
description: 'Event description',
color: '%23FF0000',
text_color: '%23000000',
accessibility: 'busy',
importance: 'high',
private_event: 'N',
rrule: {
FREQ: 'WEEKLY',
COUNT: 10,
INTERVAL: 1,
BYDAY: ['MO', 'WE', 'FR']
},
is_meeting: 'Y',
location: 'Conference Room',
remind: [
{ type: 'min', count: 30 }
],
attendees: [29, 93],
host: 1,
meeting: {
notify: true,
reinvite: false,
allow_invite: true,
hide_guests: false
}
}
);
const result = response.getData().result;
console.log('Event added successfully', result);
}
catch( error )
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'calendar.event.add',
[
'type' => 'company_calendar',
'ownerId' => '',
'from' => '2025-01-31T18:00:00',
'to' => '2025-01-31T20:00:00',
'section' => 1,
'name' => 'Important Meeting',
'skip_time' => 'N',
'timezone_from' => 'Europe/Berlin',
'timezone_to' => 'Europe/Berlin',
'description' => 'Event description',
'color' => '%23FF0000',
'text_color' => '%23000000',
'accessibility' => 'busy',
'importance' => 'high',
'private_event' => 'N',
'rrule' => [
'FREQ' => 'WEEKLY',
'COUNT' => 10,
'INTERVAL' => 1,
'BYDAY' => ['MO', 'WE', 'FR']
],
'is_meeting' => 'Y',
'location' => 'Conference Room',
'remind' => [
['type' => 'min', 'count' => 30]
],
'attendees' => [29, 93],
'host' => 1,
'meeting' => [
'notify' => true,
'reinvite' => false,
'allow_invite' => true,
'hide_guests' => false
]
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Event added successfully: ' . print_r($result, true);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error adding event: ' . $e->getMessage();
}
BX24.callMethod(
'calendar.event.add',
{
type: 'company_calendar', // Calendar type: company calendar
ownerId: '', // For the company calendar, ownerId is empty
from: '2025-01-31T18:00:00', // Start date and time of the event
to: '2025-01-31T20:00:00', // End date and time of the event
section: 1, // Calendar identifier
name: 'Important Meeting', // Event name
skip_time: 'N', // Use date and time (N)
timezone_from: 'Europe/Berlin', // Timezone of the start of the event
timezone_to: 'Europe/Berlin', // Timezone of the end of the event
description: 'Event description', // Event description
color: '%23FF0000', // Background color of the event (red)
text_color: '%23000000', // Text color of the event (black)
accessibility: 'busy', // Availability during the event: busy
importance: 'high', // Importance of the event: high
private_event: 'N', // Event is not private
rrule: { // Recurrence parameters of the event
FREQ: 'WEEKLY', // Recurrence frequency: weekly
COUNT: 10, // Number of recurrences
INTERVAL: 1, // Interval between recurrences
BYDAY: ['MO', 'WE', 'FR'] // Days of the week: Monday, Wednesday, Friday
},
is_meeting: 'Y', // Indicator of a meeting with participants
location: 'Conference Room', // Location
remind: [ // Event reminders
{ type: 'min', count: 30 } // Reminder 30 minutes before the event
],
attendees: [29, 93], // List of identifiers of event participants
host: 1, // Identifier of the event organizer
meeting: { // Meeting parameters
notify: true, // Notification of confirmation or refusal by participants
reinvite: false, // Do not request re-confirmation of participation
allow_invite: true, // Allow participants to invite others
hide_guests: false // Do not hide the list of participants
}
},
function(result) {
if(result.error()) {
console.error(result.error()); // Error handling
} else {
console.log('Event added successfully', result.data()); // Successful event addition
}
}
);
require_once('crest.php');
$result = CRest::call(
'calendar.event.add',
[
'type' => 'company_calendar', // Calendar type: company calendar
'ownerId' => '', // For the company calendar, ownerId is empty
'from' => '2025-01-31T18:00:00', // Start date and time of the event
'to' => '2025-01-31T20:00:00', // End date and time of the event
'section' => 1, // Calendar identifier (replace with actual)
'name' => 'Important Meeting', // Event name
'skip_time' => 'N', // Use date and time (N)
'timezone_from' => 'Europe/Berlin', // Timezone of the start of the event
'timezone_to' => 'Europe/Berlin', // Timezone of the end of the event
'description' => 'Event description', // Event description
'color' => '#FF0000', // Background color of the event (red)
'text_color' => '#000000', // Text color of the event (black)
'accessibility' => 'busy', // Availability during the event: busy
'importance' => 'high', // Importance of the event: high
'private_event' => 'N', // Event is not private
'rrule' => [ // Recurrence parameters of the event
'FREQ' => 'WEEKLY', // Recurrence frequency: weekly
'COUNT' => 10, // Number of recurrences
'INTERVAL' => 1, // Interval between recurrences
'BYDAY' => ['MO', 'WE', 'FR'] // Days of the week: Monday, Wednesday, Friday
],
'is_meeting' => 'Y', // Indicator of a meeting with participants
'location' => 'Conference Room', // Location
'remind' => [ // Event reminders
['type' => 'min', 'count' => 30] // Reminder 30 minutes before the event
],
'attendees' => [29, 93], // List of identifiers of event participants
'host' => 1, // Identifier of the event organizer
'meeting' => [ // Meeting parameters
'notify' => true, // Notification of confirmation or refusal by participants
'reinvite' => false, // Do not request re-confirmation of participation
'allow_invite' => true, // Allow participants to invite others
'hide_guests' => false // Do not hide the list of participants
]
]
);
if (isset($result['error'])) {
echo 'Error: ' . $result['error_description']; // Error handling
} else {
echo 'Event added successfully: ';
print_r($result['result']); // Successful event addition
}
Response Handling
HTTP status: 200
{
"result": 1246,
"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 |
Description |
|
result |
Identifier of the created event |
Error Handling
HTTP status: 400
{
"error": "",
"error_description": "The required parameter "name" for the method "calendar.event.add" is not set"
}
|
Name |
Description |
|
error |
String error code. It may consist of digits, Latin letters, and underscores |
|
error_description |
Textual description of the error. The description is not intended to be shown to the end user in its raw form |
Possible Error Codes
|
Code |
Error Message |
Description |
|
Empty string |
The required parameter "type" for the method "calendar.event.add" is not set |
The required parameter |
|
Empty string |
The required parameter "ownerId" for the method "calendar.event.add" is not set |
The required parameter |
|
Empty string |
The required parameter "name" for the method "calendar.event.add" is not set |
The required parameter |
|
Empty string |
The required parameter "from" for the method "calendar.event.add" is not set |
The required parameter |
|
Empty string |
The required parameter "to" for the method "calendar.event.add" is not set |
The required parameter |
|
Empty string |
Invalid value for the "name" parameter |
Incorrect data format in the |
|
Empty string |
Invalid value for the "description" parameter |
Incorrect data format in the |
|
Empty string |
Access denied |
Creation of events in the specified calendar is prohibited |
|
Empty string |
You have specified an invalid calendar section ID or the user does not have access to it |
An identifier of an unavailable or non-existent calendar is passed |
|
Empty string |
The event's CRM link list must be an array |
Incorrect data format in the |
|
Empty string |
An error occurred while creating the event |
Another error |
Statuses and System Error Codes
HTTP Status: 20x, 40x, 50x
The errors described below may occur when calling any method.
|
Status |
Code |
Description |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
An internal server error has occurred, please contact the server administrator or Bitrix24 technical support |
|
|
|
The request intensity limit has been exceeded |
|
|
|
The current method is not allowed to be called using batch |
|
|
|
The maximum length of parameters passed to the batch method has been exceeded |
|
|
|
Invalid access token or webhook code |
|
|
|
The methods must be called using the HTTPS protocol |
|
|
|
The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support |
|
|
|
The REST API is available only on commercial plans |
|
|
|
The user whose access token or webhook was used to call the method lacks permissions |
|
|
|
The manifest is not available |
|
|
|
The request requires higher privileges than those provided by the webhook token |
|
|
|
The provided access token has expired |
|
|
|
The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users |
|
|
|
The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site |