This is the abridged developer documentation for Sort # Sort documentation > Guides and reference for Sort, and for using Sort from AI apps, the command line and the HTTP API. Sort is a knowledge workspace for teams: pages, messages, email, e-signatures and AI in one shared workspace. Everything you can do in Sort, you can also do from an AI app, a terminal or your own code, as yourself or as an agent, with the same permissions. ## Connect to Sort [Section titled “Connect to Sort”](#connect-to-sort) [MCP server](/mcp/)Connect Claude, ChatGPT, Cursor or another AI app to your workspace. [CLI](/cli/)sortdo: Sort from a terminal, a script or a coding agent. [HTTP API](/api/)Every operation over HTTPS, with webhooks and a TypeScript SDK. [Changelog](/changelog/)What changed in Sort, newest first. MCP, the CLI and the API use the same operations, permission checks and approvals. Choose by where your code runs: | You use | Choose | | -------------------------------------------------------------------- | ---------------------------------------------------- | | A chat app without a shell, such as Claude or ChatGPT | [MCP server](/mcp/connect/) | | A terminal, a coding agent such as Claude Code or Codex, or a CI job | [CLI](/cli/install/) | | Your own server, script or integration | [HTTP API](/api/) or the [TypeScript SDK](/api/sdk/) | ## Quick start [Section titled “Quick start”](#quick-start) * MCP Add this address to your AI app, then select **Allow** on the Sort page. [Steps for each app](/mcp/connect/). ```text https://trysort.com/mcp ``` * CLI ```sh curl -fsSL https://sort.do/install | bash sortdo login sortdo search onboarding guide ``` Windows: `irm https://sort.do/install.ps1 | iex`. [Other ways to install](/cli/install/). * API Create an API key for an [agent member](/api/keys/), then: ```sh curl -X POST https://api.trysort.com/v1/teams.list \ -H "Authorization: Bearer $SORT_API_KEY" \ -H "Content-Type: application/json" -d '{}' ``` ## Guides [Section titled “Guides”](#guides) [Permissions and approvals](/mcp/permissions/)What an app or agent can do alone, and what waits for you. [Agent members](/mcp/permissions/#agent-members)Give an AI agent its own name, access and API keys. [Events and webhooks](/api/events/)Get each change in your workspace as it happens. [Messages](/messages/)Channels, direct messages, threads and incoming webhooks. [Sign in](/account/sign-in/)Email, Google, Apple and passkeys. [Troubleshooting](/mcp/troubleshooting/)Fix common problems with connected AI apps. ## Reference [Section titled “Reference”](#reference) * [MCP tools](/mcp/tools/): every tool and its parameters. * [CLI commands](/cli/reference/): every `sortdo` command and option. * [API operations](/api/reference/): every operation, its input and output, and [`openapi.json`](https://api.trysort.com/v1/openapi.json). ## For AI agents [Section titled “For AI agents”](#for-ai-agents) These docs are also plain text. [llms-small.txt](/llms-small.txt) holds the guides, and [llms-full.txt](/llms-full.txt) adds the full tool, command and API reference. [llms.txt](/llms.txt) links to both. For the API, [`openapi.json`](https://api.trysort.com/v1/openapi.json) is shorter than the reference pages. # Delete your account > How to delete your Sort account on the web, in the desktop and mobile apps, or with an AI app, and what happens to your workspaces and content. Deleting your account cannot be undone. ## Delete it [Section titled “Delete it”](#delete-it) * **Web or desktop app:** sign in at [trysort.com](https://trysort.com/app/login), open **Settings › Sign-in & security**, choose **Delete account**, and type your email address to confirm. * **iPhone app:** open **Account › Sign-in & security › Delete account**, and type your email address to confirm. * **Sort AI or a connected AI app:** ask it to delete your account. Nothing happens until you approve the request in Sort. If you cannot sign in, email from the address of your account. ## What is deleted [Section titled “What is deleted”](#what-is-deleted) * Workspaces where you are the only member, with all their pages, files and email. * Your name, email address, photo and sign-in methods. Sort also revokes its access to your Apple ID if you signed in with Apple. * Your AI chats (also the ones you shared), private pages, memories, schedules and notifications. * Your sessions: every browser, desktop app and phone is signed out. ## What stays [Section titled “What stays”](#what-stays) In workspaces that have other members, you leave the workspace. The pages and comments you published belong to that workspace, so they stay there, shown as by “Deleted person”. Documents you sent for signature also stay, with a workspace owner, so the people who sign them keep their links. ## If you are the only owner [Section titled “If you are the only owner”](#if-you-are-the-only-owner) If you are the only owner of a workspace that has other members, make another member an owner first (**Settings › Members**). Then you can delete your account. # Sign in > How to sign in to Sort with email, Google, Apple or a passkey, how to add and remove passkeys, and how to sign out of other devices. Sort has no passwords. Sign in at [trysort.com](https://trysort.com/app/login) with one of these: * **Email:** type your email address. Sort emails you a link and a 6-digit code. Open the link or type the code. Both work for 15 minutes. * **Google or Apple:** choose **Continue with Google** or **Continue with Apple**. If you hide your email from Apple, Sort uses your Hide My Email address. * **Passkey:** choose **Continue with passkey**, or pick a passkey in the email field. Your device asks for Face ID, a fingerprint or its PIN. * **Approve on another device:** after you type your email, choose **Approve there**, then approve on a device where you’re signed in (see below). The desktop and iPhone apps sign in through the same page, so every method works there too. The login page marks the method you used last in this browser with **Last used**. If you’re in several workspaces, Sort asks which one to open and marks the one you used last. A Sort link that you open while signed out opens again after you sign in. ## Passkeys [Section titled “Passkeys”](#passkeys) A passkey signs in to your account in every workspace. The passkey stays on your device or in your password manager, such as iCloud Keychain, Google Password Manager or 1Password. Sort keeps only its public key, which cannot sign in on its own. ### Add a passkey [Section titled “Add a passkey”](#add-a-passkey) 1. In your browser, open **Settings › Sign-in & security**. 2. Choose **Add passkey** and follow your device’s prompt. If you signed in more than 15 minutes ago, Sort first emails you a 6-digit code to confirm it’s you. Sort also emails you each time a passkey is added. If you did not add it, remove it and sign out of your other devices. In the desktop app, **Add passkey** opens the page in your browser. Sign in there with the same account as in the desktop app. In the iPhone app, open **Account › Sign-in & security** and choose **Add passkey**. On the sign-in screen, choose **Sign in with passkey**. ### Remove a passkey [Section titled “Remove a passkey”](#remove-a-passkey) Open **Settings › Sign-in & security** and choose **Remove** next to the passkey. Email sign-in keeps working. You can also ask Sort AI to remove one: nothing happens until you approve it. ## Approve on another device [Section titled “Approve on another device”](#approve-on-another-device) Use this when you can’t open your email on the new device. 1. On the login page, type your email and choose **Continue with email**. 2. Choose **Approve there**. The page shows a number. 3. On a device where you’re signed in to Sort, **Approve sign-in?** opens (on a phone, tap the notification). Check which browser asks, then choose the same number. The new device then signs in. If you didn’t try to sign in, choose **Deny**. Choosing a wrong number also blocks the sign-in. A request lasts 5 minutes. ## New sign-in emails [Section titled “New sign-in emails”](#new-sign-in-emails) When your account signs in on a browser or device it has not used before, Sort emails you the device, the time and the IP address. If it wasn’t you, sign out of your other devices (below). Clearing your browser’s cookies makes it a new device again. ## Sign out of other devices [Section titled “Sign out of other devices”](#sign-out-of-other-devices) Open **Settings › Sign-in & security** and choose **Sign out of other devices** (in the iPhone app: **Account › Sign-in & security**). Every other browser, desktop app and phone is signed out. The device you use stays signed in. Connected AI apps keep their access: disconnect them in **Settings › AI apps**. ## Delete your account [Section titled “Delete your account”](#delete-your-account) See [Delete your account](/account/delete/). # Sort API > Call every Sort operation over HTTPS, with an agent's API key or an OAuth access token. The Sort API gives your servers and scripts the same operations as the Sort apps, Sort AI, the [MCP server](/mcp/) and the [CLI](/cli/). Each one runs with the access of the member it acts as, with the same permission checks. ## Requests [Section titled “Requests”](#requests) Every operation is a `POST` with a JSON body: ```sh 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](#approvals). | | `4xx`, `5xx` | Refused or failed. The body is `{ "error": { "code", "message" } }`. | Operation names are `.`, such as `teams.add_members`. The [reference](/api/reference/) lists them all, and [`/v1/openapi.json`](https://api.trysort.com/v1/openapi.json) describes them as OpenAPI 3.1. ## Sign in [Section titled “Sign in”](#sign-in) Send a bearer token: * **An API key** of an agent member, for servers and scripts. See [Sign in and scopes](/api/keys/). * **An OAuth access token**, for an app that acts for a person. It is the same OAuth server as [MCP](/mcp/developers/#authorization): a token works on both. ## Errors [Section titled “Errors”](#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 [Section titled “Lists”](#lists) 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](/api/events/#the-feed) is the one exception, because it never ends. ## Idempotency [Section titled “Idempotency”](#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”](#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`](/api/reference/#notifications.get_approval). Nothing changes until the person approves. For an agent’s API key, the agent’s manager approves. ## Limits [Section titled “Limits”](#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`. # Events and webhooks > What changed in a workspace, as a feed and as signed webhook requests. An event says what changed: its type, the objects, who changed them and which fields. It never holds the content: read the objects with their own operations, with your own current access. ```json { "id": "0199a1b2-c3d4-7e5f-8a9b-0c1d2e3f4a5b", "type": "team.updated", "createdAt": "2026-11-16T10:00:00.000Z", "workspaceId": "…", "actor": { "memberId": "…", "source": "app" }, "object": { "kind": "team", "id": "…" }, "context": {}, "changed": ["description"] } ``` A change to many objects is one event, or a few. Then `object` is the first of them, and `objects` lists all of them that the member you act as may see (at most 50). You get an event only when that member may see its objects, and when your scopes cover its area. ## The feed [Section titled “The feed”](#the-feed) [`events.list`](/api/reference/#events.list) returns the events of the last 30 days, oldest first. Every page with events has a `nextCursor`: poll with the last one you got to get only what is new. The feed has no last page, so this cursor works differently from other [lists](/api/#lists): an empty page has no `nextCursor`, so keep the one you sent and poll with it again later. Filter by `types`, `objectId` or `actorId`. ## Webhooks [Section titled “Webhooks”](#webhooks) A webhook POSTs each event to your HTTPS address as it happens. It belongs to an agent member: the agent’s access decides which events it gets. 1. In the agent’s **Manage access** dialog, under **Webhooks**, select **Add webhook**. 2. Enter an `https://` address on the default port, and the event types you want, or leave them out for all. 3. Copy the signing secret. Sort shows it only once. Sort delivers each event at least once, and not always in order: drop repeats by the event `id`. A delivery that fails is tried again after 30 seconds, then after waits that double up to 6 hours, for 3 days. While your address fails, Sort also waits that way before it sends the next event. A webhook that fails for 3 days stops until someone starts it again; so do the webhooks of an agent that is suspended or removed. **Send test event** sends a `webhook.test` event at once. ### Check the signature [Section titled “Check the signature”](#check-the-signature) Each request has `Sort-Signature: t=,v1=`. The signature is the HMAC-SHA256 of `.` with your secret, in hex. After you make a new secret, the old one also signs for 24 hours, so the header has two `v1` values. ```ts import { verifyWebhook } from '@sortdo/sdk' export async function handle(request: Request) { const body = await request.text() if (!await verifyWebhook(body, request.headers.get('Sort-Signature'), process.env.SORT_WEBHOOK_SECRET!)) { return new Response('Invalid signature', { status: 401 }) } const event = JSON.parse(body) // … return new Response(null, { status: 204 }) } ``` Answer with any `2xx` status within 10 seconds. Check the signature on the raw body: parsing and writing the JSON again changes the bytes. # Sign in and scopes > API keys of agent members, OAuth tokens, and scopes that limit them to areas. ## API keys [Section titled “API keys”](#api-keys) An API key signs in as an **agent member**: a member of the workspace that is not a person. The key has exactly the agent’s access, so give the agent only the teams it needs. 1. In Sort, go to **Settings › Members** and add an agent, or open one you manage. 2. In its **Manage access** dialog, under **API keys**, select **Create key**. 3. Name the key, and choose areas if the key needs less than all of them. 4. Copy the key. Sort shows it only once and keeps only a hash. Workspace owners manage the keys of every agent; admins those of the agents they manage. A key stops working at once when you revoke it, or when the agent is removed. Keys start with `sort_key_`, so a leaked key is easy to find. ## Scopes [Section titled “Scopes”](#scopes) A scope limits a key or a token to areas of Sort. `:read` allows the operations of the area that change nothing; `:write` allows all of them. `sort` allows everything the member can do. A scope never adds access: the member’s own access still decides. Operations that start Sort AI need `sort`: asking Sort AI (`chats.send_message`, `chats.continue`), and saving, changing or resuming a scheduled task. Sort AI reads and does everything the member can, so a narrower key or token cannot start it. The areas are the first part of each operation name: `pages`, `comments`, `notifications`, `signatures`, `teams`, `sharing`, `members`, `agents`, `chats`, `email`, `files`, `web`, `assistant`, `connections`, `imports`, `workspace`, `billing`, `preferences` and `events`. An OAuth app asks for scopes with the `scope` parameter, such as `scope=teams:read pages:write`. The person sees a short summary on the consent page and can allow less with **Change**. An app that asks for no scope gets `sort`. A call outside the scopes fails with `missing_scope`, and `scope` in the error names the scope it needs. # TypeScript SDK > A typed client for every Sort API operation, and webhook signature checks. ```sh npm install @sortdo/sdk ``` ```ts import { ApprovalRequired, SortError, createSort } from '@sortdo/sdk' const sort = createSort({ token: process.env.SORT_API_KEY! }) const { items: teams } = await sort.teams.list({}) try { await sort.teams.add_members({ teamId: teams[0].id, memberIds: ['…'] }) } catch (error) { if (error instanceof ApprovalRequired) console.log('Ask the person to approve:', error.approval.url) else if (error instanceof SortError) console.log(error.code, error.message) else throw error } ``` Each operation is a method of its area, with the input and output types of the [reference](/api/reference/). `sort.call('teams.list', {})` calls one by name. Pass `{ idempotencyKey }` as the second argument of a write to make a retry safe. `verifyWebhook(body, signatureHeader, secret)` checks a webhook request: see [Events and webhooks](/api/events/#check-the-signature). The package uses the standard `fetch` and Web Crypto, so it runs in Node.js 20 or later, Bun, Deno and edge runtimes. For other languages, generate a client from [`/v1/openapi.json`](https://api.trysort.com/v1/openapi.json). # Sort CLI > sortdo is Sort's command line. Search, read and write your team's knowledge from a terminal or a coding agent, as you, with your permissions. `sortdo` is Sort’s command line. It works in your workspace as you, with your permissions, the same way Sort AI and AI apps do. It is made for two kinds of users: * **People in a terminal.** Find a page, read it as Markdown, publish release notes from a file. * **Coding agents** such as Claude Code, Codex and Cursor. One command per call, plain text back, so an agent uses fewer tokens than with an MCP server. ```sh curl -fsSL https://sort.do/install | bash sortdo login sortdo search onboarding guide ``` Windows: `irm https://sort.do/install.ps1 | iex`. Other ways to install: [Install and update](/cli/install/). ## What it can do [Section titled “What it can do”](#what-it-can-do) Every tool on the Sort server is a command. The server sends the list, so new tools appear without a new `sortdo` release. ```sh sortdo search release notes # titles and URLs sortdo read # a page as Markdown, lines numbered sortdo pages create --title "Release notes 1.4" --file notes.md --team --publish sortdo pages edit --replace "old text" --with "new text" sortdo teams list sortdo comments add --page-id --text "Looks good" sortdo notifications list --json ``` `sortdo --help` lists the commands, and `sortdo --help` shows the actions and options. The full list is in the [command reference](/cli/reference/). ## Safe by default [Section titled “Safe by default”](#safe-by-default) * `sortdo` signs in through your browser. You allow it on a Sort page that shows the same code as your terminal. See [Sign in](/cli/sign-in/). * Your sign-in is in your computer’s keychain. * Actions that cannot be undone, reach other people or give access wait for your approval in Sort, the same as for AI apps. See [Permissions and approvals](/mcp/permissions/). * The source and every release are public at [github.com/sortdo/cli](https://github.com/sortdo/cli). ## CLI or MCP? [Section titled “CLI or MCP?”](#cli-or-mcp) Both give the same tools and permissions. Use the CLI when you or your agent can run shell commands: Claude Code, Codex, Cursor’s agent, CI jobs and scripts. Use the [MCP server](/mcp/) for chat apps without a shell, such as Claude and ChatGPT. # Coding agents > Let Claude Code, Codex, Cursor and other coding agents use Sort through the sortdo CLI, with the Agent Skill that teaches them how. Coding agents that can run shell commands work best with `sortdo`: one command per call and plain text back, so they spend fewer tokens than with an MCP server. Every action happens as you, with your permissions, and actions that need your approval wait for it. ## Set it up [Section titled “Set it up”](#set-it-up) ```sh curl -fsSL https://sort.do/install | bash sortdo skill install ``` `sortdo skill install` adds the sortdo [Agent Skill](https://agentskills.io) where agents read personal skills: | Folder | Read by | | ------------------------- | ---------------------------------------------------------- | | `~/.agents/skills/sortdo` | Codex, Cursor, GitHub Copilot, Gemini CLI and other agents | | `~/.claude/skills/sortdo` | Claude Code (when `~/.claude` exists) | The skill tells the agent when to use Sort, how to sign in, and how to read, write and ask for approval. `sortdo skill install --dir .claude/skills` adds it to one project instead. Run `sortdo skill install` again after an update. ## Let an agent set it up [Section titled “Let an agent set it up”](#let-an-agent-set-it-up) You can also ask your agent: “Install the Sort CLI and connect it to my workspace.” It runs the install command and `sortdo login`, which prints a link for you: ```text To sign in, open this link and allow Sort CLI: https://trysort.com/app/connect?code=BCDF-GHJK The page shows the code BCDF-GHJK. Then run: sortdo login poll ``` Open the link, check the code and select **Allow**. The agent’s `sortdo login poll` returns as soon as you do. If you have no Sort workspace yet, the agent can pass your email and a workspace name (`sortdo login --email you@example.com --workspace-name "Acme"`), and the same link lets you create the workspace. An agent that runs on its own, not for one person, can sign in as its own [agent member](/mcp/permissions/#agent-members): `sortdo login --as-agent "Research agent"`. When you allow it as a workspace owner or admin, Sort adds the agent with that name and you become its manager. You choose whether it can read or edit the pages of the default team. If you already manage an agent with that name, the page picks it, so signing in again adds no second agent. ## What agents should know [Section titled “What agents should know”](#what-agents-should-know) * `sortdo --help` and `sortdo --help` describe every command, action and option. * `--json` prints the data for scripts. A failed command exits with code 1 and says why. * `--args ''` (or `--args -` for stdin) gives all of a command’s arguments at once, and `--