Search Directory Contacts

POST {{baseUrl}}/directories/:directoryId/contacts/search?skipToken=<string>&pageSize=100&includeEmbedded=true&includeSegments=false

Retrieve contacts that satisfy conditions you have specified. <!--From Readme--> 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.

Below is a pagination sequence example.

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 '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 '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"
       }
     }
   '
{
  "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"
  }
}
{
  "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"
  }
}
{
  "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 Params

KeyDatatypeRequiredDescription
skipTokenstringThe start position for pagination
pageSizenumberThe maximum number of items to return per request
includeEmbeddedbooleanWhether to include a contacts' embedded data in the response
includeSegmentsbooleanWhether to include a contacts' segment memberships data in the response

Request Body

{"filter"=>{"culpabd"=>53553139}}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
Acceptstring

RESPONSES

status: OK

{&quot;result&quot;:{&quot;elements&quot;:[{&quot;id&quot;:&quot;CID_012345678901234&quot;,&quot;creationDate&quot;:&quot;ex dolor&quot;,&quot;lastModified&quot;:&quot;cillum velit Ut&quot;,&quot;firstName&quot;:&quot;Jane&quot;,&quot;lastName&quot;:&quot;Doe&quot;,&quot;email&quot;:&quot;JaneDoe@email.com&quot;,&quot;phoneNumber&quot;:&quot;111-111-1111&quot;,&quot;externalDataReference&quot;:&quot;my_Internal_ID_12345&quot;,&quot;language&quot;:&quot;&quot;,&quot;unsubscribed&quot;:false,&quot;unsubscribeDate&quot;:&quot;do voluptate proident&quot;,&quot;stats&quot;:{&quot;dolor3&quot;:&quot;esse irure amet&quot;,&quot;eiusmod_c2&quot;:&quot;in magna veniam ad velit&quot;,&quot;sint__c&quot;:&quot;sit deserunt laborum esse&quot;,&quot;inf50&quot;:&quot;labore minim qui consectetur&quot;,&quot;velit0&quot;:&quot;do occaecat veniam incididunt&quot;},&quot;embeddedData&quot;:{&quot;est7f&quot;:&quot;anim enim adipisicing&quot;,&quot;anim_61&quot;:&quot;eu mollit es&quot;,&quot;aute_90&quot;:&quot;Ut sed proident&quot;,&quot;tempor_b&quot;:&quot;minim&quot;},&quot;segmentMembership&quot;:{&quot;exercitation87&quot;:{&quot;contactLookupId&quot;:&quot;quis nulla id&quot;,&quot;ownerId&quot;:&quot;adipisicing in veli&quot;,&quot;unsubscribed&quot;:true,&quot;unsubscribedDate&quot;:&quot;1981-08-30T14:13:33.958Z&quot;,&quot;name&quot;:&quot;occaecat consequat dolore deserunt&quot;},&quot;laborisd0d&quot;:{&quot;contactLookupId&quot;:&quot;fugiat incididunt&quot;,&quot;ownerId&quot;:&quot;quis mollit aute ipsum&quot;,&quot;unsubscribed&quot;:false,&quot;unsubscribedDate&quot;:&quot;1983-05-28T02:14:32.235Z&quot;,&quot;name&quot;:&quot;ullamco veniam ut nostrud deserunt&quot;}}},{&quot;id&quot;:&quot;CID_012345678901234&quot;,&quot;creationDate&quot;:&quot;mollit&quot;,&quot;lastModified&quot;:&quot;non aliquip voluptate&quot;,&quot;firstName&quot;:&quot;Jane&quot;,&quot;lastName&quot;:&quot;Doe&quot;,&quot;email&quot;:&quot;JaneDoe@email.com&quot;,&quot;phoneNumber&quot;:&quot;111-111-1111&quot;,&quot;externalDataReference&quot;:&quot;my_Internal_ID_12345&quot;,&quot;language&quot;:&quot;&quot;,&quot;unsubscribed&quot;:true,&quot;unsubscribeDate&quot;:&quot;Ut ut deserunt sunt pariatur&quot;,&quot;stats&quot;:{&quot;nostrud_daf&quot;:&quot;cupidatat Duis eius&quot;},&quot;embeddedData&quot;:{&quot;nostrud41&quot;:&quot;culpa&quot;,&quot;in_9a0&quot;:&quot;do cillum esse adipisicing ullamco&quot;,&quot;anim8f&quot;:&quot;ex occaecat laboris laborum&quot;},&quot;segmentMembership&quot;:{&quot;reprehenderit_e&quot;:{&quot;contactLookupId&quot;:&quot;anim velit Lorem esse do&quot;,&quot;ownerId&quot;:&quot;adipisicing irure id&quot;,&quot;unsubscribed&quot;:true,&quot;unsubscribedDate&quot;:&quot;1986-10-28T13:38:10.503Z&quot;,&quot;name&quot;:&quot;minim aliqua Excepteur Ut ex&quot;},&quot;do3d1&quot;:{&quot;contactLookupId&quot;:&quot;aute ut&quot;,&quot;ownerId&quot;:&quot;laboris&quot;,&quot;unsubscribed&quot;:false,&quot;unsubscribedDate&quot;:&quot;1983-09-11T20:27:28.549Z&quot;,&quot;name&quot;:&quot;ad aliquip&quot;},&quot;velit1&quot;:{&quot;contactLookupId&quot;:&quot;consequat do&quot;,&quot;ownerId&quot;:&quot;anim pariatur eu nisi&quot;,&quot;unsubscribed&quot;:true,&quot;unsubscribedDate&quot;:&quot;1952-07-22T19:44:24.241Z&quot;,&quot;name&quot;:&quot;magna labore in&quot;},&quot;adipisicing_383&quot;:{&quot;contactLookupId&quot;:&quot;amet&quot;,&quot;ownerId&quot;:&quot;irure&quot;,&quot;unsubscribed&quot;:true,&quot;unsubscribedDate&quot;:&quot;2007-02-25T11:32:06.467Z&quot;,&quot;name&quot;:&quot;proident occaecat deserunt Ut&quot;}}}],&quot;skipToken&quot;:&quot;\u003cstring\u003e&quot;},&quot;meta&quot;:{&quot;httpStatus&quot;:&quot;voluptate irure dolore&quot;,&quot;requestId&quot;:&quot;amet sed cillum aliqua&quot;,&quot;notice&quot;:&quot;aute enim exercitation&quot;}}