Skip to content
Sandadocs

CRM API reference

Every endpoint of the CRM API with the scope it needs, every field each record takes, the filters, the events and the errors, generated from the API itself.

Everything on this page is read from the API's own definition when the site is built, so it is always what the API does today. The same definition is served as an OpenAPI 3.1 document, with no key needed:

Text
https://crm.sanda-os.com.au/api/crm/v1/openapi.json

Endpoints

Every path is under https://crm.sanda-os.com.au/api/crm/v1. {id} is the id of the record, entry or webhook, and {line_id} and {invoice_id} a deal's line or invoice.

Setup

Method Path Key needs What it does
GET /me crm:read Who the key acts as, its scopes, and the CRM it is for.
GET /members crm:read The people who work in the CRM, to give a record to.
GET /pipelines crm:read The pipelines, each with its stages in order.
GET /fields crm:read The CRM’s own fields on each kind of record.
GET /agreement-types crm:read The kinds of agreement.
GET /agreement-statuses crm:read The statuses an agreement moves through, in order.

Companies

Method Path Key needs What it does
GET /companies crm:read List and filter companies, a page at a time.
POST /companies crm:write Add a company.
GET /companies/{id} crm:read One of the companies.
PATCH /companies/{id} crm:write Change a company: only the fields you send.
POST /companies/{id}/archive crm:manage Archive a company.
POST /companies/{id}/restore crm:manage Bring a company back from the archive.
GET /companies/{id}/history crm:read Who changed what on a company, newest first.

People

Method Path Key needs What it does
GET /people crm:read List and filter people, a page at a time.
POST /people crm:write Add a person.
GET /people/{id} crm:read One of the people.
PATCH /people/{id} crm:write Change a person: only the fields you send.
POST /people/{id}/archive crm:manage Archive a person.
POST /people/{id}/restore crm:manage Bring a person back from the archive.
GET /people/{id}/history crm:read Who changed what on a person, newest first.

Deals

Method Path Key needs What it does
GET /deals crm:read List and filter deals, a page at a time.
POST /deals crm:write Add a deal.
GET /deals/{id} crm:read One of the deals.
PATCH /deals/{id} crm:write Change a deal: only the fields you send.
POST /deals/{id}/archive crm:manage Archive a deal.
POST /deals/{id}/restore crm:manage Bring a deal back from the archive.
GET /deals/{id}/history crm:read Who changed what on a deal, newest first.
GET /deals/{id}/lines crm:read A deal’s lines: what it sells.
POST /deals/{id}/lines crm:write Add a line to a deal.
PATCH /deals/{id}/lines/{line_id} crm:write Change a line, or say what was delivered.
DELETE /deals/{id}/lines/{line_id} crm:write Take a line off a deal.
GET /deals/{id}/invoices crm:read The invoices put against a deal.
POST /deals/{id}/invoices crm:write Put an invoice against a deal.
PATCH /deals/{id}/invoices/{invoice_id} crm:write Mark an invoice paid, or not.
DELETE /deals/{id}/invoices/{invoice_id} crm:write Take an invoice off a deal.

Agreements

Method Path Key needs What it does
GET /agreements crm:read List and filter agreements, a page at a time.
POST /agreements crm:write Add an agreement.
GET /agreements/{id} crm:read One of the agreements.
PATCH /agreements/{id} crm:write Change an agreement: only the fields you send.
POST /agreements/{id}/archive crm:manage Archive an agreement.
POST /agreements/{id}/restore crm:manage Bring an agreement back from the archive.
GET /agreements/{id}/history crm:read Who changed what on an agreement, newest first.

Timeline

Method Path Key needs What it does
GET /activities crm:read The timeline: what happened, newest first, a page at a time.
POST /activities crm:write Log a note, an email, a call, a meeting or a LinkedIn message.
GET /activities/{id} crm:read One entry on the timeline.
PATCH /activities/{id} crm:write Change an entry you logged.
DELETE /activities/{id} crm:write Remove an entry you logged.

Changes

Method Path Key needs What it does
GET /events crm:read Every change to every record, in the order it happened, from a cursor.
GET /webhooks crm:manage The CRM’s webhooks.
POST /webhooks crm:manage Add a webhook. Its signing secret is shown once.
GET /webhooks/{id} crm:manage One webhook, with how its last delivery went.
PATCH /webhooks/{id} crm:manage Change a webhook, or switch it back on.
DELETE /webhooks/{id} crm:manage Remove a webhook.
POST /webhooks/{id}/test crm:manage Send a webhook a test event, and say how it answered.

Records

What each record takes when it is added (POST) or changed (PATCH). A field a call does not take is refused with 400, naming it.

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.

Timeline entries

Field Type Sent when What it takes
kind string Adding only What happened: note, email, linkedin, call, meeting. Needed to log one.
direction string Adding and changing in or out, for email, linkedin, call. Left out, out.
body string Adding and changing What was said or done. A note needs one.
occurred_at string Adding and changing When it happened. Left out, now.
company_id string Adding only The company it is about.
person_id string Adding only The person it is with. Their company is linked too.
deal_id string Adding only The deal it is about. Its company and person are linked too.
agreement_id string Adding only The agreement it is about.
confirm_do_not_contact boolean Adding only true logs an email to somebody marked do not contact or unsubscribed, which is otherwise refused.
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.

