---
docId: doc_625fd6f341864bc687ac2ea689328a1b
title: Search contacts
description: Search contacts by name, phone number or email, with filters, and use the full result in a campaign or to tag them.
api:
  group: clientes
  auth: bearer
  operations:
    - operationId: searchClients
      method: POST
      path: /v1/clients/search
      postmanName: Search Clients
---

<script>
  import { Ways } from '$lib/components';
</script>

# Search contacts

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](/api-reference/campaigns/audience/add), [remove them from one](/api-reference/campaigns/audience/remove#remove-several-at-once) or [tag them](/api-reference/contacts/tag) without copying the list.

## Example

<Ways tabs="api,sdk,asistente">
<Ways.Way name="api">

```bash
curl -X POST https://api.platic.ai/v1/clients/search \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "tags": ["vip"], "customFieldFilter": { "fieldId": "city", "operator": "eq", "value": "CDMX" } }'
```

</Ways.Way>
<Ways.Way name="sdk">

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

</Ways.Way>
<Ways.Way name="asistente">
<Ways.Say>

Find the VIP customers in Mexico City.

</Ways.Say>

Your assistant uses `search_clients`.

</Ways.Way>
</Ways>

## Request body

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

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | — | Free text: name, phone number or email. Up to 200 characters |
| `phone` | string | — | An exact phone number; its variants are tried |
| `tags` | string[] | — | Contacts with at least one of these tags, up to 10 |
| `whatsappStatus` | string | — | The contact's WhatsApp status, such as `active` or `opted_out` |
| `customFieldFilter` | object | — | `{ fieldId, operator, value }`: `fieldId` from [custom fields](/api-reference/custom-fields/list), `operator` `eq` (default) or `contains`, and `value` (on an options field, the option's label) |
| `page` | number | — | The page, from 1 |
| `perPage` | number | — | Results per page, from 1 to 250. Default, 25 |

## Response

```json
{
  "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
  }
}
```

| Field | Description |
|-------|-------------|
| `totalFound` | How many contacts match |
| `results` | The contacts on this page |
| `searchId` | Stores all the results until `searchExpiresAt` (12 hours). After that, search again |
| `searchCachedHits` | How many results the `searchId` stores |

## Errors

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_REQUEST` | A field is not valid. `details.issues` says which one |
| `400` | `INVALID_REQUEST` | The 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 |
| `401` | `UNAUTHENTICATED` | The credential is missing or invalid |
| `403` | `FORBIDDEN` | The credential does not have the Contacts module (`Missing contacts permission`) |
| `4xx` | `UPSTREAM_REFUSED` | Platica refused the operation. The status is the one it answered and `details.message` carries its text |
| `502` | `UPSTREAM_ERROR` | Platica failed to complete the operation. Try again |

The general error format is in [Errors](/api-reference/errors).
