---
title: "Add tags to a contact"
description: "Adds one or more existing workspace tags to a contact. If the contact\ndoes not exist yet it is created. Tags must already exist in the\nworkspace; create them from the dashboard first.\n"
---

> Documentation Index
> Fetch the complete documentation index at: https://zacx.io/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Zacx Public API › Contacts

`POST /tags/add`

Adds one or more existing workspace tags to a contact. If the contact
does not exist yet it is created. Tags must already exist in the
workspace; create them from the dashboard first.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Request body

- `addContactTags.phoneNumber` (string, required) — The contact's phone number with country code. A leading `+` is accepted.
  - example `"+11234567890"`
- `addContactTags.tags` (array<string>, required) — Tag names.
  - example `["test-tag"]`

## Example request

```json
{
  "phoneNumber": "+11234567890",
  "tags": [
    "test-tag"
  ]
}
```

## Code samples

### cURL

```curl
curl --request POST \
  --url https://api.zacx.io/v1/tags/add \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "phoneNumber": "+11234567890",
  "tags": [
    "test-tag"
  ]
}
'
```

### TypeScript

```typescript
const url = 'https://api.zacx.io/v1/tags/add';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({phoneNumber: '+11234567890', tags: ['test-tag']})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.zacx.io/v1/tags/add"

payload = {
    "phoneNumber": "+11234567890",
    "tags": ["test-tag"]
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

The tags were processed.

#### Example

```json
{
  "status": "success",
  "message": "Tag successfully added to the contact"
}
```

- `addContactTags.response.200.status` (string, required)
- `addContactTags.response.200.message` (string, required)
- `addContactTags.response.200.code` (string, optional) — Present when the call succeeded but changed nothing, for example `TAG_ALREADY_ASSOCIATED`.

### 404

The tag does not exist in this workspace.

#### Example

```json
{
  "status": "error",
  "code": "TAG_NOT_FOUND",
  "message": "Tag not found in workspace, please login to workspace and create tags"
}
```

- `addContactTags.response.404.status` (string, required)
- `addContactTags.response.404.code` (string, required) — Stable machine-readable error code.
- `addContactTags.response.404.message` (string, required) — Human-readable explanation.


Source: https://zacx.io/api/contact/add-tags/index.md
