Skip to content
Svanja

Docs API reference

CRM

Read and change contacts and companies, and see their conversations.

CRM covers the people and companies in Contacts, which Svanja builds from your mail. In the API, companies are called accounts. You can use these endpoints to keep contact details in sync with another tool, or to look up a contact’s company and conversations. To use them, your API key needs the Custom preset with the Mail contacts and companies area, and the key’s owner has to approve it under Mail access approval on the API Keys page. If you also want to list a contact’s or company’s conversations, you need Mail content, approved the same way. See Contacts and companies for more details.

GET /mail/crm/contacts/{id} returns a contact along with its linked company under account.

Every change requires "confirm": true. When you update an existing record, you also need to include its current revision from when you last read it. If someone else changed the record in the meantime, the API returns conflict. Moving a record to trash can be undone, while the force endpoints delete it permanently. You can also work with these records from a terminal using svanja crm.

Operations

An operation is one thing you can do, like reading a task or starting one. Its effect says what it changes. Some operations that act outside Svanja or change access wait for a person's approval; the approval flow is on the API overview.

crm.read Reads only

Read CRM records.

GET /mail/crm/contacts GET /mail/crm/contacts/{resource_id} GET /mail/crm/contacts/{resource_id}/conversations GET /mail/crm/accounts GET /mail/crm/accounts/{resource_id} GET /mail/crm/accounts/{resource_id}/conversations

crm.write Changes data in Svanja

Mutate CRM records.

POST /mail/crm/contacts PATCH /mail/crm/contacts/{resource_id} POST /mail/crm/contacts/{resource_id}/emails DELETE /mail/crm/contacts/{resource_id}/emails PUT /mail/crm/contacts/{resource_id}/account DELETE /mail/crm/contacts/{resource_id}/account POST /mail/crm/contacts/{resource_id}/merge POST /mail/crm/contacts/{resource_id}/archive POST /mail/crm/contacts/{resource_id}/unarchive POST /mail/crm/contacts/{resource_id}/restore DELETE /mail/crm/contacts/{resource_id} POST /mail/crm/accounts PATCH /mail/crm/accounts/{resource_id} POST /mail/crm/accounts/{resource_id}/domains PATCH /mail/crm/accounts/{resource_id}/domains DELETE /mail/crm/accounts/{resource_id}/domains POST /mail/crm/accounts/{resource_id}/merge POST /mail/crm/accounts/{resource_id}/archive POST /mail/crm/accounts/{resource_id}/unarchive POST /mail/crm/accounts/{resource_id}/restore DELETE /mail/crm/accounts/{resource_id}

Endpoints

Paths start at https://app.svanja.com/api/v1. Every endpoint needs an API key unless it says otherwise. A required Idempotency-Key header is listed with the parameters.

GET /mail/crm/contacts/{resource_id}/conversations Read recent contact conversations

Requires Custom CRM read capability and personal CRM approval AND separate content capability/consent. Current direct content grants, workspace visibility and the approved content mailbox list restrict the shared query before counts, sorting and limits. Returns at most 20 recent links, total matching count and has_more. Excludes Draft/Trash/Junk-only participant appearances. No bodies, snippets, attachments or internal identifiers. Ordinary CRM metadata reads remain content-free.

Parameter In Type Required Notes
resource_id path string yes

Status codes: 200, 401, 403, 404, 422, 429

GET /mail/crm/accounts/{resource_id}/conversations Read recent account conversations

Requires Custom CRM read capability and personal CRM approval AND separate content capability/consent. Current direct content grants, workspace visibility and the approved content mailbox list restrict the shared query before counts, sorting and limits. Returns at most 20 recent links, total matching count and has_more. Excludes Draft/Trash/Junk-only participant appearances. No bodies, snippets, attachments or internal identifiers. Ordinary CRM metadata reads remain content-free.

Parameter In Type Required Notes
resource_id path string yes

Status codes: 200, 401, 403, 404, 422, 429

DELETE /mail/crm/contacts/{resource_id}/force Permanently delete a trashed CRM contact

Requires current CRM write capability, explicit personal CRM write consent, team management rights, confirm=true, Idempotency-Key and the exact reviewed trashed-record revision. Irreversibly removes the record and its owned identities/custom values. Company deletion unlinks its contacts rather than deleting contacts. No mailbox content is returned or email sent. A successful response is a content-free historical receipt; same-key replay rechecks current class-scope authority and never repeats deletion. A different key after deletion returns404. Active records must first move to trash.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

DELETE /mail/crm/accounts/{resource_id}/force Permanently delete a trashed CRM account

Requires current CRM write capability, explicit personal CRM write consent, team management rights, confirm=true, Idempotency-Key and the exact reviewed trashed-record revision. Irreversibly removes the record and its owned identities/custom values. Company deletion unlinks its contacts rather than deleting contacts. No mailbox content is returned or email sent. A successful response is a content-free historical receipt; same-key replay rechecks current class-scope authority and never repeats deletion. A different key after deletion returns404. Active records must first move to trash.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/contacts/{resource_id}/emails Confirm CRM add email

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
email string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

