Skip to main content
Every Sonar request carries a Turtle secret API key (sk_live_), either as a bearer token or on the X-API-Key header. A request with no key answers 401.
Publishable keys (pk_live_) do not open Sonar: they are refused with 401, like a missing key. Sonar holds your team’s conversations, so a key that reads it belongs on a server or in a secret store, never in browser code.

Two kinds of key

A personal key and your dashboard session are alike: what you may do in Sonar while signed in, your key may do through the API, and it is recorded as you. That makes it the right choice for your own scripts and assistants. An organization key acts as an agent: it suits a shared service that works for the whole team, and it cannot make the decisions a person answers for.

Personal keys

  • Made on your account page. Sign in to the dashboard, open your account page and find Personal API Keys. The secret is shown once.
  • Acts as you, as your dashboard session does, in the organizations you are a member of: your role, your permissions, the events you may read, and your name on its writes. A request for an organization you are not a member of answers 403.
  • Expires after 90 days unless you choose another expiry when you create it. You can hold at most five active personal keys; revoke one to make another.
  • A key cannot make keys. Creating and revoking keys takes a signed-in session in the dashboard.

Organization keys

  • Made by an owner or admin in the organization’s settings in the dashboard, under API Keys, with the Secret type.
  • Reaches its own organization only. A path that names another organization answers 404.
  • Acts as an agent. Every write owes a rationale and evidence, and passes the permissions your workspace set for Sonar’s agent. See Writing.
  • Decides nothing for the organization. The calls in What takes an owner or admin refuse it.

Writing as your assistant

With a personal key, a write may send "source": "ai" (?source=ai on a DELETE). It is then recorded as your agent’s write, with you as its user: it owes a rationale and evidence, and passes the same permissions as any agent write. Leave source out for a write that is your own.

What a key may read

Some events are not every reader’s to see, such as a message on a member’s personal account, or in a group only its members may read. A key reads them as a person in Sonar would:
  • A personal key reads what you can read.
  • An organization key reads what the team holds.
An event the key may not read comes back sealed: its stub, with sealed: {reason, conversationKind} and no payload, sender or conversation. You can still cite it by its ID. Searches and filters that look inside events never match a sealed one.

What takes an owner or admin

Some calls are a decision for the organization, and a person answers for each one. They take an owner or admin of the organization, with their personal key or their dashboard session:
  • Deciding drafts: POST /mutations/{id}/approve, POST /mutations/{id}/reject and POST /reports/{id}/decide.
  • Permission policies: GET and PUT /permissions.
  • Changing what Sonar keeps: retention, forgetting, and deleting the organization’s Sonar data (/data/...).
An organization key is refused on these calls with 403, because it acts as an agent and nobody answers for what an agent decides. A personal key whose owner is a member of another role is refused too.

Keep keys secret

Treat a key like a password. If one leaks, revoke it where it was made (your account page, or the organization’s settings) and create a new one.

Authentication errors

These are answered before the request reaches an endpoint, with a plain-text body rather than JSON. See Errors.