#Contacts
One contact per phone number. Errors in this section carry their code in code.
Details
tagscomes back as a JSON-encoded string, for example"[\"vip\",\"hot\"]". Parse it withJSON.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_smsand others) are explained under Opt-outs.
#List contacts
GET
/contactsYour contacts, most recently updated first, with filters.
Query parameters
searchstringOptional- Partial, case-insensitive match on name, email, company or phone.
Details
Name means first or last name. Phone numbers match in any format. Withouttag, at most the 5,000 best matches are considered, so narrow broad searches. tagstringOptional- Exact tag name, case-sensitive:
VIPisn'tvip. statusstringOptional- For example
opted_out. dndintegerOptional1: only contacts with texting turned off.limitintegerOptionalDefault50Max1000- Page size.
offsetintegerOptionalDefault0- Rows to skip: a whole number, 0 or more.
sortenumOptional- Default: most recently updated first. For a full export use
date_added.Details
A contact edited while you page jumps to the front of the default order. Unknown values fall back to the default.date_addedname_asc,name_descphone_asc,phone_descstatus_asc,status_descscore_high,score_lowlastact_asc,lastact_descsource_asc,source_descassignee_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).Details
It can be an estimate, up to 2 minutes old, and can show 1 when nothing matches.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_offset | Not a whole number, 0 or more (in error_code). |
#Get a contact
GET
/contacts/:idOne contact by id.
Path parameters
idintegerRequired- The contact id.
Returns
dataobject- The contact.
Errors
| HTTP | Code | When |
|---|---|---|
| 404 | CONTACT_NOT_FOUND | Not on your account, or a non-numeric id. |
#Create a contact
POST
/contactsAdds 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.Details
Idempotency-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_namestringOptionallast_namestringOptionalemailstringOptionaltagsstring[]Optional- An array of strings.
company_namestringOptionalpipeline_stagestringOptionalDefaultnew_lead- Free text; use the stage ids from your pipeline.
sourcestringOptionalDefaultmanualtimezonestringOptional- IANA name such as
America/Chicago. If omitted, set from a US number's area code.
More parameters (6)
websitestringOptionaladdress1, address2, city, state, postal_code, countrystringOptional- Address fields.
date_of_birthstringOptionalgenderstringOptionalassigned_tointegerOptional- A team member id.
dnd_sms, dnd_email, dnd_callsintegerOptional1to 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
| HTTP | Code | When |
|---|---|---|
| 400 | no code | No phone number. |
| 400 | INVALID_PHONE | The number can't be read.DetailsIts message mentions a 10-digit US number, but E.164 numbers from other countries are accepted. |
| 400 | invalid_field | Wrong type, such as non-list tags. |
| 400 | ASSIGNEE_NOT_ON_ACCOUNT | assigned_to isn't on your account. |
| 403 | permission_denied | Key lacks edit_contacts. |
| 403 | test_key_not_allowed | Called with a test key. |
| 409 | CONTACT_EXISTS | Number exists. Find it with GET /contacts?search=<phone>. |
#Update a contact
PUT
/contacts/:idChanges only the fields you send. Use PUT: PATCH isn't supported.
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, emailstringOptionaltagsstring[]Optional- An array that replaces the whole list.
Details
A plain string,nullor""is400 invalid_field; send[]to clear. Sendtags_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_smsintegerOptional1opts the contact out of texts.Details
You can't set it back to0on an opted-out contact (403): the contact must text START.custom_fieldsobjectOptional- Merged key by key.
nullfor a key deletes it. phonestringOptional- Can't be changed: create a new contact instead.
Details
The same number in another format is fine.
More parameters (7)
dnd_email, dnd_callsintegerOptionalnotesstringOptionalscoreintegerOptional- A non-integer returns
400 CONTACT_UPDATE_FAILED. source, company_name, timezonestringOptionaladdress1, address2, city, state, postal_code, countrystringOptionalassigned_tointegerOptionalinbound_blockedintegerOptional
Returns
dataobject- The updated contact.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | PHONE_NOT_EDITABLE | You sent a different phone number. |
| 400 | invalid_field | Wrong type, such as non-list tags. |
| 400 | ASSIGNEE_NOT_ON_ACCOUNT | assigned_to isn't on your account. |
| 400 | CONTACT_UPDATE_FAILED | A value can't be saved (500 if the save failed). |
| 403 | opt_out_locked | Re-enabling texting on a STOP-locked contact (in error_code). |
| 403 | opted_out | Same, for other opt-outs such as Do Not Disturb (in error_code). |
| 403 | permission_denied | Key lacks edit_contacts. |
| 403 | test_key_not_allowed | Called with a test key. |
| 404 | CONTACT_NOT_FOUND | No contact with this id. |
| 409 | CONTACT_CHANGED | The contact opted out mid-save. |
| 500 | CUSTOM_FIELD_NOT_SAVED | A custom field didn't save. Retry. |
#Delete a contact
DEL
/contacts/:idPermanently removes the contact and its conversation history, notes and tasks.
Legal. Keep your own opt-out list: a re-added number shows as not opted out.
Details
If you add the number again, the new contact andGET /v1/opt-outs/:phone show it as not opted out. Ready keeps the opt-out in a separate record for its own send check, but check your own list before you add a number back.Path parameters
idintegerRequired- The contact id, not its phone number.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | INVALID_CONTACT_ID | Not a contact id (for example a phone number). |
| 403 | permission_denied | Key lacks edit_contacts. |
| 403 | test_key_not_allowed | Called with a test key. |
| 404 | CONTACT_NOT_FOUND | No such contact, or already deleted. |
| 423 | LITIGATION_HOLD | Under a legal hold. |