DELETE /mail/crm/contacts/{resource_id}/emails Confirm CRM remove email

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
email string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

PUT /mail/crm/contacts/{resource_id}/account Confirm CRM link account

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
account_id string yes
account_revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

DELETE /mail/crm/contacts/{resource_id}/account Confirm CRM unlink account

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/accounts/{resource_id}/domains Confirm CRM add domain

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
domain string yes
match_mode one of suggest_only, auto_link yes

Status codes: 200, 401, 403, 404, 409, 422, 429

PATCH /mail/crm/accounts/{resource_id}/domains Confirm CRM update domain

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
domain_id string yes
match_mode one of suggest_only, auto_link yes

Status codes: 200, 401, 403, 404, 409, 422, 429

DELETE /mail/crm/accounts/{resource_id}/domains Confirm CRM remove domain

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
domain_id string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/contacts/{resource_id}/merge Confirm CRM merge

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
source_id string yes
source_revision string yes
field_choices object no

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/accounts/{resource_id}/merge Confirm CRM merge

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state. Domain auto_link changes future team contact matching. Merge moves source identities, history and custom values into the survivor and soft-deletes the source; both revisions must match. Account links require the current account revision.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
source_id string yes
source_revision string yes
field_choices object no

Status codes: 200, 401, 403, 404, 409, 422, 429

GET /mail/crm/contacts List team contacts

Requires explicitly selected Custom CRM read capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Stable ID ordering; cursors bind actor, key and filters. Search is a literal name/address/domain substring.

Parameter In Type Required Notes
per_page query integer no
cursor query string no
query query string no
include_archived query one of 0, 1 no Use 1 or 0.
include_deleted query one of 0, 1 no Use 1 or 0.

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/contacts Create team contacts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
Idempotency-Key header string yes

Send at least one of email, primary_email.

Body field Type Required Notes
confirm always true yes
name string or null no
email string no
primary_email string no

Status codes: 201, 401, 403, 404, 409, 422, 429

GET /mail/crm/contacts/{resource_id} Get team contacts

Requires explicitly selected Custom CRM read capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Stable ID ordering; cursors bind actor, key and filters. Search is a literal name/address/domain substring.

Parameter In Type Required Notes
resource_id path string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

PATCH /mail/crm/contacts/{resource_id} Update team contacts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes

Send at least one of name, email, primary_email.

Body field Type Required Notes
confirm always true yes
revision string yes
name string or null no
email string no
primary_email string no

Status codes: 200, 401, 403, 404, 409, 422, 429

DELETE /mail/crm/contacts/{resource_id} Delete team contacts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/contacts/{resource_id}/archive Archive team contacts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/contacts/{resource_id}/unarchive Unarchive team contacts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/contacts/{resource_id}/restore Restore team contacts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

GET /mail/crm/accounts List team accounts

Requires explicitly selected Custom CRM read capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Stable ID ordering; cursors bind actor, key and filters. Search is a literal name/address/domain substring.

Parameter In Type Required Notes
per_page query integer no
cursor query string no
query query string no
include_archived query one of 0, 1 no Use 1 or 0.
include_deleted query one of 0, 1 no Use 1 or 0.

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/accounts Create team accounts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
name string yes

Status codes: 201, 401, 403, 404, 409, 422, 429

GET /mail/crm/accounts/{resource_id} Get team accounts

Requires explicitly selected Custom CRM read capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Stable ID ordering; cursors bind actor, key and filters. Search is a literal name/address/domain substring.

Parameter In Type Required Notes
resource_id path string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

PATCH /mail/crm/accounts/{resource_id} Update team accounts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes
name string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

DELETE /mail/crm/accounts/{resource_id} Delete team accounts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/accounts/{resource_id}/archive Archive team accounts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/accounts/{resource_id}/unarchive Unarchive team accounts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

POST /mail/crm/accounts/{resource_id}/restore Restore team accounts

Requires explicitly selected Custom CRM read/write capability and separate personal CRM consent. Current team membership and management policy apply. No mailbox selection or email-content authority is implied. Requires confirm=true and Idempotency-Key; existing records require their exact reviewed revision. Encrypted historical replay repeats no effects and rechecks current authority. Unarchive restores archived metadata; restore undeletes without changing archived state.

Parameter In Type Required Notes
resource_id path string yes
Idempotency-Key header string yes
Body field Type Required Notes
confirm always true yes
revision string yes

Status codes: 200, 401, 403, 404, 409, 422, 429

This page as plain Markdown, for AI tools: crm.md

Try Svanja with your own mailbox

Sign up now, and you get an email when your account is ready.