Search Contacts
Find contacts by email address, custom field values, or other criteria using the search API.Goal
By the end of this guide you will be able to search for contacts by email (useful for dedup checks), filter by custom field values, and paginate through large result sets.Prerequisites
- An API key with
contacts:readscope - Your API base URL (found on the Settings > API Keys page)
- A contact structure ID — search operates within a single contact structure. Retrieve yours with
GET /api/contact-structure(see Manage Custom Fields)
POST but is semantically a read operation. It requires only contacts:read scope (not contacts:write).
Steps
1. Search by email address
This is the most common search pattern, useful for deduplication before creating a contact.200 OK):
"operator": "EQ". If totalRecords is 0, the email is not in use and you can safely create the contact.
2. Search by email domain
Find all contacts from a specific email domain.3. Search by custom field values
Filter contacts based on custom field values. Use the field’s_id from your contact structure.
200 OK):
4. Combine multiple criteria
Use multiple criteria objects to build complex filters. Criteria within the same group are AND-ed; separate groups are OR-ed.5. Search within a specific list
Filter contacts that belong to a specific list.6. Paginate through results
For large result sets, increment thepage parameter to retrieve subsequent pages. Pages are 1-indexed.
200 OK):
totalRecords to calculate the total number of pages: Math.ceil(totalRecords / pageSize). Then loop through pages 1 to N.
Request body reference
| Field | Required | Description |
|---|---|---|
contactStructureId | Yes | The contact structure to search within |
page | Yes | Page number (1-indexed) |
pageSize | Yes | Results per page |
source | Yes | Fields to include in results: _id, key, fields, tags, lists, contactStatus, contactSubStatus, createdAt, updatedAt |
contactSpecification | Yes | Object with a filters array of filter groups (see operators below) |
sortField | No | Array of sort criteria |
showFieldIds | No | Limit which field IDs appear in fields array |
Available filter operators
| Operator | Description | Example use |
|---|---|---|
EQ | Equals | Exact email match |
NEQ | Not equals | Exclude a specific value |
SW | Starts with | Email prefix search |
CONTAINS | Contains substring | Partial name match |
GT | Greater than | Created after a date |
LT | Less than | Created before a date |
BETWEEN | Between two values | Date range |
NOT_BETWEEN | Not between two values | Exclude a date range |
IS_EMPTY | Field is empty | Find contacts with missing data |
NOT_EMPTY | Field is not empty | Find contacts with data present |
IN | In a set of values | Match any of several list IDs |
NIN | Not in a set | Exclude specific values |
Available filter columns
| Column | Description |
|---|---|
KEY | Email address |
EMAIL_DOMAIN | Email domain (e.g., example.com) |
FIELD_ID | Custom field value (requires id parameter with the field’s _id) |
TAG_ID | Tag assignment |
LIST_ID | List membership |
CONTACT_STATUS | Primary status (active, inactive, etc.) |
CONTACT_SUB_STATUS | Secondary status |
CREATED_AT | Creation timestamp |
UPDATED_AT | Last update timestamp |
Common Errors
| Status | Error | Cause | Fix |
|---|---|---|---|
401 | UnauthorizedError | Invalid or inactive API key | Verify your key in Settings > API Keys |
403 | ForbiddenError | Key lacks contacts:read scope | Search requires contacts:read scope |
400 | ValidationError | Missing required fields or invalid filter operator | Ensure contactStructureId, page, pageSize, source, and contactSpecification are all present |
429 | TooManyRequestsError | Rate limit exceeded | Wait for the Retry-After period. See Rate Limits |
Next Steps
- Manage Contacts — create, update, or delete the contacts you find
- Manage Lists — organize contacts into lists
- Manage Custom Fields — understand your contact structure’s field IDs
- Migration from Legacy — use search for dedup during bulk import