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

Canonical page: https://docs.99digital.co.il/online-api/conversations/set-conversation-custom-attributes

# Set Conversation Custom Attributes

`POST https://online.99digital.co.il/api/v1/accounts/{account_id}/conversations/{conversation_id}/custom_attributes`

Replaces the conversation's custom attributes with the given object.

:::warning

This call **overwrites** the conversation's `custom_attributes`: keys you
leave out are removed, so send the full object.

:::

| Setting | Value |
| --- | --- |
| **Method** | `POST` |
| **Path** | `/api/v1/accounts/{account_id}/conversations/{conversation_id}/custom_attributes` |
| **Authorization** | User token or **agent-bot token**. |

**Permissions:**

- User token: any agent who may see the conversation — see
  [Who can see a conversation](https://docs.99digital.co.il/online-api/conversations/conversation-basics#who-can-see-a-conversation).

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `account_id` | integer | Yes | Account ID. |
| `conversation_id` | integer | Yes | Conversation display ID. |

**Body parameters (JSON)**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `custom_attributes` | object | Yes | Key/value pairs. Use the keys of conversation custom attributes defined in Settings → Custom attributes so they show in the dashboard. |

**Example request**

```bash
curl -X POST 'https://online.99digital.co.il/api/v1/accounts/12/conversations/1501/custom_attributes' \
  -H 'api_access_token: <YOUR_API_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{ "custom_attributes": { "order_id": "A-1001", "items_count": 2 } }'
```

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

```json
{
  "custom_attributes": {
    "order_id": "A-1001",
    "items_count": 2
  }
}
```

## Remarks

- A change fires the `conversation_updated`
  [webhook event](https://docs.99digital.co.il/online-api/webhooks/webhook-events).

## 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`. |
| `conversation_id` | path | integer | Yes | The numeric ID of the conversation: its display ID, which is the `id` in conversation responses and the number in the dashboard URL. Example: `1501`. |

## Request body

Content type: `application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `custom_attributes` | object | Yes | The conversation's complete custom attributes, as key-value pairs. This object replaces the current one, so keys you leave out are removed. Use the keys of the conversation custom attributes defined in Settings → Custom attributes so the values show in the dashboard. |

### Example (generated from the schema)

```json
{
  "custom_attributes": {
    "order_id": "A-1001",
    "items_count": 2
  }
}
```

## Responses

### 200 — The conversation's custom attributes after the change.

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `custom_attributes` | object | The conversation's custom attributes. |

#### Example

```json
{
  "custom_attributes": {
    "order_id": "A-1001",
    "items_count": 2
  }
}
```

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