Skip to main content
This is the shortest path from nothing to reading your organization’s Sonar and keeping a copy of it in sync: create a key, make a first read, then pull only what changed. New to Sonar? Start with the Sonar API overview for access and what the API covers.
Every call needs a secret key, as Authorization: Bearer or on the X-API-Key header. See Authentication.

Prerequisites

You need two things before the first call:
  1. A Turtle organization with Sonar enabled, that you are a member of. The Turtle team enables Sonar per organization.
  2. Your organization ID: the ID in the dashboard’s address bar while you are in the organization, dashboard.turtle.xyz/organizations/<organizationId>/....

Step 1: Create a personal API key

Sign in to the dashboard, open your account page, and create a key under Personal API Keys. Any member can, not only admins. The key is shown once. Keep it in a secret store, never in code or chat. It acts as you, in every organization you are a member of, so what your script does is recorded as you.

Step 2: Make a first read

Fetch the deals that have gone quiet the longest.
A 200 with an engagements array means you are in:
A 401 means the key is missing, wrong, expired or not a secret key. A 403 means the organization does not have Sonar, or you are not a member of it.

Step 3: Keep in sync

Store the time of your last pull and pass it back as updatedAfter. Page with cursor until no nextCursor comes back. Take the timestamp a minute before the pull starts, so a change made while you page, or missed because your clock runs ahead of ours, is picked up next time. A record can then come back twice, so store records by id.
TypeScript
The same loop works on the listings of organizations, contacts, threads, tasks, documents, wallets and reports. Events are different, because they never change: to follow new ones, see Reading.

Step 4: Make a write

Move a deal to another stage. With a personal key the write is recorded as yours, so the rationale is optional, and it applies at once.
applied: true means the change is in the log, and mutation is its row. The stage must be one the deal’s board declares: read it with GET /pipelines/{pipelineId}. A tool that writes on its own judgement, such as an AI assistant, should send "source": "ai" so the write is recorded as your agent’s. It then owes evidence and passes the same approvals as Sonar’s agent. See Writing.

What’s next

  • Authentication - Personal and organization keys, and what each may read and write.
  • Conventions - Filters, sorting, evidence, drafts, errors and limits.
  • Inbound webhooks - Send a form, a zap or your backend’s events into Sonar.
  • List Engagements - Every filter a deal listing takes, in the API reference.