Create a calendar
const url = 'https://calendar.work.optidata.cloud/api/calendars';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Team planning","customization_color":"#EBBC00"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://calendar.work.optidata.cloud/api/calendars \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Team planning", "customization_color": "#EBBC00" }'Creates a calendar owned by the authenticated user, optionally sharing it
with other people in the same request through members.
Names are limited to 255 characters, may not contain :, /, ? or ",
and may not reuse one of the reserved mailbox folder names (Calendar,
Contacts, Tasks, Inbox, Trash, …).
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Body accepted when creating or updating a calendar.
object
Display name. May not contain :, /, ? or ", and may not reuse a
reserved mailbox folder name.
Hex colour, three or six digits.
The members already on the calendar. Mark an entry needsUpdate: true
to change that person’s role.
A person to grant or withdraw access. invitable is the directory entry
that identifies them — pass the object returned by
GET /search/invitables; only email is
strictly needed.
object
user is somebody with an Optiwork account in the tenant, group a user
group, and guest an address outside it.
What a member may do with a calendar. viewer reads it, manager also
creates and edits events and may answer invitations on the owner’s behalf,
admin additionally manages sharing, and owner is the person the
calendar belongs to.
Optiwork identifier of the member, when they have one.
In members, marks an existing member whose role should change.
Directory entry identifying the member.
object
People who should gain access.
A person to grant or withdraw access. invitable is the directory entry
that identifies them — pass the object returned by
GET /search/invitables; only email is
strictly needed.
object
user is somebody with an Optiwork account in the tenant, group a user
group, and guest an address outside it.
What a member may do with a calendar. viewer reads it, manager also
creates and edits events and may answer invitations on the owner’s behalf,
admin additionally manages sharing, and owner is the person the
calendar belongs to.
Optiwork identifier of the member, when they have one.
In members, marks an existing member whose role should change.
Directory entry identifying the member.
object
People whose access should be withdrawn.
A person to grant or withdraw access. invitable is the directory entry
that identifies them — pass the object returned by
GET /search/invitables; only email is
strictly needed.
object
user is somebody with an Optiwork account in the tenant, group a user
group, and guest an address outside it.
What a member may do with a calendar. viewer reads it, manager also
creates and edits events and may answer invitations on the owner’s behalf,
admin additionally manages sharing, and owner is the person the
calendar belongs to.
Optiwork identifier of the member, when they have one.
In members, marks an existing member whose role should change.
Directory entry identifying the member.
object
Examples
A private calendar
{ "name": "Team planning", "customization_color": "#EBBC00"}Created and shared with a colleague
{ "name": "Team planning", "customization_color": "#EBBC00", "members": [ { "type": "user", "role": "viewer", "optiworkIdentifier": "9ef34ce3-3b69-4762-b5e8-045499390ce6", "invitable": { "email": "john.smith@acme.example", "name": "John Smith" } } ]}Responses
Section titled “ Responses ”The created calendar.
object
A calendar the caller owns or has been given access to.
object
Id of the calendar, as digits.
For a calendar shared with the caller, its {ownerZid}:{calendarId}
identifier. null for a calendar the caller owns.
Hex colour used to render the calendar.
Populated only when a subscription feed has been generated.
For a shared calendar, its id in the owner’s account.
true for the user’s primary calendar, which cannot be renamed or
deleted.
true when the calendar belongs to somebody else.
true when a shared calendar can no longer be resolved — usually
because the owner revoked access or deleted it.
Who the calendar is shared with, and at which role.
One person’s access to a calendar.
object
What a member may do with a calendar. viewer reads it, manager also
creates and edits events and may answer invitations on the owner’s behalf,
admin additionally manages sharing, and owner is the person the
calendar belongs to.
user is somebody with an Optiwork account in the tenant, group a user
group, and guest an address outside it.
Mailbox identifier of the member.
Address of the member.
Optiwork identifier of the member — the value to send back as
optiworkIdentifier.
Examples
{ "calendar": { "id": "3623", "name": "Team planning", "color": "#EBBC00", "folderPath": "/Team planning", "userRole": "owner", "isHomeCalendar": false, "isDeletable": true, "isShared": false, "isBroken": false, "permissions": [] }}Missing, malformed or expired authentication key.
Authentication failures use an error key rather than message.
object
Examples
No bearer token sent
{ "error": "JWT passport exception: Missing bearer token in request"}The request body or query string failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examples
{ "message": "The event title field is required.", "errors": { "title": [ "The event title field is required." ] }}Rate limit exceeded. Retry after the window resets.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "Too Many Attempts."}