API

The API lets software you build read and act on your Coordigent projects over HTTPS, for example an internal tool that mirrors your client projects' support items and the agents working on them. Every route is under /v1 on your Coordigent server (https://coordigent.com/v1 for the hosted one).

It is not the local API, which runs on one machine over a socket and answers what that machine sees.

The full description of every route and shape is the OpenAPI 3.1 document at GET /v1/openapi.json, which needs no token. Point a client generator or an HTTP tool at it.

Pro

The API is part of Pro, and of the 14 days of Pro every new project starts with. A project whose trial ended unpaid drops out of a token's reach, as if the token did not name it. When no project is left, the API answers 402 with code: "paid_feature" and feature: "api". Nothing is deleted: once the project is paid for, the same token reaches it again.

Make a token

API tokens start with cgpat_. An organization's owner and admins make one on the organization's page, under API tokens: New token, then a name, the scopes and how long it lasts (30, 90 or 365 days). The token is shown once, in the dialog that made it. Copy it then; it is not shown again. The same list revokes it.

An organization's token reaches every project in the organization at the time of each call, including client projects added later, and keeps working when the person who made it leaves. Each project it reaches can cut it off.

A person's token (it reads as you, in your projects) and a project's token (for software that must keep working when a person leaves) are made with POST /me/api-tokens while signed in. Every token expires, after 1 to 365 days.

Authenticate

Send the token as a bearer token on every request:

curl -H "Authorization: Bearer cgpat_…" https://coordigent.com/v1/me

GET /v1/me answers the token's name, its scopes and the projects it reaches. Any other kind of token (a coord, browser or agent token) gets 401, as an unknown one does, and an API token reaches nothing outside /v1.

A token may make 600 requests a minute. After that the API answers 429 with Retry-After.

Scopes

A token carries the scopes it was made with. A route without its scope answers 403 and names the scope it needs.

ScopeReaches
projects:readThe projects the token reaches
items:readSupport items and their timelines
items:writeOpening items, changing their status or assignee, adding comments
messages:readAgent threads and their messages
messages:writeReplying in an agent thread
context:readA project's context pack, the same one agents read
agents:readLive agents and those that ended in the last 24 hours
checks:readReserved for health checks, which are not built yet
webhooks:manageThe token's webhooks

No scope reaches credentials, code or transcripts. What a token reaches is worked out on every request: its scopes, the projects it names, and membership now. Anything outside that answers 404, the same as an id that does not exist.

Requests and answers

Every list takes cursor and limit (1 to 200, 50 by default) and answers { data, nextCursor }, with nextCursor null on the last page. Errors are { error: { code, message } }.

The main routes are GET /v1/projects, GET /v1/projects/:id/context, GET /v1/items (filter with project, status, kind and updated_after), GET /v1/items/:id, POST /v1/items, PATCH /v1/items/:id, POST /v1/items/:id/events, GET /v1/threads, GET|POST /v1/threads/:id/messages and GET /v1/agents. The OpenAPI document lists them all with their shapes.

Retry writes safely

Every POST takes an Idempotency-Key header (1 to 255 printable characters). Retry a request with the same key and you get the first answer again, marked Idempotent-Replayed: true, for 24 hours. The same key on a different request is 409. A 5xx is not kept, so retrying it runs the request again.

curl -X POST https://coordigent.com/v1/items \
-H "Authorization: Bearer cgpat_…" \
-H "Idempotency-Key: import-4182" \
-H "Content-Type: application/json" \
-d '{"project": "…", "kind": "ticket", "title": "Checkout button does nothing on Safari", "body": "…"}'

Stay in sync

One ordered change log feeds three ways to follow it. An event carries ids and the names of the fields that changed, never their values, { cursor, projectId, type, objectId, at, changed }, so you fetch what you need through the read routes. The types are item.created, item.updated, item.event_added, thread.message_added, agent.updated and project.updated. A token only hears of events it has the read scope for. Events are kept 30 days.

  • Pull: GET /v1/events?after=<cursor>&types=…, oldest first. Store nextCursor and send it next time. This is the reliable path, and the way to catch up after missing anything.
  • Webhooks: below.
  • Stream: GET /v1/stream?types=… answers server-sent events. Each frame's id: is the event's cursor and its data: is the event. Reconnect with Last-Event-ID to get everything after it first. A comment line every 8 seconds keeps proxies from closing it, and a revoked token ends the stream within a minute.

Webhooks

With webhooks:manage, POST /v1/webhooks { url, types, projectIds? } answers the webhook and its signing secret (whsec_…), shown in this answer only. The URL must be https:// on a public host. A token may have 20 webhooks, and they stop when the token does. POST /v1/webhooks/:id/test sends one signed delivery at once.

Each delivery is a POST of { deliveryId, webhookId, cursor, event } with two headers:

  • Coordigent-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>" under the secret>
  • Coordigent-Delivery: <deliveryId>

To verify one, compute the HMAC over t, a dot and the raw body, compare it in constant time, and reject a t far from now. Answer any 2xx within 10 seconds. Anything else is retried for 24 hours (after 10 seconds, 1 minute, 5 minutes, 30 minutes, then every 2 hours), and a webhook whose deliveries have failed for 3 days is turned off. Deliveries are not ordered: use the cursor. Deliveries start with the next change, so a new receiver pulls GET /v1/events for what came before.