A deal's lines

Field Type Sent when What it takes
description string Adding and changing The item: what is sold. Needed to add one.
code string Adding and changing Its code or SKU.
quantity number Adding and changing How many. Left out of a new one, 1.
unit_price number Adding and changing The price of one, or null while it has none.
discount number Adding and changing The discount, as a percentage.
discount_label string Adding and changing What the discount is called on a quote.
billing string Adding and changing How it is charged: one_off or monthly.
basis string Adding and changing What it is priced on, in your own words, such as per site.
product_id string Adding only The product on a price list it came from.
received number Changing only How many were delivered.
rejected boolean Changing only true when the client turned it down.

A deal's invoices

Field Type Sent when What it takes
amount number Adding only What it is for. Needed to add one.
reference string Adding only Its number in your accounting system.
invoiced_on string Adding only The day it was raised. Left out, today.
paid boolean Adding and changing true marks it paid (today unless paid_on says), false not paid.
paid_on string Adding and changing The day it was paid.

Filters

What each list takes, beside limit, cursor and order (newest, oldest or updated). A parameter a list does not take is refused with 400, naming it.

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.

Timeline entries

Parameter What it does
company_id What happened with this company, its people and its deals, as its timeline shows.
person_id Only entries with this person.
deal_id Only entries about this deal.
agreement_id Only entries about this agreement.
kind Only these kinds, with commas: note,call.
since Only entries that happened at or after this time.
updated_since Only entries added or changed at or after this time.

Events

On the change feed and in webhooks. See the change feed and webhooks.

Event Sent when
company.created A company was added.
company.updated A company changed: the event lists each field, before and after.
company.archived A company was archived.
company.restored A company was brought back from the archive.
company.merged A company was merged into another, which the event names.
company.deleted A company was removed.
person.created A person was added.
person.updated A person changed: the event lists each field, before and after.
person.archived A person was archived.
person.restored A person was brought back from the archive.
person.merged A person was merged into another, which the event names.
person.deleted A person was removed.
deal.created A deal was added.
deal.updated A deal changed: the event lists each field, before and after (a move to another stage, a line or an invoice too).
deal.archived A deal was archived.
deal.restored A deal was brought back from the archive.
deal.merged A deal was merged into another, which the event names.
deal.deleted A deal was removed.
agreement.created An agreement was added.
agreement.updated An agreement changed: the event lists each field, before and after.
agreement.archived An agreement was archived.
agreement.restored An agreement was brought back from the archive.
agreement.merged An agreement was merged into another, which the event names.
agreement.deleted An agreement was removed.

Scopes

Scope On Settings · API keys What a key with it may do
crm:read Read only Read companies, people, deals, agreements, the timeline and the change feed.
crm:write Read and change Also add and change them, a deal’s lines and invoices, and log on the timeline.
crm:manage Read, change and set up Also archive and restore records, and manage webhooks.

Limits

Calls a key makes in a minute 300. Past it, 429 with Retry-After
A request body 200 KB
Records a page of a list holds 50 unless limit says otherwise, up to 100
Events a page of the feed holds 100 unless limit says otherwise, up to 500
Keys one person keeps in one CRM 10
The longest a key may last, short of never 365 days
Webhooks one CRM keeps 10
Time a webhook has to answer 10 seconds
Failures in a row before a webhook is switched off 50

Errors

Every refusal is JSON: {"error": {"code": "...", "message": "..."}}. message is a sentence a person can act on, and code is for your code to branch on.

Status code When
400 invalid_request A field or parameter the call does not take, a value it cannot use, a cursor it did not give, or a body that is not a JSON object
401 unauthorized No key, or one the CRM does not know, has revoked or has seen expire
402 workspace_suspended The workspace is suspended
403 insufficient_scope The key was not made with the scope this endpoint needs. required_scope names it
403 forbidden The key's person may not do this: their role, their CRM licence, a CRM that is closed or whose trial has ended (it reads but does not change)
404 not_found No such endpoint, record, line, invoice, entry or webhook
405 method_not_allowed The path takes other methods. The Allow header lists them
409 conflict The change clashes with what is there: another deal already has that reference, or a lost deal's lines are changed
409 do_not_contact An email logged to somebody marked do not contact or unsubscribed. Send confirm_do_not_contact to log it anyway
413 too_large The body is larger than a call takes
429 rate_limited The key made more calls in a minute than the API takes
500 internal_error The CRM could not answer. Try again, and tell Sanda support if it keeps happening
503 unavailable The CRM is not ready to answer, such as while it is being set up

A change that waits for approval is not an error: it answers 202 with pending_approval. See when a change waits for approval.

Versions

Every answer carries a Sanda-Api-Version header, 1.0.0 today, and the version is in the address (/v1). New endpoints, fields and events can be added to a version, so a client should ignore what it does not know.

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