# Assign an agent

Make a specific agent responsible for a conversation.

API 4.0

Use this endpoint to set the conversation's owner, the `assignee`, to a specific agent. Use it for handoffs, for example when your CRM decides which salesperson handles a customer.

## Before you begin

- Get a [Bearer access token](/developers/get-started/authentication) and your account ID.
- Get the ID of an existing agent in the account.

## Request body

| Field | Type | Description |
| --- | --- | --- |
| `accid` (path) | string | Your account ID. |
| `cid` (path) | string | Conversation to assign. |
| `assignee` | string | ID of the agent who should own the conversation. |

```json
{
  "assignee": "agent_example"
}
```

This route updates conversation information. Send only `assignee` for an assignment.

## Response

A successful request returns HTTP `200` with the updated `Conversation`. Selected fields:

```json
{
  "id": "conversation_example",
  "account_id": "account_example",
  "state": "active",
  "assignee": "agent_example"
}
```

When the owner changes, Subiz emits a `conversation_assigned` event. Subscribed webhooks receive it; see [Conversation assigned](/developers/webhooks/payloads#conversation-assigned).

## Assignment is not participation

Assigning an agent does not add them to `members`. If the agent should also participate, [invite the agent](/developers/api-reference/conversations/invite-agent) as well.

## Clear the assignment

Send an empty `assignee` and add `x-fields=assignee` to the query string:

```http
POST https://api.subiz.com.vn/4.0/accounts/YOUR_ACCID/conversations/YOUR_CID?x-fields=assignee
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "assignee": ""
}
```

`x-fields` lists the fields to update. Without it, an empty value is treated as "not provided" and the owner stays unchanged. Clearing an owner emits `conversation_unassigned`.

## Automatic routing is different

`POST /4.1/conversations/{cid}/assign` asks Subiz to run automatic assignment again. It does not accept an agent ID. Use the endpoint on this page to choose a specific agent.

## HTTP request

Replace `YOUR_ACCID`, `YOUR_CID`, `YOUR_AGENT_ID`, and `YOUR_ACCESS_TOKEN` with your values.

```http
POST https://api.subiz.com.vn/4.0/accounts/YOUR_ACCID/conversations/YOUR_CID
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
  "assignee": "YOUR_AGENT_ID"
}
```