Skip to content
Sandadocs

Records

List, filter, find, add, change, archive and restore your CRM's clients, people, deals and agreements through the CRM API, and read each one's history.

The CRM's four kinds of record are the same in the API, each at its own path:

Record Path In the CRM
company /companies A client, a lead or a prospect. See your work in the CRM
person /people Somebody at a client, or on their own
deal /deals What a client is buying, from the first conversation to the last invoice. See deals
agreement /agreements A client's standing terms: an engagement letter, a contract. See agreements

Each takes the same seven calls. {id} is the record's id.

Call Does Key needs
GET /companies List and filter, a page at a time crm:read
POST /companies Add one crm:write
GET /companies/{id} Read one, archived or not crm:read
PATCH /companies/{id} Change the fields you send crm:write
POST /companies/{id}/archive Archive it crm:manage
POST /companies/{id}/restore Bring it back from the archive crm:manage
GET /companies/{id}/history Who changed what on it, newest first crm:read

The same calls work on /people, /deals and /agreements. A record is archived, never deleted, through the API: the CRM's own pages remove one, by an owner or admin.

A record

JSON
{
  "company": {
    "id": "5f0c2b7e-8a51-4c8e-9d0b-2a4c7e1f9b33",
    "object": "company",
    "name": "Acme Services",
    "domain": "acme.com.au",
    "industry": "Accounting",
    "size_band": "11 to 50",
    "location": "Hobart",
    "notes": null,
    "relationship": "client",
    "outreach_stage": null,
    "owner": { "id": "7a90...", "name": "Priya Shah" },
    "parent_company": null,
    "custom_fields": { "abn": "12 345 678 901" },
    "archived": false,
    "archived_at": null,
    "created_at": "2026-11-14T02:01:44.120Z",
    "updated_at": "2026-12-03T04:15:00.000Z",
    "url": "https://crm.sanda-os.com.au/crm/companies/5f0c2b7e-8a51-4c8e-9d0b-2a4c7e1f9b33"
  }
}
  • A link to another record or a member is {"id", "name"}, or null. Send the id back as the field's _id, such as owner_id.
  • custom_fields holds your CRM's own fields, by key. GET /fields lists them, each with its key, label and type.
  • url opens the record's page in the CRM.
  • A person also has company, do_not_contact, do_not_contact_on and unsubscribed_at. A deal has its stage (with its outcome: open, won or lost), pipeline, values and days. An agreement has its type, status and status_name, and its days. Every field is in the reference.

List and filter

GET /companies lists the companies that are not archived, newest first, 50 at a time. Each list takes limit, cursor and order (see pages), and filters of its own.

Shell
curl "https://crm.sanda-os.com.au/api/crm/v1/people?company_id=5f0c...&q=sam" -H "Authorization: Bearer bck_..."

