Skip to content

Calendars

Calendars are the core container for events in Chronary. There are two kinds:

  • Agent-owned calendars belong to a specific agent (e.g., “Dr. Chen’s Patient Appointments”).
  • Org-level calendars are shared across your organization (e.g., “Conference Room B” or “Company Holidays”).

By the end of this guide you will be able to create both types of calendars (within your plan’s calendar limit), list and retrieve them, update their properties, and delete them when no longer needed.

  • A Chronary account with an API key
  • At least one agent created (see the quickstart)

Org-level calendars are not tied to any agent. Use them for shared resources like meeting rooms or company-wide schedules.

Terminal window
curl -X POST https://api.chronary.ai/v1/calendars \
-H "Authorization: Bearer chr_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Conference Room B — 4th Floor",
"timezone": "America/Chicago",
"metadata": {
"capacity": 12,
"building": "HQ",
"floor": 4,
"amenities": ["projector", "whiteboard", "video_conferencing"]
}
}'

Agent-owned calendars belong to a specific agent. Most agents need one calendar. On a plan with more than one, you can create several (e.g., separate calendars for “Client Meetings” and “Internal Syncs”). On Free, this is the same single calendar as the org-level one above: a second create is refused with 429 quota_exceeded until you delete the first.

Terminal window
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": "Dr. Chen — Patient Appointments",
"timezone": "America/New_York"
}'

List org-level calendars or all calendars belonging to a specific agent.

Terminal window
# Org-level calendars
curl https://api.chronary.ai/v1/calendars \
-H "Authorization: Bearer chr_sk_your_key_here"
# Agent-owned calendars
curl https://api.chronary.ai/v1/agents/agt_a1b2c3d4/calendars \
-H "Authorization: Bearer chr_sk_your_key_here"

Retrieve full details for a calendar by ID. The response includes the ical_url you can use to subscribe from any calendar app.

Terminal window
curl https://api.chronary.ai/v1/calendars/cal_x1y2z3 \
-H "Authorization: Bearer chr_sk_your_key_here"

Example response:

{
"id": "cal_x1y2z3",
"orgId": "org_a1b2c3",
"agentId": "agt_a1b2c3d4",
"name": "Dr. Chen — Patient Appointments",
"timezone": "America/New_York",
"metadata": {},
"externalId": null,
"provider": null,
"deletedAt": null,
"createdAt": "2026-04-04T10:00:00Z",
"updatedAt": "2026-04-04T10:00:00Z",
"agent_status": "idle",
"default_reminders": null,
"ical_url": "https://api.chronary.ai/ical/abc123.ics"
}

Change the name, timezone, or metadata of an existing calendar. Only the fields you include are updated.

Terminal window
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": "Dr. Chen — All Appointments",
"metadata": {
"department": "cardiology",
"location": "Building A, Suite 200"
}
}'

Deleting a calendar permanently removes it and all of its events. This action cannot be undone.

Terminal window
curl -X DELETE https://api.chronary.ai/v1/calendars/cal_x1y2z3 \
-H "Authorization: Bearer chr_sk_your_key_here"

Every calendar has an agent_status field that lets an agent broadcast what it’s currently doing. It’s a single enum — idle, working, waiting, or error — that another agent, a dashboard, or a human subscriber can read to know whether the owner is free, busy, stuck, or broken.

A typical agent lifecycle looks like this:

  1. Start in idle (the default on create).
  2. Flip to working when a task begins.
  3. Flip to waiting if the agent pauses on external input (a human reply, a webhook, a dependent job).
  4. Flip back to working when input arrives, then back to idle when the task finishes.
  5. Flip to error on an unrecoverable failure so operators know to intervene.

Update the field with a regular PATCH on the calendar:

Terminal window
# Mark the agent as working
curl -X PATCH https://api.chronary.ai/v1/calendars/cal_01H9X4M2P5R8T6V0 \
-H "Authorization: Bearer chr_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "agent_status": "working" }'
# ... later, when blocked on a human reply
curl -X PATCH https://api.chronary.ai/v1/calendars/cal_01H9X4M2P5R8T6V0 \
-H "Authorization: Bearer chr_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "agent_status": "waiting" }'
# ... and back to idle when done
curl -X PATCH https://api.chronary.ai/v1/calendars/cal_01H9X4M2P5R8T6V0 \
-H "Authorization: Bearer chr_sk_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "agent_status": "idle" }'

Consumers read the current value from GET /v1/calendars/:id (on the response body) or from GET /v1/calendars/:id/context alongside the temporal snapshot. The server doesn’t enforce any specific transition — pick whichever value best describes the agent’s state at the moment.

Every calendar has a metadata field that accepts any valid JSON object up to 16 KB. Use it to store application-specific data like room capacity, department codes, or external system IDs.

{
"metadata": {
"salesforce_id": "001ABC",
"department": "engineering",
"color": "#4A90D9"
}
}

The timezone field must be a valid IANA timezone identifier such as America/New_York, Europe/London, or Asia/Tokyo. The timezone is used when generating iCal feeds and computing availability.

Every calendar response includes an ical_url field. This is a live feed that can be subscribed to from Google Calendar, Apple Calendar, Outlook, or any other app that supports iCal. See the iCal feeds guide for details on subscribing.

StatusCodeCause
400validation_errorThe timezone value is not a time zone name the API accepts (an IANA name such as America/New_York, or a UTC offset like +05:00)
400validation_errorThe metadata object exceeds 16 KB (param: "metadata")
403forbiddenAn Agent key was used on a calendar it does not own
404not_foundThe agent_id in the URL does not exist (“Agent not found”)
404not_foundThe calendar ID does not exist or does not belong to your organization (“Calendar not found”)
409agent_inactiveThe agent is decommissioned: it can’t get new calendars, and its calendars are read-only until it is restored
429quota_exceededCalendar limit reached on your plan (metric: "calendars")

Deleting a calendar never fails because the calendar still has events: the delete succeeds and the events go with it.