#Conversations
The inbox has one thread per contact. To reply, send to the contact with POST /v1/messages; it lands in the same thread.
Errors here carry their code in code unless noted. View-only teammates can read conversations but not change them.
#List conversations
GET
/conversationsYour inbox threads: starred first, then by latest message.
Query parameters
limitintegerOptionalDefault50Max1000- Page size.
offsetintegerOptionalDefault0- Rows to skip: a whole number, 0 or more.
filterenumOptional- Which view; default is open threads (archived and snoozed hidden). Unknown values are ignored.
unreadstarredarchivedsnoozedspamblocked
searchstringOptional- Matches the contact's name, phone, email or company, or the thread's most recent message.
Details
Older messages aren't searched. A full phone number in any format matches exactly. line_idsstringOptional- Comma-separated number ids from
GET /v1/numbers(not phone numbers), up to 100.Details
For exampleline_ids=2647,2648. Invalid values are ignored, which returns the whole inbox. freshintegerOptional- Lists are cached up to 30 seconds. Send
1after a change to read live.
Returns
data[]object[]- Threads. Ignore fields you don't recognize.
Details
Fields includeid,contact_id,first_name,last_name,phone,status,unread_count,starred,pinned,assigned_to,last_message_at,last_message_preview,phone_number_id,from_number,tagsand more. has_moreboolean- Keep paging while
true. totalinteger- Threads matching
filterandsearch, counted up to 1,000.Details
Past that,total_capped: trueandcount_cap: 1000. Withline_ids,totalandcountsignore the lines and count every line's threads, so usehas_more. countsobject- Thread counts per view.
Details
all(the default view, without archived and snoozed),unread,starred,pinned,archived,snoozed,spam.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_offset | Not a whole number, 0 or more (in error_code). |
#List messages in a conversation
GET
/conversations/:id/messagesOne thread's messages: the newest page, oldest first within the page.
Important. Reading the newest page marks the thread as read. Sync jobs should add
mark_read=0.Path parameters
idintegerRequired- The conversation id.
Query parameters
mark_readintegerOptional- Send
0to leave the unread state alone. limitintegerOptionalDefault50Max500- Page size.
offsetintegerOptionalDefault0- Increase to go further back in time.
Returns
data[]object[]- Messages. Ignore fields you don't recognize.
Details
Fields includeid,direction(inboundoroutbound),body,status,to_number,from_number,segments,cost,media_url,created_at,sent_at,delivered_at,failed_at, and more.
Errors
| HTTP | Code | When |
|---|---|---|
| 403 | CONVERSATION_NOT_ASSIGNED | Teammate access doesn't cover this thread.DetailsAssigned to someone else. AlsoCONVERSATION_NOT_ALLOCATED: the thread's number isn't allocated to you. |
| 404 | CONVERSATION_NOT_FOUND | No such conversation on your account. |
#Find a contact's conversation
GET
/conversations/by-contact/:contactIdThe thread for one contact, or null if there isn't one.
Path parameters
contactIdintegerRequired- The contact id.
Returns
dataobject | null- The thread, or
null. An unknown contact id also returnsnull, not a404.Details
This row hascontact_status,dnd_smsandopt_out_at, and notags.
Errors
| HTTP | Code | When |
|---|---|---|
| 403 | CONVERSATION_NOT_ASSIGNED | Teammate access doesn't cover this thread.DetailsAssigned to someone else. AlsoCONVERSATION_NOT_ALLOCATED: the thread's number isn't allocated to you. |
#Assign a conversation
PUT
/conversations/:id/assignReplaces the thread's assignees.
Path parameters
idintegerRequired- The conversation id.
Body parameters
assignee_idsinteger[]Required- Team member ids (Settings → Team);
[]unassigns. The first id is the primary owner.Details
The first id also becomes the contact's owner. It must be a JSON array of ids.
Returns
assignee_idsinteger[]- The new assignees, at the top level.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_assignee_ids | Not a list of ids (in error_code). |
| 400 | invalid_assignee | An id isn't on your team. |
| 404 | not_found | No such conversation (lower case here). |
#Set conversation status
PUT
/conversations/:id/statusOpens or closes a thread.
Path parameters
idintegerRequired- The conversation id.
Body parameters
statusenumRequiredopenorclosed(alsoactive,archived). To archive, prefer Archive, which also sets the archive time.
Errors
| HTTP | Code | When |
|---|---|---|
| 400 | invalid_status | Missing or unknown status. |
| 404 | no code | No such conversation. |
#Mark read
PUT
/conversations/:id/readClears the thread's unread count. No body.
Path parameters
idintegerRequired- The conversation id.
Errors
| HTTP | Code | When |
|---|---|---|
| 404 | CONVERSATION_NOT_FOUND | No such conversation on your account. |
#Mark unread
PUT
/conversations/:id/unreadSets the thread's unread count to 1. No body.
Path parameters
idintegerRequired- The conversation id.
Errors
| HTTP | Code | When |
|---|---|---|
| 404 | CONVERSATION_NOT_FOUND | No such conversation on your account. |
#Archive
PUT
/conversations/:id/archiveArchives the thread and clears its unread count. No body.
Path parameters
idintegerRequired- The conversation id.
Errors
| HTTP | Code | When |
|---|---|---|
| 404 | CONVERSATION_NOT_FOUND | No such conversation on your account. |
#Unarchive
PUT
/conversations/:id/unarchiveBrings the thread back to the inbox with status: "open", even if it was closed. No body.
Path parameters
idintegerRequired- The conversation id.
Errors
| HTTP | Code | When |
|---|---|---|
| 404 | CONVERSATION_NOT_FOUND | No such conversation on your account. |
#Star or unstar
PUT
/conversations/:id/starToggles the star on or off. No body.
Path parameters
idintegerRequired- The conversation id.
Returns
data.starredinteger- The new value,
1or0. For a specific state, readstarredfrom the list first.
Errors
| HTTP | Code | When |
|---|---|---|
| 404 | CONVERSATION_NOT_FOUND | No such conversation on your account. |