# Invite an agent

Add an existing agent to a conversation as a participant.

API 4.0

Use this endpoint to bring another staff member into a conversation, for example a specialist who needs to help. The agent must already have a Subiz account.

## Invite, assign, or route?

| You want to | Use |
| --- | --- |
| Add an agent as a participant | This endpoint. |
| Make an agent responsible for the conversation | [Assign an agent](/developers/api-reference/conversations/assign-agent). |
| Add a new staff member to your account | The Subiz app. This endpoint does not create agents or send account invitations. |
| Let Subiz pick an agent automatically | Automatic routing. This endpoint always uses the agent you specify. |

Inviting an agent does not change the conversation's `assignee`.

## Request body

The body is a conversation member.

| Field | Type | Description |
| --- | --- | --- |
| `cid` (path) | string | Conversation ID. |
| `type` | string | Set to `agent`. |
| `id` | string | ID of the existing agent to invite. |

```json
{
  "type": "agent",
  "id": "agent_example"
}
```

Subiz sets the account from your [access token](/developers/get-started/authentication) and the conversation from the path.

## Response

A successful request returns HTTP `200` with an empty object:

```json
{}
```

Subiz records a `conversation_invited` event in the conversation. To confirm the result, [get the conversation](/developers/api-reference/conversations/retrieve) and check that the agent appears in `members`:

```json
{
  "id": "agent_example",
  "type": "agent",
  "conversation_id": "conversation_example",
  "membership": "active"
}
```

## HTTP request

Replace `YOUR_CID` with the conversation ID, `YOUR_AGENT_ID` with the agent ID, and `YOUR_ACCESS_TOKEN` with your token.

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

{
  "type": "agent",
  "id": "YOUR_AGENT_ID"
}
```