---
docId: doc_f99fd19a296f496bac626236496a2563
title: Add contacts to the audience
description: "Add contacts to a campaign by phone, search, tag, or ID."
api:
  group: campañas/audiencia
  auth: bearer
  operations:
    - operationId: addCampaignAudience
      method: POST
      path: '/v1/campaigns/{campaignId}/audience'
      postmanName: Add contacts to the audience of a campaign
---

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

# Add contacts to the audience

Add contacts to a campaign audience using **one source**:

- `clients`: phone number and name. Contacts that do not exist in the workspace are created.
- `searchId`: all results of a [contact search](/api-reference/contacts/search).
- `tag`: all contacts with that tag.
- `clientIds`: a list of ids.

## Example

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

```bash
curl https://api.platic.ai/v1/campaigns/$CAMPAIGN_ID/audience \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "clients": [{ "phoneNumber": "5215512345678", "name": "Ana López" }]
  }'
```

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

```ts
await platic.campaigns.audience.add("campaign_123", [{ phoneNumber: "5215512345678", name: "Ana López" }]);
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Requirement |
| --- | --- | --- | --- |
| `campaignId` | string | Unique identifier of the campaign | required |

## Request body

```json
{
  "clients": [
    { "phoneNumber": "521234567890", "name": "John Smith" },
    { "phoneNumber": "521234567891", "name": "Maria Garcia" }
  ]
}
```

### From a search, a tag, or ids

```json
{ "searchId": "srch_4f9a2c", "dryRun": true }
```

With `dryRun: true`, it counts how many contacts would be added without changing the audience.

## Body parameters

Send exactly one source: `clients`, `searchId`, `tag`, or `clientIds`.

| Parameter | Type | Description | Requirement |
| --- | --- | --- | --- |
| `clients` | array | List of contacts to add by phone. At least 1 item | one source |
| `searchId` | string | The `searchId` from [search contacts](/api-reference/contacts/search): adds all its results, not just the page you saw. It lasts 12 hours | one source |
| `topN` | number | With `searchId`, only the first N results | optional |
| `tag` | string | Adds all the contacts with that tag | one source |
| `clientIds` | string[] | Contact ids from the workspace, up to 5,000 | one source |
| `dryRun` | boolean | `true` to only count how many would come in. It does not apply to `clients` | optional |

### `clients[]` object

| Parameter | Type | Description | Requirement |
| --- | --- | --- | --- |
| `phoneNumber` | string | Phone number in international format | required |
| `name` | string | Name of the contact | required |

## Response

```json
{
  "status": "success",
  "message": "2 client(s) added to campaign (1 created, 1 updated)",
  "data": {
    "addedCount": 2,
    "createdCount": 1,
    "updatedCount": 1,
    "clients": [
      { "phoneNumber": "521234567890", "name": "John Smith" },
      { "phoneNumber": "521234567891", "name": "Maria Garcia" }
    ]
  }
}
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `addedCount` | number | Total contacts processed |
| `createdCount` | number | New contacts created in the workspace |
| `updatedCount` | number | Existing contacts updated with the campaign's tag |
| `clients` | array | List of contacts sent in the request |

### Response with a source

```json
{
  "status": "success",
  "message": "312 contacts were added to the audience",
  "data": {
    "source": "search",
    "dryRun": false,
    "message": "312 contacts were added to the audience",
    "added": 312,
    "skipped": 4
  }
}
```

`source` identifies the source: `search`, `tag`, or `client_ids`. Platica can include the `added`, `created`, `updated`, and `skipped` counts when it reports them.

With `dryRun`, `preview` shows how many contacts would be added and `errors` includes up to 10 problems.

A missing `searchId` returns `404 SEARCH_NOT_FOUND`. An expired one returns `410 SEARCH_EXPIRED`. Run a new search in either case.

## Notes

- If the contact already exists (same `phoneNumber`), its name is updated and the campaign's tag is added.
- If the contact does not exist, a minimal record is created with `phoneNumber`, `name`, `tags`, `owners`, `customFields`, `creationDate`, and `lastUpdate`.
- The tag assigned to the contacts has the format `campaign-{campaignId}`.
