Skip to main content

Search Directory Contacts

POST 

/directories/:directoryId/contacts/search

Retrieve contacts that satisfy conditions you have specified. You can get the next page of contacts for the filter object by adding the skipToken value returned in the last request to your query params.

If the pageSize is set to 10 and all of the 10 contacts in the previous response were the only contacts that satisfied the specified filter, then the subsequent response when the API call is made with skipToken in previous response will return zero contacts.

If at any time the number of contacts in the response is less than the pageSize, then no skipToken will be included in the response.

Search Depth Limitation

Paginating beyond the first 10,000 contacts will result in a 400 error response.

To return a complete contact list (filtered by your criteria), use the endpoints for Create Contact Export and Get Contact Export File.

This API call is not available for XMD Lite Directories.

Below is a pagination sequence example.

curl Request: Contacts 1-5

curl 'https://yourdatacenterid.qualtrics.com/API/v3/directories/POOL_DBCF6F11V71CiZx/contacts/search?pageSize=5' \\
-X 'POST' \\
-H 'X-API-TOKEN: yourtokenhere' \\
-H 'Content-Type: application/json' \\
-d '
{
"filter": {
"comparison": "eq",
"filterType": "lastName",
"value": "test"
}
}
'
curl Request: Contacts 6-10

curl 'https://yourdatacenterid.qualtrics.com/API/v3/directories/POOL_DBCF6F11V71CiZx/contacts/search?pageSize=5&skipToken=NQ==' \\
-X 'POST' \\
-H 'X-API-TOKEN: yourtokenhere' \\
-H 'Content-Type: application/json' \\
-d '
{
"filter": {
"comparison": "eq",
"filterType": "lastName",
"value": "test"
}
}
'
curl Request: Contacts 11-15

curl 'https://yourdatacenterid.qualtrics.com/API/v3/directories/POOL_DBCF6F11V71CiZx/contacts/search?pageSize=5&skipToken=MTA=' \\
-X 'POST' \\
-H 'X-API-TOKEN: yourtokenhere' \\
-H 'Content-Type: application/json' \\
-d '
{
"filter": {
"comparison": "eq",
"filterType": "lastName",
"value": "test"
}
}
'
json Response: Contacts 1-5

{
"result": {
"elements": [
{
"id": "CID_XXXXXXXXXXXX001",
...
},
{
"id": "CID_XXXXXXXXXXXX002",
...
},
{
"id": "CID_XXXXXXXXXXXX003",
...
},
{
"id": "CID_XXXXXXXXXXXX004",
...
},
{
"id": "CID_XXXXXXXXXXXX005",
...
},
],
"skipToken": "NQ=="
},
"meta": {
"httpStatus": "200 - OK",
"requestId": "ae8f9d62-217b-4f98-89f8-94fb2b43dcc7"
}
}
json Response: Contacts 6-10

{
"result": {
"elements": [
{
"id": "CID_XXXXXXXXXXXX006",
...
},
{
"id": "CID_XXXXXXXXXXXX007",
...
},
{
"id": "CID_XXXXXXXXXXXX008",
...
},
{
"id": "CID_XXXXXXXXXXXX009",
...
},
{
"id": "CID_XXXXXXXXXXXX010",
...
},
],
"skipToken": "MTA="
},
"meta": {
"httpStatus": "200 - OK",
"requestId": "0dd60d0d-4d43-4937-b278-b0b085c6cbca"
}
}
json Response: Contacts 11-15

{
"result": {
"elements": [
{
"id": "CID_XXXXXXXXXXXX011",
...
},
{
"id": "CID_XXXXXXXXXXXX012",
...
},
{
"id": "CID_XXXXXXXXXXXX013",
...
},
{
"id": "CID_XXXXXXXXXXXX014",
...
},
{
"id": "CID_XXXXXXXXXXXX015",
...
},
],
},
"meta": {
"httpStatus": "200 - OK",
"requestId": "1bd55949-0aa4-4533-9c8e-fc897b90c237"
}
}

Filter Criterion​

Below are the supported filter criteria and their associated JSON syntax.

CriterionJSON SyntaxFilter
email{"filterType": "email","comparison": stringComparison,"value": plainString}filter: {"filterType": "email","comparison": "eq","value": "pritty"}
first name{"filterType": "firstName","comparison": stringComparison,"value": plainString}filter: {"filterType": "firstName","comparison": "eq","value": "Iain"}
last name{"filterType": "lastName","comparison": stringComparison,"value": plainString}filter: {"filterType": "lastName","comparison": "neq","value": "reezy"}
language{"filterType": "language","comparison": stringComparison,"value": plainString}filter: {"filterType": "language","comparison": "neq","value": "en"}
phone{"filterType": "phone","comparison": stringComparison,"value": plainString}filter: {"filterType": "phone","comparison": "neq","value": "9193367852"}
external data reference{"filterType": "extRef","comparison": stringComparison,"value": plainString}filter: {"filterType": "extRef","comparison": "eq","value": "beryl"}
created{"filterType": "created","comparison": numericComparison,"value": dateOrUTCDateTime}filter: {"filterType": "created","comparison": "eq","value": "2017-03-01 23:18:12"}
filter: {"filterType": "created","comparison": "neq","value": "2017-03-08"}
last modified date{"filterType": "lastModified","comparison": numericComparison,"value": dateOrUTCDateTime}filter: {"filterType": "lastModified","comparison": "gt","value": "2013-10-31 23:48:59"}
in list{"filterType": "inList","comparison": booleanComparison,"mailingListId": mailingListId}filter: {"filterType": "inList","comparison": true,"mailingListId": "CG_abcd1234"}
info field state{"filterType": "infoFieldState","field": oneOf("email", "extRef", "firstName", "lastName"), "comparison": oneOf("empty", "notEmpty")}filter: {"filterType": "infoFieldState","field": "lastName", "comparison": "notEmpty"}
Leading and trailing spaces

String values associated with JSON keys that are not filterType or comparison will have any leading and trailing spaces trimmed off.

The JSON keys filterType and comparison have strict values enumerated herein. Any deviation from those values will result in an error being returned in the API response.

Filter Conjunction​

The filter conjunction allows one to combine multiple criteria to retrieve contacts from the directory with precision.

Field 'conjunction': 'and' need to be added as an attribute inside filter to show that multiple filters need to be combined. The number of filters should be ranged from 2 to 5. If more than 5 filters are combined, an error will be thrown.

JSON SyntaxFilter
{"conjunction": "and","filters": [filters]}"filter": {"conjunction": "and","filters": [{"comparison": "eq","filterType": "lastName","value": "test"},{"comparison": "gte","filterType": "created","value":"2018-08-29"}]}

numericComparison​

JSON data type: string

Valid values are:

  • eq
  • neq
  • gt
  • lt
  • gte
  • lte

Value represents a date must match the format yyyy-MM-dd or yyyy-MM-dd hh:mm:ss

stringComparison​

JSON data type: string Valid values are:

  • eq
  • neq

String comparison is not case sensitive for the values it is inspecting. sEArcH is equivalent to search, SEARCH, SeaRCh and so on...

Request​

Responses​

A collection of contacts