Every filter you send narrows the list further. q finds words anywhere in the name (and a company's domain, a person's email, or a deal's reference), whatever their case.

Companies

Parameter What it does
q Words in its name or domain.
domain Its domain, exactly.
relationship prospect, lead, client or former.
updated_since Only records changed at or after this time.
created_since Only records added at or after this time.
archived false (the default), true for archived records only, or any.
owner_id Only records this member looks after.

People

Parameter What it does
q Words in their name or email.
email Their email, exactly.
company_id Only this company’s people.
updated_since Only records changed at or after this time.
created_since Only records added at or after this time.
archived false (the default), true for archived records only, or any.
owner_id Only records this member looks after.

Deals

Parameter What it does
q Words in its name or reference.
reference Its reference, exactly.
company_id Only this company’s deals.
person_id Only deals with this person.
pipeline_id Only this pipeline’s deals.
stage_id Only deals at this stage.
outcome open, won or lost.
updated_since Only records changed at or after this time.
created_since Only records added at or after this time.
archived false (the default), true for archived records only, or any.
owner_id Only records this member looks after.

Agreements

Parameter What it does
q Words in its name.
company_id Only this company’s agreements.
status Only agreements at this status.
type_id Only agreements of this kind.
updated_since Only records changed at or after this time.
created_since Only records added at or after this time.
archived false (the default), true for archived records only, or any.

A time, such as updated_since, is ISO 8601, such as 2026-12-01T00:00:00Z. An id, such as company_id, comes from another record or from GET /members and GET /pipelines.

Orders

order Lists
newest The most recently added first. The default
oldest The first added first
updated The longest unchanged first, so the last is the one changed most recently

Keep another system in step

To copy everything once and then keep up, page through order=updated to the end, then come back with the same filters and updated_since set to when you last started, and page to the end again. A record changed while you page shows up again further on, so nothing is missed.

The change feed does the same with less to read: every change, once, in order, with what it changed.

Find one before you add it

Ask for it by what your system knows, and add it only if nothing comes back:

To find Ask
A company by its website GET /companies?domain=acme.com.au
A person by their email GET /people?email=sam@acme.com.au
A deal by your own system's id GET /deals?reference=INV-1001

A domain or an email is matched as the CRM keeps it: https://www.acme.com.au/ finds acme.com.au, and an email's case does not matter. No two deals share a reference, so a deal added with your system's id as its reference is never added twice.

Add one

POST the fields. A field the call does not take is refused, naming it.

Shell
curl https://crm.sanda-os.com.au/api/crm/v1/people \
  -H "Authorization: Bearer bck_..." \
  -H "Content-Type: application/json" \
  -d '{"name": "Sam Lee", "email": "sam@acme.com.au", "company_id": "5f0c...", "custom_fields": {"preferred_name": "Sam"}}'

The answer is 201 with the new record, as GET would read it. Left out, owner_id is the key's person.

Companies

Field Type Sent when What it takes
name string Adding and changing Its name. Needed to add one.
domain string Adding and changing Its website’s domain, such as acme.com.au.
industry string Adding and changing What it does.
size_band string Adding and changing How big it is, in your own words, such as 11 to 50.
location string Adding and changing Where it is.
notes string Adding and changing Anything else about it.
relationship string Adding and changing Where it stands: prospect, lead, client, former. Left out, a new one is a client. A company is a lead because it has a deal open, so the CRM moves it there itself.
outreach_stage string Adding and changing A prospect’s outreach: to_contact, contacted, not_now, or null.
owner_id string Adding and changing Who looks after it: a member’s id, from GET /members. Left out of a new one, the key’s person.
parent_company_id string Adding and changing The company it is part of, or null.
custom_fields object Adding and changing Your CRM’s own fields, by key (GET /fields). On a change, only the keys you send are changed; null clears one.

People

Field Type Sent when What it takes
name string Adding and changing Their name. Needed to add one.
title string Adding and changing Their job title.
email string Adding and changing Their email address.
phone string Adding and changing Their phone number.
linkedin_url string Adding and changing Their LinkedIn profile’s address.
company_id string Adding and changing The company they work for, or null.
owner_id string Adding and changing Who looks after it: a member’s id, from GET /members. Left out of a new one, the key’s person.
do_not_contact_on string Adding and changing The day they asked not to be contacted, or null when they may be again.
do_not_contact_note string Adding and changing What they asked, with do_not_contact_on.
custom_fields object Adding and changing Your CRM’s own fields, by key (GET /fields). On a change, only the keys you send are changed; null clears one.

Deals

Field Type Sent when What it takes
name string Adding and changing What it is. Needed to add one.
company_id string Adding and changing The company it is for. A deal always has one: send company_id, or company_name for a new company.
company_name string Adding only A new company’s name, made with the deal, when it is for a company the CRM does not have yet.
person_id string Adding and changing The person it is with, or null.
pipeline_id string Adding and changing Its pipeline, from GET /pipelines. Left out of a new one, the default pipeline.
stage_id string Adding and changing Its stage, from GET /pipelines. Left out of a new one, its pipeline’s first. A move a workflow holds for approval waits for it, and the answer says so.
value number Adding and changing What it is worth, before it has priced lines.
expected_close string Adding and changing The day it is expected to close, or null.
reference string Adding and changing Your own reference for it, such as an order number or another system’s id. No two deals share one.
lost_reason string Adding and changing Why it was lost, with a move to a lost stage.
closed_on string Adding and changing The day it was won or lost: with a move to a won or lost stage, or to correct a closed deal’s. Left out of a move, today.
opened_on string Adding only The day it was opened, for a deal brought in after the fact.
moved_at string Adding and changing When it reached its stage, for a move brought in after the fact. Left out, now.
ordered_on string Adding and changing The day it was ordered, or null.
due_on string Adding and changing The day it is due to be delivered, or null.
delivered_on string Adding and changing The day it was delivered, or null.
reopen boolean Changing only true reopens a lost deal, at the stage it was lost from.
owner_id string Adding and changing Who looks after it: a member’s id, from GET /members. Left out of a new one, the key’s person.
custom_fields object Adding and changing Your CRM’s own fields, by key (GET /fields). On a change, only the keys you send are changed; null clears one.

Agreements

Field Type Sent when What it takes
name string Adding and changing What it is. Needed to add one.
company_id string Adding only The company it is with. Needed to add one.
type_id string Adding and changing Its kind, from GET /agreement-types, or null.
type string Adding and changing Its kind by name, instead of type_id.
status string Adding and changing Where it is: draft, sent, bounced, current, superseded, ended. Left out of a new one, draft. A move a workflow holds for approval waits for it.
start_on string Adding and changing The day it starts, or null.
end_on string Adding and changing The day it ends, or null.
renewal string Adding and changing How it renews: automatic, by_agreement, none, or null.
notice_days integer Adding and changing The days’ notice it needs, or null.
signed_on string Adding and changing The day it was signed, or null.
signed_by_person_id string Adding and changing The person who signed it for the company, or null.
signing_link string Adding and changing Where it is signed, such as a DocuSign link, or null.
moved_at string Adding and changing When it reached its status, for a move brought in after the fact.
custom_fields object Adding and changing Your CRM’s own fields, by key (GET /fields). On a change, only the keys you send are changed; null clears one.

The CRM checks what it is sent as its own pages do: a person's email must be an email address, a custom field's value must suit its type, and a company is a lead only while it has a deal open, so the CRM moves it there and back itself. A refusal says what to change.

Change one

PATCH the fields to change. The rest stay as they are, and null clears one. In custom_fields, only the keys you send change.

Shell
curl -X PATCH https://crm.sanda-os.com.au/api/crm/v1/companies/5f0c... \
  -H "Authorization: Bearer bck_..." \
  -H "Content-Type: application/json" \
  -d '{"owner_id": "7a90...", "custom_fields": {"abn": "12 345 678 901"}}'

The answer is the record as it now stands. A change that changes nothing is not written down and sends no event. Changing a deal's stage or an agreement's status can wait for approval: see when a change waits for approval.

Do not contact

A person marked do not contact keeps do_not_contact: true with the day they asked, and one who unsubscribed has unsubscribed_at. Logging an email to either on the timeline is refused with the code do_not_contact, as the CRM's own page refuses it, unless the call says "confirm_do_not_contact": true. Set do_not_contact_on (and do_not_contact_note) to mark somebody, and null to clear it. See do not contact.

Archive and restore

POST /deals/{id}/archive puts a record away and POST /deals/{id}/restore brings it back, with an empty body. Both need crm:manage. An archived record is left out of a list unless it asks with archived=true or archived=any, and is still read by its id, with archived: true. Archiving a deal settles its client, as it does on the CRM's own page.

History

GET /companies/{id}/history lists every change to the record, newest first: who changed which field, from what to what, when, and how.

JSON
{
  "history": [
    {
      "id": "48213",
      "action": "changed",
      "field": "owner",
      "from": null,
      "to": "7a90...",
      "from_name": null,
      "to_name": "Priya Shah",
      "by": { "id": "7a90...", "name": "Priya Shah" },
      "via": "api",
      "through": "API key “Xero sync”",
      "at": "2026-12-03T04:15:00.000Z"
    }
  ],
  "next_cursor": null
}
  • action is created, changed, archived, restored, merged or deleted.
  • field is named as the record writes it: owner, not owner_id, and one of your own fields as custom_fields.abn. A link's id is in from and to, with its name as it reads now in from_name and to_name.
  • via says how: person for a page of the CRM, api for this API (with the key's name in through), mcp for a connected assistant, and sam, workflow, import, gmail and the others for the rest, as the CRM's History names them (see history).

A long history comes a page at a time: send next_cursor back as cursor.

Something unclear or out of date? Tell us, and we will fix the page.