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

Canonical page: https://docs.99digital.co.il/online-api/labels/update-a-label

# Update a Label

`PATCH https://online.99digital.co.il/api/v1/accounts/{account_id}/labels/{label_id}`

Update a label definition.

Updates the fields you send. If you change the `title`, the new title is
applied to all conversations and contacts that had the old one (in the
background).

| Setting | Value |
| --- | --- |
| **Method** | `PATCH` (or `PUT`) |
| **Path** | `/api/v1/accounts/{account_id}/labels/{label_id}` |
| **Authorization** | User token. Legacy: `administrator`. New rules: **Labels → update**. Not available to agent-bot tokens. |

**Body parameters (JSON)**: the same fields as in
[Add Label](https://docs.99digital.co.il/online-api/labels/add-labels), all optional, inside a `label`
object (in a JSON request the wrapper is optional). A new title follows the
same rules: letters, digits, `-` and `_` only, stored in lower case, unique
in the account.

**Example request**

```bash
curl -X PATCH 'https://online.99digital.co.il/api/v1/accounts/12/labels/15' \
  -H 'api_access_token: <YOUR_API_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{ "label": { "description": "Top customers", "color": "#ff6b6b", "show_on_sidebar": false } }'
```

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

```json
{
  "id": 15,
  "title": "vip",
  "description": "Top customers",
  "color": "#ff6b6b",
  "show_on_sidebar": false
}
```

## 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`. |
| `label_id` | path | integer | Yes | The numeric ID of the label. Example: `15`. |

## Request body

Content type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `label` | object | Yes | The fields to change. Every field is optional. |
| `label.title` | string | No | A new name for the label. Only letters (any language), digits, `-` and `_` — no spaces. Converted to lower case; must be unique in the account, regardless of case. The new title replaces the old one on every conversation and contact that has the label, in the background. Example: `vip`. |
| `label.description` | string | No | A description of the label. Example: `Top customers`. |
| `label.color` | string | No | The label's color, as a hex code. Example: `#ff6b6b`. |
| `label.show_on_sidebar` | boolean | No | Whether to show the label as a filter in the dashboard sidebar. |

### Example: Change the color

A new color only.

```json
{
  "label": {
    "color": "#ff6b6b"
  }
}
```

### Example: Several fields

A new description and color, and hide it from the sidebar.

```json
{
  "label": {
    "description": "Top customers",
    "color": "#ff6b6b",
    "show_on_sidebar": false
  }
}
```

## Responses

### 200 — The updated label.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `id` | integer | The numeric ID of the label. |
| `title` | string | The label's name, unique in the account. Stored in lower case, and may contain only letters (any language), digits, `-` and `_` — no spaces. Conversations and contacts reference a label by this title. |
| `description` | string | The description of the label. |
| `color` | string | The label's color, as a hex code, for example `#1f93ff`. |
| `show_on_sidebar` | boolean | Whether the label is shown as a filter in the dashboard sidebar. |

#### Example

```json
{
  "id": 15,
  "title": "vip",
  "description": "Top customers",
  "color": "#ff6b6b",
  "show_on_sidebar": false
}
```

### 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"
}
```

### 422 — The new title has invalid characters, or is already taken.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `message` | string | What failed, in the account's language. |
| `attributes` | array of string | The fields that failed. |

#### Example: Invalid title

The title has spaces or other characters that are not allowed.

```json
{
  "message": "Title is invalid",
  "attributes": [
    "title"
  ]
}
```

#### Example: Title taken

Another label has this title (regardless of case).

```json
{
  "message": "Title has already been taken",
  "attributes": [
    "title"
  ]
}
```
