<!-- Generated from the canonical 99 Digital API documentation. Do not edit this file. -->

Canonical page: https://docs.99digital.co.il/online-api/contacts/set-contact-labels

# Set Contact Labels

`POST https://online.99digital.co.il/api/v1/accounts/{account_id}/contacts/{contact_id}/labels`

Replaces the contact's labels with the given list.

Send `[]` to remove all labels. Label titles are not checked against the account's [labels](https://docs.99digital.co.il/online-api/labels/list-labels), so any string is accepted. Use existing label titles so the labels show up with their colours in the dashboard.

| Setting | Value |
| --- | --- |
| **Method** | `POST` |
| **Path** | `/api/v1/accounts/{account_id}/contacts/{contact_id}/labels` |
| **Authorization** | User token. Any agent. Agent-bot tokens: not allowed. |

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | integer | Yes | Account ID. |
| `contact_id` | integer | Yes | Contact ID. |

**Body parameters (JSON)**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `labels` | string[] | Yes | The full list of label titles. |

**Example request**

```bash
curl -X POST 'https://online.99digital.co.il/api/v1/accounts/12/contacts/801/labels' \
  -H 'api_access_token: <YOUR_API_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{ "labels": ["vip", "billing"] }'
```

**Example response** (`200 OK`)

```json
{ "payload": ["vip", "billing"] }
```

## Authentication

`api_access_token` in the header — Your access token. A user token is in the dashboard under **Profile settings → Access Token**, and grants exactly what that agent's role allows. An agent-bot token may call only the endpoints marked for agent bots. See [Getting Started](https://docs.99digital.co.il/online-api/getting-started#authentication).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `account_id` | path | integer | Yes | The numeric ID of your account: the number after `/app/accounts/` in the dashboard URL. Example: `12`. |
| `contact_id` | path | integer | Yes | The numeric ID of the contact. Example: `801`. |

## Request body

Content type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `labels` | array of string | Yes | The full list of label titles. `[]` removes all labels. |

### Example: Set labels

The contact gets exactly these two labels.

```json
{
  "labels": [
    "vip",
    "billing"
  ]
}
```

### Example: Remove all labels

An empty list removes every label from the contact.

```json
{
  "labels": []
}
```

## Responses

### 200 — The contact's labels after the change.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `payload` | array of string | The titles of the contact's labels. |

#### Example

```json
{
  "payload": [
    "vip",
    "billing"
  ]
}
```

### 401 — The access token is missing or wrong, or its user does not belong to this account.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `error` | string | The error message. |

#### Example: Invalid token

The api_access_token header is missing or wrong.

```json
{
  "error": "Invalid Access Token"
}
```

#### Example: Another account

A valid token, for a user who is not in this account.

```json
{
  "error": "You are not authorized to access this account"
}
```

### 403 — The token's role does not have the permission this endpoint needs, or the endpoint is not open to agent-bot tokens. See [Authorization](https://docs.99digital.co.il/online-api/getting-started#authorization).

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `error` | string | The error message. |

#### Example: No permission

The role lacks the permission.

```json
{
  "error": "You are not authorized to do this action"
}
```

#### Example: Agent bot

An agent-bot token on an endpoint that is not open to bots.

```json
{
  "error": "Access to this endpoint is not authorized for bots"
}
```

### 404 — The resource does not exist in this account.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `error` | string | The error message. |

#### Example

```json
{
  "error": "Resource could not be found"
}
```
