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, 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 have one calendar, but you can create multiple (e.g., separate calendars for “Client Meetings” and “Internal Syncs”).

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",
"name": "Dr. Chen — Patient Appointments",
"timezone": "America/New_York",
"agent_id": "agt_a1b2c3d4",
"ical_url": "https://api.chronary.ai/ical/abc123.ics",
"metadata": {},
"created_at": "2026-04-04T10:00:00Z",
"updated_at": "2026-04-04T10:00:00Z"
}

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.

| Status | Code | Cause | |--------|------|-------| | 400 | invalid_timezone | The timezone value is not a valid IANA identifier | | 400 | metadata_too_large | The metadata object exceeds 16 KB | | 404 | agent_not_found | The agent_id in the URL does not exist | | 404 | calendar_not_found | The calendar ID does not exist or does not belong to your organization | | 409 | calendar_has_events | Attempted to delete a calendar that still has events (delete events first) |