ready. Try Ready →Sign up

#Contacts

One contact per phone number. Errors in this section carry their code in code.

Details
  • tags comes back as a JSON-encoded string, for example "[\"vip\",\"hot\"]". Parse it with JSON.parse(contact.tags). When you send tags, send a real array.
  • Contacts have more fields than shown here. Ignore fields you don't recognize; new ones may be added.
  • Suppression fields (opt_out_locked, dnd_sms and others) are explained under Opt-outs.

#List contacts

GET/contacts

Your contacts, most recently updated first, with filters.

  • Cost Free

Query parameters

tagstringOptional
Exact tag name, case-sensitive: VIP isn't vip.
statusstringOptional
For example opted_out.
dndintegerOptional
1: only contacts with texting turned off.
limitintegerOptionalDefault 50Max 1000
Page size.
offsetintegerOptionalDefault 0
Rows to skip: a whole number, 0 or more.
sortenumOptional
Default: most recently updated first. For a full export use date_added.
DetailsA contact edited while you page jumps to the front of the default order. Unknown values fall back to the default.
  • date_added
  • name_asc , name_desc
  • phone_asc , phone_desc
  • status_asc , status_desc
  • score_high , score_low
  • lastact_asc , lastact_desc
  • source_asc , source_desc
  • assignee_asc , assignee_desc
More parameters (7)
stagestringOptional
Pipeline stage.
sourcestringOptional
Where the contact came from.
companystringOptional
Company name.
statestringOptional
US state.
assigned_tostringOptional
A team member id, or unassigned.
score_min, score_maxintegerOptional
Lead score range.
include_spamintegerOptional
Contacts marked spam are left out unless you send 1.

Returns

data[]object[]
Contacts.
totalinteger
Matching contacts, for display only. Stop paging on a page shorter than limit (or empty).
DetailsIt can be an estimate, up to 2 minutes old, and can show 1 when nothing matches.

Errors

HTTPCodeWhen
400invalid_offsetNot a whole number, 0 or more (in error_code).

#Get a contact

GET/contacts/:id

One contact by id.

  • Cost Free

Path parameters

idintegerRequired
The contact id.

Returns

dataobject
The contact.

Errors

HTTPCodeWhen
404CONTACT_NOT_FOUNDNot on your account, or a non-numeric id.

#Create a contact

POST/contacts

Adds a contact. Returns 201 with the new contact.

Note. Retrying a timed-out create is safe: an existing number (any format) returns 409 CONTACT_EXISTS.
DetailsIdempotency-Key isn't used here. A new contact is scrubbed and fires the contact_created webhook.

Body parameters

phonestringRequired
E.164 recommended (+12125550199). Any common US format is accepted; stored as E.164.
first_namestringOptional
last_namestringOptional
emailstringOptional
tagsstring[]Optional
An array of strings.
company_namestringOptional
pipeline_stagestringOptionalDefault new_lead
Free text; use the stage ids from your pipeline.
sourcestringOptionalDefault manual
timezonestringOptional
IANA name such as America/Chicago. If omitted, set from a US number's area code.
More parameters (6)
websitestringOptional
address1, address2, city, state, postal_code, countrystringOptional
Address fields.
date_of_birthstringOptional
genderstringOptional
assigned_tointegerOptional
A team member id.
dnd_sms, dnd_email, dnd_callsintegerOptional
1 to turn off texting, email or calls. Turning texting off is an opt-out that can't be undone over the API.

Returns

dataobject
The new contact. Defaults: status: "active", score: 50.

Errors

HTTPCodeWhen
400no codeNo phone number.
400INVALID_PHONEThe number can't be read.
DetailsIts message mentions a 10-digit US number, but E.164 numbers from other countries are accepted.
400invalid_fieldWrong type, such as non-list tags.
400ASSIGNEE_NOT_ON_ACCOUNTassigned_to isn't on your account.
403permission_deniedKey lacks edit_contacts.
403test_key_not_allowedCalled with a test key.
409CONTACT_EXISTSNumber exists. Find it with GET /contacts?search=<phone>.

#Update a contact

PUT/contacts/:id

Changes only the fields you send. Use PUT: PATCH isn't supported.

  • Cost Free
Important. Unknown fields are ignored with a 200, so check the returned contact.

Path parameters

idintegerRequired
The contact id.

Body parameters

first_name, last_name, emailstringOptional
tagsstring[]Optional
An array that replaces the whole list.
DetailsA plain string, null or "" is 400 invalid_field; send [] to clear. Send tags_base (the list you started from) too, and only your changes are applied.
pipeline_stagestringOptional
Free text.
statusstringOptional
You can't move an opted-out contact off opted_out.
dnd_smsintegerOptional
1 opts the contact out of texts.
DetailsYou can't set it back to 0 on an opted-out contact (403): the contact must text START.
custom_fieldsobjectOptional
Merged key by key. null for a key deletes it.
phonestringOptional
Can't be changed: create a new contact instead.
DetailsThe same number in another format is fine.
More parameters (7)
dnd_email, dnd_callsintegerOptional
notesstringOptional
scoreintegerOptional
A non-integer returns 400 CONTACT_UPDATE_FAILED.
source, company_name, timezonestringOptional
address1, address2, city, state, postal_code, countrystringOptional
assigned_tointegerOptional
inbound_blockedintegerOptional

Returns

dataobject
The updated contact.

Errors

HTTPCodeWhen
400PHONE_NOT_EDITABLEYou sent a different phone number.
400invalid_fieldWrong type, such as non-list tags.
400ASSIGNEE_NOT_ON_ACCOUNTassigned_to isn't on your account.
400CONTACT_UPDATE_FAILEDA value can't be saved (500 if the save failed).
403opt_out_lockedRe-enabling texting on a STOP-locked contact (in error_code).
403opted_outSame, for other opt-outs such as Do Not Disturb (in error_code).
403permission_deniedKey lacks edit_contacts.
403test_key_not_allowedCalled with a test key.
404CONTACT_NOT_FOUNDNo contact with this id.
409CONTACT_CHANGEDThe contact opted out mid-save.
500CUSTOM_FIELD_NOT_SAVEDA custom field didn't save. Retry.

#Delete a contact

DEL/contacts/:id

Permanently removes the contact and its conversation history, notes and tasks.

  • Cost Free

Path parameters

idintegerRequired
The contact id, not its phone number.

Errors

HTTPCodeWhen
400INVALID_CONTACT_IDNot a contact id (for example a phone number).
403permission_deniedKey lacks edit_contacts.
403test_key_not_allowedCalled with a test key.
404CONTACT_NOT_FOUNDNo such contact, or already deleted.
423LITIGATION_HOLDUnder a legal hold.