Search contacts

SDK platic.clients.search()

Search contacts by name, phone number or email. Filter by tags, WhatsApp status and one custom field.

The response includes a page and a searchId that keeps all results for 12 hours. Use it to add them to a campaign, remove them from one or tag them without copying the list.

Example

const { totalFound, searchId } = await platic.clients.search({
  tags: ["vip"],
  customFieldFilter: { fieldId: "city", operator: "eq", value: "CDMX" },
});

Request body

It searches a single workspace: the credential's, or the one in ?workspace= if it has several. All fields are optional.

FieldTypeRequiredDescription
querystring—Free text: name, phone number or email. Up to 200 characters
phonestring—An exact phone number; its variants are tried
tagsstring[]—Contacts with at least one of these tags, up to 10
whatsappStatusstring—The contact's WhatsApp status, such as active or opted_out
customFieldFilterobject—{ fieldId, operator, value }: fieldId from custom fields, operator eq (default) or contains, and value (on an options field, the option's label)
pagenumber—The page, from 1
perPagenumber—Results per page, from 1 to 250. Default, 25

Response

{
  "status": "success",
  "data": {
    "message": "312 contacts found. Page 1 of 13 (25 results).",
    "totalFound": 312,
    "results": [
      {
        "id": "c_8fK2pQx7",
        "name": "Ana",
        "phoneNumber": "5215512345678",
        "email": "ana@acme.com",
        "tags": ["vip"],
        "whatsappStatus": "active",
        "customFields": { "city": "CDMX" }
      }
    ],
    "pagination": { "currentPage": 1, "totalPages": 13, "perPage": 25, "totalResults": 312, "hasNextPage": true, "hasPreviousPage": false },
    "searchId": "srch_4f9a2c",
    "searchExpiresAt": "2026-11-24T06:00:00.000Z",
    "searchCachedHits": 312
  }
}
FieldDescription
totalFoundHow many contacts match
resultsThe contacts on this page
searchIdStores all the results until searchExpiresAt (12 hours). After that, search again
searchCachedHitsHow many results the searchId stores

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTA field is not valid. details.issues says which one
400INVALID_REQUESTThe credential covers several workspaces and ?workspace= is missing, or the supplied workspace is not authorized. details.available lists the available ones and details.requested shows the one you sent
401UNAUTHENTICATEDThe credential is missing or invalid
403FORBIDDENThe credential does not have the Contacts module (Missing contacts permission)
4xxUPSTREAM_REFUSEDPlatica refused the operation. The status is the one it answered and details.message carries its text
502UPSTREAM_ERRORPlatica failed to complete the operation. Try again

The general error format is in Errors.