readyDocs Open the appOpen the app

Saved views and filter helpers

A saved view stores a filter you use often. The filter helpers read the values your contacts have, like their sources and custom field keys, so you can offer them as filter choices.

#Saved views

A saved view is a named filter for the Contacts page, the Inbox or the Texts log (Reports, Logs). Views are personal: they belong to the user the API key or session is for, not to the whole account. You can save up to 50 views per page. No team permission is needed.

#The saved view object

idinteger
The view id, counting up from 1 for each user.
contextstring
Where it’s used: contacts, conversations or messages (the text log).
namestring
Up to 60 characters.
filtersobject
The filter, as the page’s query values, like {"tag": "vip"}.

#List saved views

Your saved views, oldest first.

Parameters

contextstring · query
Only views for contacts, conversations or messages. Any other value returns all of them.

Returns a list of saved view objects in data.

Errors
HTTPCodeWhen
503saved_views_unavailableWe couldn’t read your views. Retry.

#Create a saved view

Saves a filter under a name. Returns 200. Each call adds a new view, even with the same name.

Parameters

contextstringRequired
contacts, conversations or messages.
namestringRequired
Trimmed. Up to 60 characters.
filtersobjectRequired
Up to 4000 characters as JSON.

Returns the new saved view object in data.

Errors
HTTPCodeWhen
400saved_view_invalidA bad context, no name, a name over 60 characters, filters isn’t an object or is too long, or you already have 50 views for this page.
400invalid_fieldcontext is a list or an object.
409saved_views_conflictYour views changed in another request at the same time. Retry.
500saved_views_write_failedThe view wasn’t saved. Retry.
503saved_views_unavailableWe couldn’t read your views, so nothing changed. Retry.

#Rename a saved view

Changes a view’s name. The filter stays the same.

Parameters

idinteger · pathRequired
namestringRequired
Trimmed. Up to 60 characters.

Returns the saved view object in data.

Errors
HTTPCodeWhen
400saved_view_invalidNo name, or over 60 characters.
400invalid_fieldname is a list or an object.
404saved_view_not_foundYou have no view with this id.
409saved_views_conflictYour views changed in another request at the same time. Retry.
500saved_views_write_failedNothing was saved. Retry.
503saved_views_unavailableWe couldn’t read your views, so nothing changed. Retry.

#Delete a saved view

Deletes one of your views. Sending it again returns 404.

Returns { "success": true }.

Errors
HTTPCodeWhen
400invalid_fieldThe id isn’t a whole number.
400unknown_fieldYou sent a body. This route takes none.
404saved_view_not_foundYou have no view with this id.
409saved_views_conflictYour views changed in another request at the same time. Retry.
500saved_views_write_failedNothing was deleted. Retry.
503saved_views_unavailableWe couldn’t read your views, so nothing changed. Retry.

#Filter helpers

These read the values your contacts actually have, so you can offer them as filter choices. All need the view_contacts permission.

#List contact sources

The different source values on your contacts, A to Z, up to 200. Cached for 2 minutes.

Returns {"sources": [...]} in data.

Errors
HTTPCodeWhen
503FACET_READ_UNAVAILABLEWe couldn’t read them. Retry.

#List custom field names

Your custom field names, A to Z, up to 200: every custom field, plus keys in custom_fields on your 2,000 newest contacts. Use it to match import columns to fields you already have.

Returns a list of names in data.

Errors
HTTPCodeWhen
503FACET_READ_UNAVAILABLEWe couldn’t read them. Retry.

#Suggest filter values

The 50 most common values of one field, counted over a sample of up to 5,000 contacts, most common first. Counts are for the sample, not your whole list. Cached for 5 minutes.

Parameters

fieldstring · queryRequired
tags, city, state, source, company_name, first_name or last_name. Any other field returns an empty list.

Returns a list of {value, count} in data.

Errors
HTTPCodeWhen
400invalid_fieldfield is sent more than once.
503FACET_READ_UNAVAILABLEWe couldn’t read them. Retry.

#Look up contacts as you type

Up to 8 contacts for an autocomplete box. Three or more digits match the start of the phone number’s last 10 digits (a leading US 1 is dropped). Anything else matches the start of the first name, with the first letter capitalized. For a full search, use List contacts.

Parameters

qstring · queryRequired
At least 2 characters. Shorter returns an empty list.

Returns a list in data of {id, first_name, last_name, phone, company_name}.

Errors
HTTPCodeWhen
400invalid_fieldq is sent more than once.
503CONTACT_SEARCH_FAILEDThe search failed. Retry.