Add a note to a customer
const url = 'https://api.usesonora.com/v1/customers/example/notes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"title":"example","contentMarkdown":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.usesonora.com/v1/customers/example/notes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "title": "example", "contentMarkdown": "example" }'Write a shared note on a customer, from Markdown. Everyone in your workspace who can read notes sees it on the customer, with the key named as its author. Send an Idempotency-Key to make a retry safe.
Requires the notes:write scope. API keys only.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The customer’s Sonora id — or, with idType, its id in another system, or its domain.
Query Parameters
Section titled “Query Parameters”How id names the account: sonora (the default; Sonora’s customer id), salesforce, hubspot, domain, or custom_field:<key>. So GET /customers/001Ab…?idType=salesforce finds a customer by its Salesforce Account id.
Header Parameters
Section titled “Header Parameters”1–255 printable characters. A retry with the same key and request answers with the first call’s result instead of acting twice.
Request Bodyrequired
Section titled “Request Bodyrequired”A shared note to add to a customer.
object
Defaults to Untitled, as a new note in Sonora does.
The note as Markdown: headings, lists, - [ ] checklists, links, emphasis and code. Raw HTML is shown as text, never rendered.
Examplegenerated
{ "title": "example", "contentMarkdown": "example"}Responses
Section titled “Responses”The note, created.
A note your team shares on a customer.
object
The note as Markdown: headings, lists, checklists, links and emphasis kept.
The note as plain text, for search or a preview.
Who wrote a note: a person on your team, or an API key — never the person who created the key.
object
user for a note someone wrote in Sonora; api_key for one written through the API.
The person’s name, or the API key’s. Null for a key since deleted.
The person’s email. Always null for an API key.
object
This resource’s canonical URL on the API host.
Example
{ "author": { "type": "user" }}Headers
Section titled “Headers”A fingerprint of the note’s title and body. Send it back as If-Match to update only if neither has changed since.
true when this answers a retry with an earlier call’s Idempotency-Key: the first call’s body, replayed.
invalid_json: The request body is not valid JSON.
invalid_request: A parameter or body field is missing, malformed or unknown; details.issues names each.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}unauthorized: The Authorization header is missing, or the key is invalid, revoked or expired.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}insufficient_scope: The key or token lacks the scope this endpoint needs, and details.required names it; or an OAuth access token called an endpoint only an API key can.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}customer_not_found: No customer matches the id (and idType) in the path.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}idempotency_key_in_use: A request with this Idempotency-Key is still being processed. Retry once it has finished.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}payload_too_large: The request body is too large; details.maxBytes gives the limit.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}idempotency_key_mismatch: The Idempotency-Key was used before with a different request.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}rate_limited: Too many requests for this key; retry after Retry-After seconds.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}internal_error: Something went wrong on Sonora’s side. Retry, and quote requestId if it persists.
The one error shape every endpoint answers with.
object
object
Stable snake_case code to branch on; see the error table.
For humans; may change.
object
Quote it when asking for help.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": { "additionalProperty": "example" }, "requestId": "example" }}Try it
Try it runs the reference's read endpoints, and this one changes data, so it needs an API key with the notes:write scope. Create a key in Sonora under Settings → API and call it from your own code.