CreateCalendarEvent

Function to create a calendar event (optionally a recurring series). The event is also created in the owner's Google and Microsoft calendar if connected

POST https://rest.crmango.com/api/CreateCalendarEvent

Authorization

1 Sent in the request headers
Bearer varchar

Auth token (required in Authorization header)

Body data

21 Sent in the request body
owner_id integer

User ID whose calendar the event belongs to (required for create)
Reference: GetAllUsers

title varchar

Event title, max 255 characters (required for create). Characters ' " ; \ ? / @ # $ = > < are removed

date_from varchar

Event start - unix timestamp or date and time, e.g. 2026-10-07 14:00 (required for create)

date_to varchar

Event end - same format (required for create). If equal to date_from, the event lasts 1 hour

description varchar

Event description (plain text, HTML tags are removed), max 10000 characters

type integer

Event type: 0 or omitted = automatic (up to 30 minutes = phone call, otherwise meeting), 1-99 basic type, 100+ custom activity type

is_private integer

Private event (0 = public, 1 = private)

company_id integer

ID of the related company

branch_id integer

ID of the related company branch

person_id integer

ID of the related person
Reference: GetAllPersons

guests array

List of guest e-mail addresses (max 100). On update the whole list is replaced, empty list removes the guests

color varchar

Event color in format #RRGGBB (empty, #fff and #ffffff = no color)

address varchar

Event address, max 255 characters

latitude decimal

Latitude (-90 to 90)

longitude decimal

Longitude (-180 to 180)

notification_type integer

Notification unit (1-4). Notification is set only if type, value and who are all filled

notification_value integer

How many units before the start the notification is sent (min 1)

notification_who integer

Who receives the notification (1-7)

repeat_type varchar

Recurrence: daily, weekly, monthly, yearly or custom (every repeat_interval days). Maximum 100 dates

repeat_end_date date

Last day of the recurrence, inclusive (Y-m-d). Required with repeat_type

repeat_interval integer

For repeat_type custom: repeat every N days (1-365)

Response

7 HTTP 201

Function to create a calendar event

code integer

HTTP status code (201 = Created)

message varchar

Confirmation message

resource_id integer

ID of the created event (the first date for a series)

resource_ids array

IDs of all created events (more than one for a series)

series_id varchar

Series ID (null if the event is not recurring)

sync.google varchar

Synchronization with the owner's Google and Microsoft calendar: ok, failed, partial (series - only some dates), not_connected

sync.microsoft varchar

Synchronization with the owner's Google and Microsoft calendar: ok, failed, partial (series - only some dates), not_connected

Example request

curl --request POST \
  --url 'https://rest.crmango.com/api/CreateCalendarEvent' \
  --header 'Authorization: Bearer auth_token' \
  --header 'Content-Type: application/json' \
  --data '{
    {
        "owner_id": 5,
        "title": "Weekly sync",
        "date_from": "2026-11-02 10:00",
        "date_to": "2026-11-02 11:00",
        "description": "Team meeting",
        "type": 0,
        "is_private": 0,
        "company_id": 8,
        "guests": [
            "client@example.com"
        ],
        "color": "#00ff00",
        "address": "Bratislava",
        "notification_type": 1,
        "notification_value": 30,
        "notification_who": 1,
        "repeat_type": "weekly",
        "repeat_end_date": "2026-11-23"
    }
  }'
{
    "code": 201,
    "message": "Calendar series was created",
    "resource_id": 1301,
    "resource_ids": [
        1301,
        1302,
        1303,
        1304
    ],
    "series_id": "5_1790000000000_1234",
    "sync": {
        "google": "ok",
        "microsoft": "not_connected"
    }
}