Skip to content

Assign a chat

POST /v1/contacts/{id}/assign

Gives the contact’s chat to an agent or a team. Send agent_id or team_id, not both, or {"agent_id": null} to give it to nobody.

Needs chats:write.

id string · uuid

The contact’s ID.

Exactly one of agent_id (an agent’s ID, or null to unassign the chat) and team_id.

agent_id string · uuid · nullable

The agent to give the chat to, from GET /v1/agents. null unassigns the chat.

team_id string · uuid

The team to hand the chat to, from GET /v1/teams. Needs transfers in your plan.

Idempotency-Key string

Makes this request safe to retry. See Retrying safely.

1 to 255 characters.

The agent takes the chat over from the bot. The bot and AI stay quiet until the agent is unassigned, or the chat is closed or reopened. A chat waiting in a queue or with a team goes to the agent.

The chat goes to the team, and the team’s routing picks an agent. This works at any hour, and the customer gets no out-of-hours message.

Send {"agent_id": null}. The chat’s agent is cleared, and the bot answers the customer again, unless a team has the chat.

Assigning a chat to where it already is changes nothing and still returns 200. chat.assigned is sent only if something changed.

200 The chat object. The chat as it is now. contact is null unless your key also has contacts:read.

Besides the ones every request can get:

422invalid_fieldYou sent both agent_id and team_id, or neither, or the agent or team isn’t in your workspace, or the agent can’t take chats.
403feature_not_in_planYou sent a team_id, and transfers aren’t on your plan. error.details.feature is transfers.
404not_foundThere is no contact with this ID in your workspace.
409idempotency_in_progressA request with the same Idempotency-Key is still running.
422idempotency_mismatchThe Idempotency-Key was used before for a different request, or by another of your API keys.