Reference
REST API
Authentication, errors, pagination and every endpoint of the Comity API, grouped by area.
On this page
- Authentication
- Errors
- Pagination
- Rate limits
- Selectors and references
- Hooks
- Account
- Your account and data
- Repositories and projects
- Intents
- Conflicts
- Shared tasks
- Team decisions
- Messages and conversations
- Ask my agent
- Autopilot
- Coordination context
- Team memory
- Policies
- Members, invites and tokens
- Events, stats and streaming
- SSE stream
- Integrations
- Notion
- Slack DMs
- Billing
- Browser sign-in
- Single sign-on
- Health
- MCP
Base URL: https://api.comity.so. All REST endpoints are under /v1, take and return JSON, and use the same objects as the MCP tools.
Authentication
curl https://api.comity.so/v1/me -H "Authorization: Bearer cmt_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"{
"user": { "id": "0199…", "email": "diego@acme.com", "name": "Diego" },
"org": { "id": "0199…", "slug": "acme", "name": "Acme Inc", "data_mode": "full", "auto_register_repos": true },
"role": "member",
"token": { "id": "0199…", "name": "cli · diego-laptop", "kind": "pat", "scopes": ["hooks:evaluate", "mcp:tools", "…"] }
}- A token belongs to one org; there is no org parameter. A token request may add
X-Comity-Org: <slug>(the CLI does in repos with acomity.json): if the token belongs to another org, every/v1/*and/mcpcall gets409 org_mismatch(extensions: {org, token_org}) before anything is read or recorded. - Personal tokens (
pat) act as their user with that user's role.comity logincreates one per machine. Owners and admins can mint more for themselves withPOST /v1/tokens; only owners can mint one for another member (user_email), never for another owner. - Service tokens (
service) have no user. Endpoints marked "personal token" below reject them with 403. They can't holdhooks:evaluateormcp:tools. - Each endpoint requires a scope. Some also require a role: "admin" below means owner or admin.
Invalid, expired or revoked tokens get 401 with WWW-Authenticate: Bearer realm="comity". A personal token stops working when its user leaves the org.
The dashboard uses a session cookie with an X-Comity-Org: <slug> header and X-Comity-CSRF: 1 on writes; cookie sessions can't call hooks or MCP. Use tokens for integrations.
Errors
Errors are RFC 9457 application/problem+json:
{
"type": "urn:comity:problem:validation",
"title": "Invalid request",
"status": 400,
"detail": "request failed validation",
"errors": [{ "path": "title", "message": "String must contain at least 1 character(s)" }]
}type suffix |
Status | When |
|---|---|---|
bad-request |
400 | Malformed request |
validation |
400 | Body or query failed validation; see errors[] |
unauthorized |
401 | Missing, invalid, expired or revoked token |
plan_limit |
402 | Plan limit reached (repos; developers in MCP) |
forbidden |
403 | Missing scope or role |
not-found |
404 | Unknown resource or route |
conflict |
409 | State conflict (already exists, already closed, …) |
org_mismatch |
409 | X-Comity-Org names an org the token doesn't belong to |
rate-limited |
429 | Message or question rate limit; see Retry-After |
unsupported-protocol |
400 | Hooks: X-Comity-Protocol is not 1 |
internal |
500 | Server error |
Billing and sign-in endpoints add their own types (billing_unavailable, already_subscribed, invalid_credentials, …).
Pagination
List endpoints take limit (default 50, max 200) and cursor, and return:
{ "items": [], "next_cursor": "MTI" }Pass next_cursor as cursor for the next page. next_cursor is null on the last page. Lists described as "unpaged" always return next_cursor: null. Comma-separated values work for multi-value filters (status=open,acknowledged).
Rate limits
- Messages: 20 per minute and 200 per day per user.
- Questions: 10 per minute and 100 per day per user.
Exceeding a limit returns 429 with Retry-After in seconds.
Selectors and references
- Repo:
owner/nameor a remote fingerprint such asgithub.com/acme/api(for a repo without a remote,root:<sha>of its first commit). - Intent:
INT-12or12. Conflict:CF-9or9. Task:T-4,4or its id. Work request:WR-2,2or its id.
Hooks
| Method | Path | Scope | Notes |
|---|---|---|---|
| POST | /v1/hooks/evaluate |
hooks:evaluate |
What comity hook calls on each agent event. Optional header X-Comity-Protocol: 1. See Hook events. The response's fail_mode and fail_closed_paths are what the CLI caches for fail-closed enforcement. With probe: true (what comity doctor sends) the call is read-only: it answers allow with an empty session_id, the effective fail_mode and fail_closed_paths, but starts or ends no session, registers no repo, delivers no messages, questions, answers, handoffs or arrival notices, records no usage and emits no events. |
| POST | /v1/hooks/fail-open |
hooks:evaluate |
The CLI's queued fail-open override reports, {reports: [{id, remote, via: "env"|"command", reason?, first_at, last_at, count, paths, tools, until?}]} (≤ 50, personal token). Each new id becomes one hook.fail_open event; returns {recorded, duplicates}. |
Account
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/me |
any | User, org (incl. data_mode, auto_register_repos), role, token |
| PATCH | /v1/org |
policy:write, personal token |
{data_mode?: "full"|"metadata_only", auto_register_repos?: boolean, name?: string}. name: owners and admins; 1–100 characters, trimmed; the slug doesn't change; logged as org.settings_changed ({setting: "name", from, to}). data_mode: owners only; switching to metadata_only clears stored signature text (see Data modes). auto_register_repos: owners and admins; when false, hooks don't register unknown repos unless the request names the org (X-Comity-Org); changes are logged as org.settings_changed. Returns {org, previous_data_mode, cleared_signatures}. |
| GET | /v1/usage |
members:read |
Plan, limits, active developers and repos this month; per-developer list for admins. active_developers: {count, over_limit, former_members, coordinated, gated, items?}: count is everyone active this month (what paid plans bill), former_members of them removed since, coordinated/gated the current members within/over the limit, over_limit = gated > 0. Each item has gated and former (email "(former member)", role null). See Billing & plans |
Your account and data
These routes need a signed-in browser session (the __Host-comity_session cookie the dashboard uses). An API token gets 403 browser_session_required. Writes need X-Comity-CSRF: 1 from an allowed origin. See Data export & deletion for what each one keeps and deletes.
| Method | Path | Who | Notes |
|---|---|---|---|
| GET | /v1/me/account |
you | {user: {id, email, name, email_verified, has_password, github_login, created_at}, orgs} |
| PATCH | /v1/me/account |
you | {name}; null or "" clears it |
| POST | /v1/me/password |
you | {current_password, new_password} (each at most 256 characters). Signs out your other browsers, revokes your personal and CLI tokens in every org (run comity login again) and emails you a notice. 204; 409 no_password for GitHub-only accounts |
| GET | /v1/me/export |
you | Your data as a JSON download. 5 per hour |
| GET | /v1/me/deletion |
you | {blocking_orgs, orgs_deleted_with_account, reauth, recent_login} |
| DELETE | /v1/me |
you | {confirm: <your email>, password?, delete_orgs: [slug]}. 409 sole_owner, 409 orgs_need_confirmation, 401 reauth_required / invalid_credentials |
| GET | /v1/org/export |
owner (X-Comity-Org) |
The org's data as a JSON download. 5 per hour per org. Logged as org.exported |
| DELETE | /v1/org |
owner (X-Comity-Org) |
{confirm: <slug>, password?}. Cancels the Stripe subscription and removes saved payment methods first. 502 billing_provider_error when Stripe fails: if the cancellation failed, nothing changed; if only removing payment methods failed, the subscription is already canceled and the org is not deleted yet (retrying doesn't cancel it again) |
Repositories and projects
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/repos |
repos:read |
Unpaged |
| POST | /v1/repos |
repos:write, admin |
{full_name, provider?: "github"|"gitlab"|"bitbucket"|"generic", default_branch?: "main", remotes?: []}. Repos are also registered automatically on the first hook event (unless auto_register_repos is off) and by comity init. 409 if it exists, 402 over the plan's repo limit. |
| POST | /v1/repos/register |
hooks:evaluate |
{remote_fingerprints: [string], repo_name?} (1–10 fingerprints: remotes, then root:<sha> of the first commit for a young history or a repo without a remote; repo_name, the folder name, names a repo without a remote local/<repo_name>-<sha:7>). What comity init calls: registers the repo exactly as its first hook would; a known repo gains the fingerprints it lacks (a remote added to a repo first used without one, which then takes the remote's owner/name). X-Comity-Org naming the org counts as bound, so auto_register_repos: false doesn't stop it. Returns {status: "registered" | "already_registered" | "not_coordinated", repo, notice?}; not_coordinated (no room in the plan's repo limit, an unbound repo while auto_register_repos is off, or a suspended org) registers nothing and carries the notice agents would get. |
| GET | /v1/projects |
repos:read |
Unpaged. Each project: {id, name, repos: [{id, full_name}], created_at, sync}, see below |
| GET | /v1/projects/:id |
repos:read |
|
| POST | /v1/projects |
repos:write, admin |
{name, repos: [selector]} |
| POST | /v1/projects/:id/repos |
repos:write, admin |
{repos: [selector]} |
| DELETE | /v1/projects/:id/repos/:repo |
repos:write, admin |
:repo = repo id or URL-encoded owner/name |
| DELETE | /v1/projects/:id |
repos:write, admin |
204 |
A project's sync is {watched, watched_names, out_of_sync, conflicts}: watched counts the contracts Comity matches across its repos (their http: routes and the exported symbols under a package they publish, as recorded from agents' changes; repos whose cross_repo_contracts is off don't count, and fewer than two repos watch nothing), watched_names names the first 5 ("POST /checkout", "OrderSummary type"), out_of_sync counts the contracts changed in one of its repos while code in another uses them (live cross-repo conflicts between two of its repos, one per contract), and conflicts lists those conflicts (CF-n, newest first, at most 10).
Intents
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/intents |
intents:read |
?repo=&owner=me|<email>&status=live|<statuses>&limit=&cursor= |
| POST | /v1/intents |
intents:write |
Same body as intent_declare. 201 {intent, conflicts} |
| GET | /v1/intents/:ref |
intents:read |
|
| GET | /v1/intents/:ref/context |
intents:read |
{items}: the intent's unexpired context packs you may read, newest first: those of its task releases (everyone), and those of its handoffs only if you wrote one, handed it off or received it, or own the intent now. Each item: {id, kind: "handoff"|"release", by: {id, email, name}, tool, structural_only, created_at, expires_at, follow_up: {to, copy}|null, summary, decisions[{what, why}], files[{path, action, why}], commands[{command, outcome, note}], open_questions[], next_steps[], links[{url, label}]} |
| PATCH | /v1/intents/:ref |
intents:write |
Owner or admin. Same fields as intent_update's patch plus note. tried (≤ 10 items, {what, result?} or a string) adds to the intent's Tried, didn't work notes, which a later handoff or task release carries. Returns {intent, conflicts} |
| POST | /v1/intents/:ref/close |
intents:write |
{outcome: "merged"|"abandoned"|"handoff", note?, handoff_to?, tried?, context?}. tried is recorded on the intent first, so the handoff bundle or a released shared task carries it. context (a context pack, as in the handoff) only with handoff. Agent sessions working on it are told at their next tool call, prompt or resume (who closed it, the note). 409 on an already closed intent says who closed it and how to reopen it |
| POST | /v1/intents/:ref/reopen |
intents:write |
Owner or admin. No body. Undoes a merged/abandoned close within 24 h: back to the status it closed from (in_review stays in_review, a draft stays a draft, otherwise active) with the claims and recorded changes the close released. The owner's agent sessions that were working on it when it closed carry it again (an ended one when it resumes); others use intent_adopt. Emits intent.reopened. Returns {intent, conflicts}. 409 if it isn't closed or was closed more than 24 h ago |
| POST | /v1/intents/:ref/handoff |
intents:write |
Owner or admin. {to: <member email>, note?, tried?, context?, context_source?, dry_run?} (note up to 2,000; tried up to 10 items, {what, result?} or a string, each text cut to 300; context a context pack, more items than a field's limit → 400; context_source {tool, external_id}: the local agent session the pack was built from, so a read-only copy of it answers follow-ups). Returns {intent, handoff}; handoff = {id, intent, from, to, note, thread_id, message_id, created_at, adopted_at, bundle, context_note?}. bundle.tried: [{what, result, at}], newest first, the handoff's items merged with the intent's recorded ones (absent when none). bundle.context: the stored pack (as in GET /v1/intents/:ref/context). context_note: what happened to your pack (sent, redactions, trimming, what a metadata_only org dropped). With dry_run: true it runs the same checks, writes nothing and returns {dry_run: true, to, bundle, sender_sessions} (bundle.protected_paths: protected paths the recipient doesn't own; bundle.context: the pack as it would be stored; sender_sessions: [{tool, external_id}], your agent sessions that carried the intent, newest first, which comity handoff builds the pack from). 400 if the recipient can't own intents (viewer, billing), 404 unknown member, 409 intent closed or already theirs. See Handoffs. |
status=live means draft, active, blocked, in_review.
An open intent handed off and not adopted yet by the recipient's agent carries handoff: {from: {id, email, name}|null, to: {id, email, name}, created_at, plan, files, tried, next_steps} (whether it has a plan, the files touched at handoff time, its "tried, didn't work" notes and the handoff's context pack next steps, null without a pack). Absent otherwise.
A teammate's draft (an auto-drafted intent nobody confirmed yet) is listed and readable once it takes part in coordination (it is a side of a conflict or holds recorded changes), so the intents that /v1/conflicts names resolve; its title reads (unconfirmed intent) and summary/plan_md are null for everyone but its owner. Org owners and admins see every draft (and may close it).
curl -X POST https://api.comity.so/v1/intents \
-H "Authorization: Bearer $COMITY_TOKEN" -H "Content-Type: application/json" \
-d '{"repo": "acme/api", "title": "Add invoice PDF export", "scope": {"paths": ["apps/api/src/invoices/**"]}}'Conflicts
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/conflicts |
conflicts:read |
?status=live|<statuses>&mine=true&repo=&intent=&limit=&cursor=. repo also matches cross-repo conflicts where the repo is the dependent side. |
| GET | /v1/conflicts/:ref |
conflicts:read |
|
| POST | /v1/conflicts/:ref/actions |
conflicts:write |
Participant or admin. {action, note?}; actions as in conflict_respond. Header X-Comity-Session: <uuid> acts as one of your agent sessions. |
| POST | /v1/conflicts/:ref/sequence |
conflicts:write |
Participant or admin. {first: "a"|"b"}: that side lands first. The other side's intent gets a dependency on it, the conflict moves to resolving with resolution_note "Sequenced: Tyler lands first" (the intent's ref when both sides are one developer's) and sequence: {first}, and both sides' agents see the order with the changed conflict at their next tool call. Picking the other order later removes the dependency the first pick added. Returns the conflict. 409 when the conflict is closed, a side isn't an intent (a protected path, a team decision), or the first side already depends on the other |
| POST | /v1/conflicts/:ref/feedback |
conflicts:write |
{verdict: "useful"|"false_positive"|"too_late"}. 204 |
| POST | /v1/conflicts/:ref/override |
conflicts:write |
{reason}: 3–2,000 characters, trimmed; optional when the policy sets override.require_reason: false. Role must be in the policy's override.allowed_roles. |
status=live means open, acknowledged, resolving.
A conflict carries resolution_note (what whoever last acted said: a conflict_respond note, an override reason, "Sequenced: Tyler lands first"; null when none) and sequence ({first: "a"|"b"} once a person picked the order with /sequence, else null).
Shared tasks
See Shared tasks. Writes need the role owner, admin or member. Calls made as an agent session pass X-Comity-Session: <uuid>.
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/task-lists |
intents:read |
?repo=&include_archived=true&limit=(≤200)&cursor=. Each list has source (file|agent|github|notion), source_ref, title, repo, external_url and counts {open, claimed, done, dropped}. Notion lists also have sync {synced_at, error, next_at} (the last good read, the last read's error or null, the next read); other sources omit it or send null |
| POST | /v1/task-lists/import |
intents:write |
A markdown file's items: {repo, source: "file", path, title?, version_ms?, content_sha?, items: [{key?, title, body?, done?, depends_on_keys?}]} (≤ 500). Upserts by key and never deletes; a missing open item becomes dropped only when version_ms is newer than the last import. With a session header it also becomes that session's working list |
| POST | /v1/task-lists |
intents:write |
{source: "agent", repo?, title, source_ref?, items}, {source: "github", repo, title?, filter: {labels?, milestone?}} or {source: "notion", url, repo?, title?}. Returns {list, tasks}. For Notion, url is a page or database link, a bare id, or a ref from GET /v1/notion/search; omitting repo makes an org-wide list; 201 when created, 200 when the list already existed (it is re-synced). Notion errors: 400 not a Notion link, 409 notion-not-connected, 404 notion-not-found (not shared with the connection), 429 notion-rate-limited, 502 notion-error |
| PATCH | /v1/task-lists/:id |
intents:write |
{title?, archived?} |
| GET | /v1/github/task-lists/repos |
repos:read |
The repos a GitHub Issues list can come from (linked through an active GitHub App installation): {items: [{id, full_name, issues}]}, issues = the installation's Issues permission (read|write), null while it isn't granted |
| POST | /v1/github/task-lists/:id/sync |
intents:write |
Re-reads a GitHub list's open issues. Returns {list_id, created, imported, filter} |
| POST | /v1/notion/task-lists/:id/sync |
intents:write |
Reads a Notion list's page or database now. See Notion |
| GET | /v1/tasks |
intents:read |
?list=&repo=&status=open,claimed&assignee=me&limit=(≤500)&cursor=, in queue order |
| GET | /v1/tasks/:ref |
intents:read |
A task carries tried ([{what, result, at}], newest first, ≤ 10; absent when none): what earlier attempts tried that didn't work. See Already tried. context: the context pack of the latest release that carried one, while it is kept (absent otherwise) |
| POST | /v1/tasks/:ref/claim |
intents:write |
As an agent session. 409 problems already_claimed, blocked_by, assigned_elsewhere, one_claim_per_session carry {task, claimed_by?, blocked_by?, next?} |
| POST | /v1/tasks/:ref/release |
intents:write |
{note?, tried?, context?}. The claimer, or anyone who may write from the dashboard. tried (≤ 10 items) is merged with the claim intent's recorded notes and the task's earlier ones into task.tried. context: a context pack for the next claimer (task.context) |
| POST | /v1/tasks/:ref/progress |
intents:write |
{done, total}: the agent's own todo list |
| POST | /v1/tasks/:ref/done |
intents:write |
{branch?, commit?, note?}. Done means landed: on a task whose intent changed code, without commit the task is done but awaiting_landing (its dependents stay blocked; landing records the commit and clears it); commit (pushed) completes it, also on a second call. Landing on the default branch does all this by itself |
| PATCH | /v1/tasks/:ref |
intents:write |
{title?, position?, before?, after?, status?: "open"|"dropped", assign_to?, note?}. before/after move it next to another task; assign_to (email or user id, null clears) queues it for yourself or sends a teammate a work request. Returns {task, work_request} |
| POST | /v1/work-requests |
intents:write |
{to, task_ids, message?, urgent?, tried?}; urgent: true only when the user says it's urgent: once accepted, its tasks come before the recipient's plan (queue order). to is an email, user id, a member's name, first name or email handle (Mike, @mike; several matches → 400), session:<uuid> or intent:INT-n. tried (≤ 10 items) goes onto every listed task. 201. To yourself it is accepted at once |
| GET | /v1/work-requests |
intents:read |
?direction=in|out|all&status=pending,expired&limit=&cursor= |
| GET | /v1/work-requests/:ref |
intents:read |
|
| POST | /v1/work-requests/:ref/respond |
intents:write |
The recipient: {accept, note?, confirmed_by_human?}. From an agent session (X-Comity-Session), accepting needs confirmed_by_human: true, and is refused (403 human_answer_needed) when that session can't show an approval prompt (Codex with approval policy never); a dashboard answer is your own. Pending and expired (≤ 7 days) requests are answerable. Returns {request, claimed, queued, skipped} |
| POST | /v1/work-requests/:ref/cancel |
intents:write |
The sender, while it is pending |
Team decisions
See Team decisions. Owners and admins create, change and retire decisions directly; a decision's owner changes it directly and confirms changes to it; members' creates and edits are proposals. Viewers read only. Bodies are the decision_record and decision_propose_change inputs.
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/decisions |
intents:read |
?repo=<owner/name>&status=active,proposed&q=&limit=(≤200). A repo filter includes org-wide decisions; repo=org lists only org-wide ones. Returns {items, total} |
| GET | /v1/decisions/:ref |
intents:read |
D-n. The decision with versions (newest first) |
| POST | /v1/decisions |
intents:write |
{title, why?, repo? | org_wide?, scope?, enforce?, mode?, owner?, supersedes?, source?}; without repo it is org-wide. 201 {decision, dropped, applied}: active right away for owners and admins (applied: true), proposed for members |
| PATCH | /v1/decisions/:ref |
intents:write |
Only the fields sent change: {title?, why?, scope?, enforce?, mode?, owner?, retire?, note?}. Applied directly for owners, admins and the decision's owner; otherwise a pending proposal. 409 while someone else's proposal for it is pending |
| POST | /v1/decisions/:ref/confirm |
intents:write |
{version?}: confirm the pending proposal (pass the version you reviewed) |
| POST | /v1/decisions/:ref/reject |
intents:write |
{version?, note?}: reject the pending proposal; the proposer withdraws their own the same way |
| POST | /v1/decisions/:ref/retire |
intents:write |
{note?}. Applied directly, or proposed like a change |
| POST | /v1/context-packs/:id/decisions/:index/promote |
intents:write |
A context pack's decisions[index] becomes a proposed team decision (source context_pack). 201 |
Every write returns {decision, dropped, applied}: dropped lists the fields a metadata_only org didn't store (why, note, source.label). A decision carries can {confirm, edit, retire, withdraw} (what you may do), pending (the proposal waiting, or null) and structural_only (metadata-only: title and structural fields only).
Messages and conversations
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/messages |
messages:read, personal token |
Your inbox. ?unread_only=true&limit=&cursor=. Returned messages are marked read. Each carries replied: true once you posted in its direct thread after it arrived; unread_only leaves those out. |
| POST | /v1/messages |
messages:write |
{to, body, subject?, requires_ack?, session_id?}; targets as in message_send. 201 |
| POST | /v1/messages/:id/ack |
messages:write |
{id, acked_at} |
| GET | /v1/conversations |
messages:read |
?kind=channel|direct&limit=(≤100)&cursor= |
| GET | /v1/conversations/:id |
messages:read |
|
| GET | /v1/conversations/:id/messages |
messages:read |
?limit=&before=<message id>; oldest → newest; next_cursor is the before for the older page |
| POST | /v1/conversations/:id/messages |
messages:write |
{body, requires_ack?}. In a direct thread only participants may post. |
Channels are conversations with kind: "channel": #team and one per repo. Reading conversations in the dashboard marks messages read without hiding them from your agents.
Ask my agent
See Ask my agent. A browser session or a personal token; send X-Comity-Org like other /v1 calls. Viewers and billing contacts get 403.
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/me/ask-my-agent |
you | Your setting in this org and this month's use: {enabled, available, plan, model, effort, monthly_cap, month, used, remaining, blocked}. available: the plan includes it (Team and up). model: null is the agent's cheap default. month is the UTC month (YYYY-MM) used/remaining count. blocked: why copies don't answer now (off, plan, cap, role), else null |
| PATCH | /v1/me/ask-my-agent |
you | {enabled?, model?: string|null, effort?: "low"|"medium"|"high", monthly_cap?: 1–10000}. Returns the same object as GET. enabled: true on the Free plan: 402 plan_required. Logged as ask_my_agent.updated |
| POST | /v1/ask-my-agent/wait |
you (the CLI) | {wait_seconds?, machine_id_hash}. Long poll for questions and messages a copy may answer |
| POST | /v1/ask-my-agent/items/:id/claim |
you (the CLI) | {session_external_id, tool}. Claims an item for one copy; fails when one of your agents has already seen it |
| POST | /v1/ask-my-agent/items/:id/finish |
you (the CLI) | {outcome: "answer"|"noted"|"skip"|"failed", text?, model?, error?}. answer and noted post the reply (author.via_copy: true) and emit ask_my_agent.answered |
Autopilot
See Autopilot. A browser session or a personal token; send X-Comity-Org like other /v1 calls.
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/me/autopilot |
you | Your autopilot in this org: {enabled, available, plan, upgrade_notice, acknowledged, trust: "everyone"|"people", people: [user], repos: [{id, full_name}]|null, enabled_at, waiting_sessions: [{id, tool, repo, since}], summary, away_summary}. away_summary: Summary when you're back is on (every plan). available: the plan includes it (Team and up); otherwise upgrade_notice says what to do. repos: null is every repository. Viewers and billing contacts always get enabled: false |
| PATCH | /v1/me/autopilot |
you | {enabled?, acknowledge?: true, trust?, people?: [id|email|name], repos?: [id|full_name]|null, via?, away_summary?: boolean}. Setting people implies trust: "people". Returns the same object; when the call turned autopilot off, summary is what the agent did meanwhile (null: nothing). Errors: 402 plan_feature (Free plan; detail is the upgrade notice), 409 autopilot_ack_required (turning on before the warning was answered: detail is the warning; resend with acknowledge: true after the user typed yes), 403 forbidden (viewer or billing role), 400 naming an unknown person or repository. Logged as autopilot.updated |
| POST | /v1/autopilot/wait |
you (the CLI) | {session: {tool, external_id}, wait_seconds: 0–55, remind_held?}. The waiting Stop hook's long poll. Returns {status: "work"|"waiting"|"off"|"unavailable", prompt, task, request, session_id, notice}: work claims the next task queued for you in that session's repository and prompt is what the agent does now |
Work requests accepted by autopilot have accepted_by_autopilot: true (GET /v1/work-requests), and their work_request.sent / work_request.accepted events carry autopilot: true.
Coordination context
| Method | Path | Scope | Notes |
|---|---|---|---|
| POST | /v1/team-context |
intents:read |
Body as team_context |
| POST | /v1/scope-check |
intents:read |
Body as scope_check. Writes nothing. |
| GET | /v1/sessions |
intents:read |
?active=true&repo=&limit=&cursor=. {id, repo, user, tool, model, branch, status, intent: {number, ref, title} | null, changes, started_at, last_heartbeat_at}. changes: edits the session's agent recorded. intent.title is null for a teammate's draft. |
| GET | /v1/sessions/timeline |
intents:read, conflicts:read |
?since=<ISO time, ≤ 7 days ago>&repo=. Sessions alive since then (≤ 500, latest heartbeat first): {since, truncated, sessions: [{id, repo, user, tool, branch, status, intent, spans: [{kind: working | idle | conflict, from, to (null = still running), conflict: {number, ref, severity} | null}]}]}. Conflict spans run from detection to resolution for conflicts involving the session or its intent (false positives excluded), clipped to the session's lifetime and since. |
| GET | /v1/presence |
intents:read, personal token |
?repo=&session_id=&limit=(≤100). Teammates' live agents, never your own. uncoordinated: [{user, tool, repo, branch, paths, last_seen_at}], teammates' agents active in the last 30 min that the plan's developer limit leaves uncoordinated (no conflicts are computed for them). |
| GET | /v1/attention |
personal token; conflicts:read and/or messages:read |
?limit=(≤100, default 50). The Needs you queue for the caller: {items, total, by_kind}. Kinds the token can't read are skipped. |
| POST | /v1/attention/dismiss |
personal token | {ids: [item id]} (≤ 100). Hides the items for you until they change. 204 |
Team memory
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/search |
personal token; read scope per kind | ?q=&kinds=&repo=&limit=(≤50, default 20). Kinds as in history_search, including context (context packs; scope intents:read). Kinds you can't read are skipped. |
| POST | /v1/questions |
messages:write |
Body as ask. 201 |
| POST | /v1/questions/:id/answers |
messages:write |
{answer, session_id?}. 201 |
Policies
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/policies |
policy:read |
?repo=. {repo_name, org, repo, effective} |
| PUT | /v1/policies |
policy:write, admin |
?repo=. {rules: {…}} replaces that scope's stored rules with exactly the keys sent; unset rules inherit (repo → org → defaults), and a repo's protected_paths add to the org's. Returns the GET shape plus warnings (repo protected paths that override an org rule with the same glob). See Policies. |
Members, invites and tokens
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/members |
members:read |
Paged |
| POST | /v1/members |
members:write, admin |
{email, role?: "member"}. Sends an email-bound invite (nobody joins without accepting); same response as POST /v1/invites, and it never says whether the address already has a Comity account. 409 if they're already a member. Only owners invite owners, admins or billing contacts. |
| DELETE | /v1/members/:userId |
members:write, admin, personal token |
Revokes their tokens for the org, the tokens they created for other members and the service tokens they created (member.removed payload tokens_revoked). Only owners remove owners or admins. 204 |
| PATCH | /v1/members/:userId |
members:write, admin |
{role}. Returns the member {user, role, created_at}. Only owners grant or change owner and admin, and only owners make someone a billing contact; admins move people between member and viewer (and can take billing away). The last owner can't be demoted (409). A demotion revokes the tokens that person created for others and the service tokens they created. Records member.role_changed. |
| GET | /v1/invites |
members:read, admin |
Pending invites. Unpaged. |
| POST | /v1/invites |
members:write, admin (owner for owner, admin and billing invites) |
{role, email?}. Returns {id, url, role, email, email_sent, expires_at, plan_warning}. Expires after 7 days. plan_warning is a sentence (else null) when an owner, admin or member invited now would be over the plan's developer limit this month; the invite is still created. Invite emails are capped per day: 20 per org and 10 per inviter on Free, 200 and 50 on paid plans (429 invite_email_limit; links without an email aren't capped). |
| POST | /v1/invites/:token/accept |
the signed-in invitee | Joins the org. Returns {org, plan_warning}; plan_warning (else null) says when your agent won't be coordinated this month because of the plan limit. |
| DELETE | /v1/invites/:id |
members:write, admin (owner for owner/admin invites) |
The invite's id. 204 |
| POST | /v1/invites/:id/link |
members:write, admin (owner for owner, admin and billing invites) |
Issues a fresh link for a pending invite: {id, url, expires_at}. Invite links are stored hashed, so the previous link stops working. Records invite.link_rotated. 404 once accepted, revoked or expired. |
| GET | /v1/tokens |
personal token | Admins see all, others their own. {id, name, kind, prefix, user_id, scopes, created_at, last_used_at, expires_at, revoked_at} |
| POST | /v1/tokens |
tokens:write, admin, personal token |
{name, kind?: "pat"|"service", user_email?, scopes?, expires_in_days? (≤3650)}. The plaintext token is returned once. user_email (another member) is owner-only and refused for owners. Scopes can't exceed what the token's user may hold for their role, nor what the caller holds (a browser session: its role's scopes; a token: its own scopes): extra scopes get 403, and the default set is trimmed to fit. token.created records created_by. |
| DELETE | /v1/tokens/:id |
own token, or admin | 204 |
# A service token for CI that reads conflicts
curl -X POST https://api.comity.so/v1/tokens \
-H "Authorization: Bearer $COMITY_TOKEN" -H "Content-Type: application/json" \
-d '{"name": "ci-conflict-report", "kind": "service", "scopes": ["conflicts:read", "intents:read"]}'Note
Creating tokens needs a token with tokens:write. Tokens from comity login don't have it (their scopes are listed under Security & data), and the dashboard's Team tab lists and revokes tokens but doesn't create them.
Events, stats and streaming
| Method | Path | Scope | Notes |
|---|---|---|---|
| GET | /v1/events |
events:read |
Audit log. ?type=<types>&subject=<uuid>&limit=&cursor=, newest first |
| GET | /v1/feed |
events:read |
Same as events plus refs with display names |
| GET | /v1/events.csv |
events:read |
Audit log as CSV, ?type=<types>, newest first, at most 10,000 events. Business and up (402 plan_required below). See Audit log |
| GET | /v1/stats |
events:read |
?days=7|30|90&repo=&heatmap_weeks=26|52&heatmap_client=<client id>. Totals, time saved, daily series, heatmap (only heatmap_client's sessions when set; unknown client ids → 400), top clients/members/repos. The same query is answered from a copy for up to 60 seconds; a new session, intent, conflict, task or change event in the org refreshes it at once |
| GET | /v1/stream |
events:read |
Server-Sent Events. See below. |
Event envelope (same as webhook payloads):
{
"id": "18342",
"type": "intent.declared",
"version": 1,
"occurred_at": "2026-10-19T12:00:00.000Z",
"org_id": "0199…",
"actor": { "kind": "session", "id": "0199…" },
"subject": { "kind": "intent", "id": "0199…" },
"payload": { "…": "…" }
}SSE stream
curl -N "https://api.comity.so/v1/stream?types=conflict.detected,hook.blocked&repos=acme/api" \
-H "Authorization: Bearer $COMITY_TOKEN"retry: 3000
id: 18342
event: conflict.detected
data: {"id":"18342","type":"conflict.detected","version":1,…}
: ka- Filters:
typesandrepos(comma-separated). - Resume with the
Last-Event-IDheader (or?last_event_id=): missed events are replayed. - A
: kacomment every 15 seconds keeps the connection alive. - On server restart you get
event: reconnectwithdata: {"after_ms":1000}.
Integrations
Owner or admin with a personal token. See Integrations and Weekly digest.
| Method | Path | Notes |
|---|---|---|
| GET | /v1/webhooks |
Unpaged |
| POST | /v1/webhooks |
{url, event_types?: ["*"], description?}. 201 with secret (once) |
| DELETE | /v1/webhooks/:id |
204 |
| POST | /v1/webhooks/:id/test |
202 {delivery_id}; re-enables a disabled endpoint |
| GET | /v1/webhooks/:id/deliveries |
Newest first. ?limit=&cursor=: pass next_cursor to page on |
| GET | /v1/integrations/slack |
Connection status and last post |
| PUT | /v1/integrations/slack |
{webhook_url}; null disconnects |
| POST | /v1/integrations/slack/test |
202 {notification_id} |
| GET | /v1/integrations/digest |
Schedule, channels, email_me, recipients, next_send_at, last_run |
| PUT | /v1/integrations/digest |
Any of {enabled, day, hour, channels, email_me} (UTC; email_me is the caller's opt-in) |
| POST | /v1/integrations/digest/preview |
The next scheduled digest so far, {digest, slack: {text, blocks}, email: {subject, text, html}} (digest.period.partial while its week is still running); sends nothing |
| POST | /v1/integrations/digest/send-now |
The run. 409 nowhere to send, 429 within a minute of the last one |
| GET | /v1/github/app |
{ghes_url, apps[]}: the org's GitHub Enterprise Server address (null: github.com) and each app {id, app_id, slug, name, html_url, web_base_url, created_at, installations[]} |
| PUT | /v1/github/settings |
Owners. {ghes_url: "https://github.example.com" | null}: the GitHub Enterprise Server new apps are created on. The server's origin only, https, resolving to public addresses only (self-hosted with EGRESS_ALLOW_PRIVATE: private and http too); 400 otherwise. Every request to it goes through the egress guard |
| POST | /v1/github/app/manifest |
{owner?} (a GitHub organization login) → {action_url, manifest, state, expires_in}: POST manifest as a form field from the browser to action_url. Starts the GitHub App manifest flow on github.com or the org's ghes_url |
| POST | /v1/github/app/:id/install |
{} → {install_url, expires_in}: GitHub's install page for that app; send the browser there |
The manifest and install links are single use, valid for an hour, and bound to whoever started them: GitHub's redirects (GET /v1/github/app/callback, GET /v1/github/install/callback, not API calls) are only acted on in a browser signed in to Comity as that owner or admin, still in that role, and in the same session when a dashboard session started it. Otherwise no code is exchanged. They return the browser to the dashboard's Integrations tab with github=created\|installed\|requested\|rejected\|unknown\|expired\|failed\|signed_out\|wrong_account\|forbidden.
Notion
See Integrations → Notion and Shared tasks. Writers are owners, admins and members.
| Method | Path | Who | Notes |
|---|---|---|---|
| GET | /v1/notion |
any member | {configured, connections[]}. configured: false: the server has no Notion app. Each connection: {id, workspace_id, workspace_name, workspace_icon, connected_by, status: "active"|"invalid", can_update: true|false|null, lists, created_at}. invalid: Notion rejected the token; can_update null until a task finished |
| POST | /v1/notion/connect |
owner, admin | {} → {authorize_url, expires_in}: send the browser there. Notion returns it to the dashboard's Integrations tab with notion=connected|denied|expired|failed|signed_out|wrong_account|forbidden. The link is single use, valid for an hour, and only completes in a browser signed in to Comity as the caller (in the same session when a dashboard session started it) who is still an owner or admin. 503 notion-not-configured |
| DELETE | /v1/notion/connections/:id |
owner, admin | 204. Revokes the token at Notion and deletes it; lists that read through it stop syncing until another connection can read them |
| GET | /v1/notion/search |
writers | ?q= (empty: recently edited). {items[], errors[]}; item {ref, id, kind: "page"|"data_source", title, url, icon, connection_id, workspace_name, last_edited_time, list_id} (list_id: the live list already made from it). 409 notion-not-connected |
| POST | /v1/notion/task-lists/:id/sync |
writers | Reads a Notion list's source now. {list, added, updated, done, dropped, reopened} |
GET /v1/notion/callback is Notion's redirect target, not an API call.
Slack DMs
Comity's Slack app: one install per org gives channel posts (every plan; the channel picked on Slack's install screen) and "Needs you" DMs (Team plan and up). See Integrations → Slack. Writers are owners, admins and members.
| Method | Path | Who | Notes |
|---|---|---|---|
| GET | /v1/slack |
any member | {configured, available, install, settings, me, members}. install: {team_id, team_name, status: "active"|"revoked", installed_by, linked_members, created_at} or null; settings: {work_requests, questions, overrides, decisions} (which items are DMed); me: {linked, slack_user_id, linked_via: "email"|"oauth"|null, dms, state, prompt} (state: linked, no_match, unverified, not_checked or dms_off; prompt: show "Link your Slack"); members (owners/admins with an install, else null): [{user, role, state}] |
| POST | /v1/slack/install |
owner, admin | {} → {authorize_url, expires_in}: Slack's install page, every plan; the installer picks the posts channel there, which replaces a pasted webhook URL (also how the channel changes). 503 slack_unconfigured without a Slack app on the server |
| DELETE | /v1/slack/install |
owner, admin | 204. Revokes the bot token at Slack, deletes the install, its DMs and the channel destination it delivered, forgets members' links (their DM opt-outs stay) |
| PUT | /v1/slack/settings |
owner, admin | Any of {work_requests, questions, overrides, decisions} (booleans) → the settings |
| POST | /v1/slack/link |
writers | {} → {authorize_url, expires_in}: Sign in with Slack, to link your Slack account when your email doesn't match. 409 slack_not_installed |
| DELETE | /v1/slack/link |
any member | 204. Unlinks your Slack account and turns your DMs off |
| PUT | /v1/slack/me |
any member | {dms?: boolean, dismiss_link_prompt?: true}: your own DMs off or on, and/or hide the "Link your Slack" prompt |
Slack's own requests: GET /v1/slack/callback (OAuth redirect target; back to the dashboard with slack=installed\|installed_unlinked\|linked\|denied\|expired\|failed\|wrong_workspace\|taken\|signed_out\|wrong_account\|forbidden; installed_unlinked: installed, but no Slack account matched the installer's email; the install and link URLs are single use, valid for an hour, and only complete in a browser signed in to Comity as whoever started them, in the same session when a dashboard session started it, still with the role they need: otherwise signed_out, wrong_account or forbidden and no code is exchanged), POST /v1/slack/interactivity and POST /v1/slack/events. The last two need Slack's X-Slack-Signature (HMAC-SHA256 with the app's signing secret over v0:<timestamp>:<raw body>) and an X-Slack-Request-Timestamp within 5 minutes; anything else gets 401.
Billing
| Method | Path | Who | Notes |
|---|---|---|---|
| GET | /v1/billing |
owner, admin, billing | Plan and subscription |
| POST | /v1/billing/checkout |
owner, billing | {plan: "team"|"business"} → {url} |
| POST | /v1/billing/portal |
owner, billing | → {url} |
Browser sign-in
What the website's sign-in pages call. Every POST needs X-Comity-CSRF: 1 from an allowed origin. The session is the __Host-comity_session cookie (HttpOnly, Secure, SameSite=Lax, host-only; 30 days sliding). Until 26 November 2026 the old comity_session cookie is still accepted and swapped for the new one.
| Method | Path | Notes |
|---|---|---|
| GET | /v1/auth/providers |
{email, github, sso, turnstile}: which sign-in methods this server offers. turnstile is {site_key} when the server requires a Cloudflare Turnstile check, else null |
| POST | /v1/auth/signup |
{email, password, name?, turnstile_token?} → 202 {status: "verification_sent"} whether or not the email has an account; the email is sent after the response. It never changes an existing account's password. Sets __Host-comity_signup (24 hours), which ties the verification link to this browser |
| POST | /v1/auth/verify |
{token} → {verified: true, session}. The email is verified either way; session: true (and a session cookie) only in the browser that signed up with that password. Otherwise sign in at /login |
| POST | /v1/auth/login |
{email, password, turnstile_token?} → the session. After 3 failed attempts for an email (or 10 from one address) in 15 minutes, a Turnstile token is required. Too many failures from one address for one email → 429 |
| POST | /v1/auth/logout |
Revokes the session; clears both cookie names. 204 |
| POST | /v1/auth/password/forgot |
{email, turnstile_token?} → 202 {status: "accepted"} whether or not the account exists; at most 3 emails per hour per email and address |
| POST | /v1/auth/password/reset |
{token, password}. Signs out every browser, revokes your personal and CLI tokens and emails you a notice |
| POST | /v1/auth/device |
Starts comity login: {client_name} → {device_code, user_code, verification_uri, verification_uri_complete, interval, expires_in}. Both URIs are the plain /cli page; the user types the code |
| GET | /v1/auth/device/pending |
?user_code=XXXX-XXXX, signed-in browser → {client_name, created_at, requester: {ip}} for the approval page. 404 invalid_user_code, 400 expired_token |
| POST | /v1/auth/device/approve · /deny |
{user_code, org} / {user_code}. The CLI's token expires after 90 days, and you get an email when it is created |
Turnstile errors: 400 turnstile_required (send a token), 403 turnstile_failed (rejected or expired; get a new one), 503 turnstile_unavailable (couldn't be checked; signup, forgot-password and demo requests are refused, login goes ahead). Password hashing under heavy load answers 503 busy with Retry-After. Rate limits are per address (IPv6 per /64, IPv4 also per /24) and answer 429 with Retry-After.
Single sign-on
See Single sign-on. The sign-in routes are browser navigations (links or redirects), not API calls:
| Method | Path | Notes |
|---|---|---|
| GET | /v1/auth/sso/start |
?email=<work email> or ?org=<slug>, optional &next=/path (default /dashboard). Redirects to the identity provider; failures redirect to /login?error=<code> |
| GET | /v1/auth/sso/callback |
The redirect URI registered at the identity provider. Sets the session cookie and redirects to next |
The settings routes need a signed-in browser session (an API token gets 403 browser_session_required) and the org in X-Comity-Org; writes need X-Comity-CSRF: 1. Owners write, admins read. Every route except DELETE /v1/sso and the test answers the full settings object {available, plan, redirect_uri, connection, domains, your_last_sso_login_at, enforcement: {can_enable, blockers}}; the client secret is never returned.
| Method | Path | Who | Notes |
|---|---|---|---|
| GET | /v1/sso |
owner, admin | Settings |
| PUT | /v1/sso |
owner | {issuer, client_id, client_secret?, default_role?: "member"|"viewer"}. client_secret is required when creating; omit it to keep the saved one. 400 sso_discovery_failed, 402 plan_required |
| DELETE | /v1/sso |
owner | Removes the connection and enforcement; domains are kept. 204 |
| POST | /v1/sso/test |
owner | {ok, checks: [{name, ok, detail}]}. 404 when not configured |
| POST | /v1/sso/domains |
owner | {domain}. 402 plan_required, 409 domain_exists |
| POST | /v1/sso/domains/:domain/verify |
owner | Checks the TXT record. 409 domain_unverified, 409 domain_taken |
| DELETE | /v1/sso/domains/:domain |
owner | Removes a domain |
| PUT | /v1/sso/enforcement |
owner | {enforced: boolean}. 409 sso_not_ready when turning on with blockers |
When an org requires SSO, a covered member gets 403 sso_required (with the org's slug in an extra org member) from password login (POST /v1/auth/login), and, from a browser session that didn't come from the org's SSO, from org-scoped requests and CLI approval (POST /v1/auth/device/approve).
Health
| Method | Path | Notes |
|---|---|---|
| GET | /healthz |
{"status":"ok"}. No auth. |
| GET | /readyz |
{"status":"ready"|"unavailable"}; 503 when not ready. No auth. Callers on a private network (the Compose healthcheck, an operator on the host) also get "checks":{"database","schema","stream"}. |
MCP
GET|POST|DELETE /mcp: the MCP Streamable HTTP endpoint, bearer token with mcp:tools. See MCP tools.