Calendars API
Calendars contain events and generate iCal feed URLs. They can be org-level (shared) or owned by a specific agent.
The API normalizes a name before it stores it: invisible format characters (zero-width spaces, word joiners, bidi controls, soft hyphens) are removed, while zero-width joiners and non-joiners are kept because emoji sequences, Persian and Indic scripts need them, then Unicode NFC is applied, every run of whitespace (spaces, tabs, newlines, non-breaking spaces) is replaced by one space, and the ends are trimmed. " Front\u00A0office\n" is stored as "Front office". The length limit applies to the normalized name. A name with no visible character (whitespace only, only zero-width joiners, or only blank characters such as the braille blank), or one that contains a control character, returns 400 validation_error. Names stored before this rule are returned as they were stored.
Create a calendar
Section titled “Create a calendar”Create an org-level calendar or an agent-owned calendar:
POST /v1/calendarsPOST /v1/agents/:agent_id/calendarsRequest body
Section titled “Request body”| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | Yes | — | 1–255 characters, after normalizing (see Names) |
timezone | string | Yes | — | IANA timezone (e.g., America/New_York). It must be a time zone name the API accepts (an IANA name such as America/New_York, or a UTC offset like +05:00); anything else (America/New York, GMT+5) returns 400 validation_error |
agent_status | string | No | idle | idle, working, waiting, or error. See Agent status. |
default_reminders | integer[] | null | No | — | Minutes before start_time that events in this calendar inherit when they don’t set their own reminders. Max 5 entries, each 1–40320 (28 days). See Reminder defaults. |
prevent_overlaps | boolean | No | false | true: the calendar refuses any event that would overlap an active event on it. See Double-booking guarantee. |
metadata | object | No | — | Key-value pairs, max 16KB JSON |
Example
Section titled “Example”curl -X POST https://api.chronary.ai/v1/agents/agt_a1b2c3d4/calendars \ -H "Authorization: Bearer chr_sk_your_key_here" \ -H "Content-Type: application/json" \ -d '{ "name": "Sales Meetings", "timezone": "America/New_York", "agent_status": "idle" }'from chronary import Chronary
client = Chronary()
# Agent-owned calendarcalendar = client.agents.calendars.create( "agt_a1b2c3d4", name="Sales Meetings", timezone="America/New_York", agent_status="idle",)
# Org-level calendarcalendar = client.calendars.create( name="Sales Meetings", timezone="America/New_York",)Response 201 Created
Section titled “Response 201 Created”{ "id": "cal_01H9X4M2P5R8T6V0", "orgId": "org_01H9X4M2P5R8T6V0", "agentId": "agt_01H9X4M2P5R8T6V0", "name": "Sales Meetings", "timezone": "America/New_York", "metadata": {}, "externalId": null, "provider": null, "deletedAt": null, "createdAt": "2026-04-04T12:00:00Z", "updatedAt": "2026-04-04T12:00:00Z", "agent_status": "idle", "default_reminders": null, "prevent_overlaps": false, "ical_url": "https://api.chronary.ai/ical/abc123def456.ics"}Errors
Section titled “Errors”| Status | Type | Cause |
|---|---|---|
400 | validation_error | timezone is not a time zone name the API accepts |
404 | not_found | Agent not found (POST /v1/agents/:agent_id/calendars) |
409 | agent_inactive | The agent is decommissioned. Restore it before adding calendars |
429 | quota_exceeded | Calendar limit reached on your plan |
Your calendar count for the plan limit includes org-level calendars and the calendars of active or paused agents. Calendars of a decommissioned agent are kept but don’t count; they count again if you restore the agent.
List calendars
Section titled “List calendars”GET /v1/calendarsGET /v1/agents/:agent_id/calendarsQuery parameters
Section titled “Query parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
include | string | — | Set to all to include agent-owned calendars (org-level endpoint only) |
q | string | — | Search: a case-insensitive substring of the calendar name, or an exact calendar ID (1–100 characters). Normalized like a stored name before matching, so a double space, a non-breaking space or an invisible character in q still finds the name |
cursor | string | — | The next_cursor from the previous page. Cannot be combined with a non-zero offset |
limit | integer | 50 | 1–200 |
offset | integer | 0 | Pagination offset, at most 10,000 |
GET /v1/calendars and GET /v1/agents/:agent_id/calendars return calendars newest first and include next_cursor in the response; pass it as cursor to fetch the next page. total always counts every match. An Agent key lists only its own agent’s calendars. GET /v1/agents/:agent_id/calendars returns 404 not_found when the agent doesn’t exist or belongs to another organization; an agent with no calendars returns an empty list.
Example
Section titled “Example”# List all org calendars including agent-ownedcurl "https://api.chronary.ai/v1/calendars?include=all" \ -H "Authorization: Bearer chr_sk_your_key_here"
# List calendars for a specific agentcurl "https://api.chronary.ai/v1/agents/agt_a1b2c3d4/calendars" \ -H "Authorization: Bearer chr_sk_your_key_here"# All calendars including agent-ownedfor cal in client.calendars.list(include="all"): print(cal.name)
# Agent-owned calendarsfor cal in client.agents.calendars.list("agt_a1b2c3d4"): print(cal.name)Response 200 OK
Section titled “Response 200 OK”{ "data": [ { "id": "cal_x1y2z3", "name": "Sales Meetings", "timezone": "America/New_York", "ical_url": "https://api.chronary.ai/ical/abc123def456.ics", ... } ], "total": 5, "limit": 50, "offset": 0, "next_cursor": null}Get a calendar
Section titled “Get a calendar”GET /v1/calendars/:idExample
Section titled “Example”curl https://api.chronary.ai/v1/calendars/cal_x1y2z3 \ -H "Authorization: Bearer chr_sk_your_key_here"calendar = client.calendars.get("cal_x1y2z3")Errors
Section titled “Errors”| Status | Type | Cause |
|---|---|---|
404 | not_found | Calendar not found |
Regenerate the subscribe URL
Section titled “Regenerate the subscribe URL”POST /v1/calendars/:id/ical-token/rotateReplaces the secret token in the calendar’s iCal subscribe URL and returns the calendar with its new ical_url. Use it when a subscribe URL has been shared too widely. The old URL stops working at once, although copies of the feed cached in other locations can still be served from it for up to 5 minutes. Calendar apps subscribed to the old URL must be re-subscribed with the new one.
Requires an Organization key or a console session. In the console you are asked to confirm your password first if you signed in more than 5 minutes ago. No webhook event is sent; the action is recorded in the audit log.
Example
Section titled “Example”curl -X POST https://api.chronary.ai/v1/calendars/cal_x1y2z3/ical-token/rotate \ -H "Authorization: Bearer chr_sk_your_key_here"calendar = client.calendars.rotate_ical_token("cal_x1y2z3")print(calendar.ical_url)const calendar = await client.calendars.rotateIcalToken('cal_x1y2z3');console.log(calendar.ical_url);Errors
Section titled “Errors”| Status | Type | Cause |
|---|---|---|
401 | reauth_required | Console session older than 5 minutes; re-authenticate and retry |
403 | forbidden | Agent keys cannot regenerate subscribe URLs |
404 | not_found | Calendar not found |
Get temporal context
Section titled “Get temporal context”GET /v1/calendars/:id/contextReturns a “what’s happening now” snapshot for a calendar: the currently active event, the next upcoming event, recently ended events, and everything starting in the next 24 hours. Designed for agents that want a single cheap call to orient themselves before planning or responding.
Recurring series are expanded into their occurrences, the same way expand=true lists them: each occurrence carries recurringEventId and originalStartTime, and shares its series’ id. Occurrences that ended in the last 30 days can appear in recent_events, and a series’ next occurrence is looked for up to 366 days ahead (a series that next recurs later than that, such as one every two years, shows no next_event from that series). When events overlap, current_event is the one that started most recently, for example a meeting inside a longer working-hours block.
Use cases
Section titled “Use cases”- An agent starting a turn reads context to decide whether it’s free, in a meeting, or about to start one.
- A status dashboard or MCP client surfaces a compact “right now” summary without paginating events.
- A planner looks at
upcoming(next 24h) to decide whether to schedule new work immediately or defer it.
Example
Section titled “Example”curl https://api.chronary.ai/v1/calendars/cal_01H9X4M2P5R8T6V0/context \ -H "Authorization: Bearer chr_sk_your_key_here"import { Chronary } from '@chronary/sdk';
const client = new Chronary({ apiKey: process.env.CHRONARY_API_KEY! });
const context = await client.calendars.getContext('cal_01H9X4M2P5R8T6V0');if (context.current_event) { console.log(`Busy until ${context.current_event.endTime}`);} else if (context.next_event) { console.log(`Next: ${context.next_event.title} at ${context.next_event.startTime}`);}Response 200 OK
Section titled “Response 200 OK”| Field | Type | Description |
|---|---|---|
calendar_id | string | The calendar this snapshot is for |
now | string (datetime) | Server-side timestamp the snapshot was computed at |
agent_status | string | The calendar’s current agent_status (see below) |
current_event | object | null | The event whose window contains now, or null if none |
next_event | object | null | The next event starting strictly after now, or null |
recent_events | array | Up to 3 most recently ended events, newest first |
upcoming | array | Up to 5 events starting within the next 24 hours, earliest first |
Cancelled and soft-deleted events are excluded from all four event lists.
{ "calendar_id": "cal_01H9X4M2P5R8T6V0", "now": "2026-04-16T14:05:00.000Z", "agent_status": "working", "current_event": { "id": "evt_01H9X4M2P5R8T6V0", "calendarId": "cal_01H9X4M2P5R8T6V0", "title": "Strategy sync with Acme Corp", "startTime": "2026-04-16T14:00:00.000Z", "endTime": "2026-04-16T14:30:00.000Z", "status": "confirmed", "source": "internal", "metadata": {}, "createdAt": "2026-04-10T12:00:00.000Z", "updatedAt": "2026-04-10T12:00:00.000Z" }, "next_event": { "...": "..." }, "recent_events": [ { "...": "..." } ], "upcoming": [ { "...": "..." } ]}Errors
Section titled “Errors”| Status | Type | Cause |
|---|---|---|
404 | not_found | Calendar not found |
Update a calendar
Section titled “Update a calendar”PATCH /v1/calendars/:idRequest body
Section titled “Request body”| Field | Type | Description |
|---|---|---|
name | string | 1–255 characters, after normalizing (see Names) |
timezone | string | A time zone name the API accepts (an IANA name such as America/New_York, or a UTC offset like +05:00); anything else returns 400 validation_error |
agent_status | string | idle, working, waiting, or error. See Agent status. |
default_reminders | integer[] | null | Replaces the calendar’s reminder defaults. Set to null to clear. See Reminder defaults. |
prevent_overlaps | boolean | true turns the double-booking guarantee on, false turns it off. Turning it on is refused while the calendar holds overlapping active events that have not ended yet, or a running recurring series |
metadata | object | Replaces existing metadata |
At least one field must be provided.
Example
Section titled “Example”curl -X PATCH https://api.chronary.ai/v1/calendars/cal_x1y2z3 \ -H "Authorization: Bearer chr_sk_your_key_here" \ -H "Content-Type: application/json" \ -d '{ "name": "Sales Meetings (Q2)" }'updated = client.calendars.update("cal_x1y2z3", name="Sales Meetings (Q2)")Errors
Section titled “Errors”| Status | Type | Cause |
|---|---|---|
404 | not_found | Calendar not found |
409 | conflict (code: calendar_has_overlaps) | prevent_overlaps: true was refused: active events on the calendar that have not ended yet overlap. They are listed in conflicting_event_ids (up to 50) |
409 | conflict (code: calendar_has_recurring_series) | prevent_overlaps: true was refused: the calendar has a running recurring series, listed in conflicting_event_ids (up to 25) |
409 | agent_inactive | The calendar belongs to a decommissioned agent and is read-only |
Delete a calendar
Section titled “Delete a calendar”DELETE /v1/calendars/:idReturns 204 No Content. Deleting a calendar removes all its events and its booking pages: their public links answer 404, they leave GET /v1/booking-pages, and they no longer count toward your plan’s booking-page limit. This works on a decommissioned agent’s read-only calendar too.
Example
Section titled “Example”curl -X DELETE https://api.chronary.ai/v1/calendars/cal_x1y2z3 \ -H "Authorization: Bearer chr_sk_your_key_here"client.calendars.delete("cal_x1y2z3")Errors
Section titled “Errors”| Status | Type | Cause |
|---|---|---|
404 | not_found | Calendar not found |
Agent status
Section titled “Agent status”Every calendar carries an agent_status field that lets an agent advertise its current operational state to anyone reading the calendar (other agents, dashboards, humans subscribed to the iCal feed). It defaults to idle on create and can be changed at any time via PATCH /v1/calendars/:id. It is also surfaced on GET /v1/calendars/:id/context so callers can read state and upcoming work in one request.
| Value | Meaning |
|---|---|
idle | The agent is running but has no active work. Available to take on new tasks. |
working | The agent is actively processing a task — e.g. running a tool, making API calls, or writing to a calendar. |
waiting | The agent is blocked on external input — awaiting a human reply, a webhook, or a dependent job. |
error | The agent has hit an unrecoverable failure and is not making progress. Operators should intervene. |
The field is free-form on the server — no transitions are enforced — so agents pick whichever value best describes their state. See the Advertising agent state pattern for a full example.
Reminder defaults
Section titled “Reminder defaults”default_reminders is an array of integers — minutes before an event’s start_time — that every event in the calendar inherits when it doesn’t set its own reminders. For example, [10, 1440] reminds 10 minutes and 1 day before. Up to 5 entries, each 1–40320 (28 days).
Resolution for any given event is: the event’s own reminders → the calendar’s default_reminders → the system default of [10]. A null value at either level means “inherit”; an empty array [] means “explicitly no reminders”. See Reminders on events for the full precedence rules and delivery behavior.
Double-booking guarantee
Section titled “Double-booking guarantee”A calendar with prevent_overlaps: true refuses any write that would leave two active events overlapping on it. Active means status confirmed, tentative or hold; a hold past its hold_expires_at never blocks. Times are half-open, so back-to-back events are allowed. The check covers creating an event, moving one, setting a cancelled event back to confirmed or tentative, and confirming a hold, and it holds when many requests race for the same slot: exactly one succeeds.
A refused write returns 409 with type: "conflict", code: "event_conflict" and up to 10 conflicting_event_ids; a new hold that collides only with live holds of equal or higher priority gets the usual hold answer (409 conflict, no code). A recurring series cannot be created on such a calendar (code: "recurring_on_protected_calendar"). Imported iCal events and connected-calendar busy time are not covered, and the guarantee is per calendar. It is off by default and available on every plan. See the guide for the full list of what is and isn’t guaranteed.