<< Return to help center
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

SearchContacts Function Definition

The SearchContacts function is used to retrieve a list of contacts and companies that match a search.

When calling this this function, the Function parameter sent to the API should be set to SearchContacts.

If successful, this function will return an array with a list of matching contacts and companies.


SearchTerms - The terms you want to search for (contact name, email, phone, etc.). This will search all fields for all contacts and companies in your CRM. If you want to return a list of all contacts and companies without a search filter, pass an empty string.

Note: If you want to search for contacts in a specific group, you can do that by entering "Group:GROUP_NAME" as a Search term. GROUP_NAME is the name of the group with spaces replaced by underscores.

NumRows (optional) - The maximum number of rows you want returned. Can be between 1 and 500.

Page (optional) - Use this if your results are limited by the number of Rows. For example, if your first search is capped at NumRows, you can then run a second search with Page = 2, and then another with Page = 3 in order to retrieve even more results.

Sort (optional) - The field you'd like to sort the results by. Can be FirstName, LastName, DateEntered, DateEdited, or Relevance (which uses an algorithm to guess which contacts you want to see most based on your search keywords, and the last time you edited the contact).

RecordType (optional) - By default, contacts and companies will be returned by this function. You can pass "Contacts" or "Companies" into this function if you want to filter to only get one record type or the other. Note: this is case sensitive, so "contacts" would not work.

Example Code

This code shows how to search the contacts and companies in your CRM:

CODE: https://gist.github.com/tilikang/a33fc547b789f2e667f4963e8f8c9039.js

Next up:
API, function, SearchContacts