Sort API
The Sort API gives your servers and scripts the same operations as the Sort apps, Sort AI, the MCP server and the CLI. Each one runs with the access of the member it acts as, with the same permission checks.
Requests
Section titled “Requests”Every operation is a POST with a JSON body:
curl -X POST https://api.trysort.com/v1/teams.list \ -H "Authorization: Bearer $SORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{}'| Answer | Meaning |
|---|---|
200 |
Done. The body is the operation’s output, with no envelope. |
202 |
Nothing changed yet: a person must approve it. The body is { "approval": { "id", "summary", "url", "expiresAt" } }. See Approvals. |
4xx, 5xx |
Refused or failed. The body is { "error": { "code", "message" } }. |
Operation names are <area>.<action>, such as teams.add_members. The reference lists them all, and /v1/openapi.json describes them as OpenAPI 3.1.
Sign in
Section titled “Sign in”Send a bearer token:
- An API key of an agent member, for servers and scripts. See Sign in and scopes.
- An OAuth access token, for an app that acts for a person. It is the same OAuth server as MCP: a token works on both.
Errors
Section titled “Errors”code is from a closed list, so your code can switch on it. message is written for a person and an agent, and says what to do next.
| Code | Status | Meaning |
|---|---|---|
invalid_input |
400 | A field is missing or wrong. The message names it. A body that is too large gets 413. |
unauthenticated |
401 | No token, or one that expired or was revoked. |
forbidden |
403 | The member may not do this. |
missing_scope |
403 | The key or token does not cover this area. scope names the scope it needs. |
guest_refused |
403 | Guests cannot use the API. |
not_available_here |
403 | This operation works only in Sort’s own apps. |
not_found |
404 | No such object, or the member cannot see it. |
conflict |
409 | The change clashes with the current state, such as a name in use. |
idempotency_conflict |
422 | The Idempotency-Key was used for another request. |
rate_limited |
429 | Too many calls. Wait for Retry-After seconds. |
workspace_locked |
402 | The workspace has no active plan. |
workspace_read_only |
423 | The workspace accepts no changes. |
internal |
500 | Something failed on Sort’s side. Try again. |
Lists take limit and cursor, and return { "items": [...], "nextCursor": "..." }. Pass nextCursor as cursor for the next page. It is null on the last page. The event feed is the one exception, because it never ends.
Idempotency
Section titled “Idempotency”Send an Idempotency-Key header with a write to make a retry safe. A repeat with the same key in 24 hours returns the first result, with Idempotent-Replayed: true, and does not run again. The same key with a different body gets idempotency_conflict. A refusal that can pass later (rate_limited, conflict, workspace_locked, workspace_read_only, unauthenticated or internal) is not kept: a retry with the same key runs.
Approvals
Section titled “Approvals”An action that cannot be undone, reaches other people or gives access waits for a person when an API key or an outside app asks for it. You get 202 with an approval: show its url to the person, then read the outcome with notifications.get_approval. Nothing changes until the person approves. For an agent’s API key, the agent’s manager approves.
Limits
Section titled “Limits”Each API key and each OAuth grant may make 50 calls in 10 seconds, 2,000 in an hour and 20,000 in a day, for /v1 and /mcp together. Each network address may also make 300 calls a minute to /v1. A refused call gets 429 and Retry-After.