---
title: "Add an AI Agent to a chat (v2, tenant actor)"
method: POST
path: "/v2/apps/{appId}/agents/{idOrAddress}/invite-to-chat"
tags: ["Agents"]
---

# Add an AI Agent to a chat (v2, tenant actor)

`POST /v2/apps/{appId}/agents/{idOrAddress}/invite-to-chat`

## Request

- Base URL: `https://api.chat.ethora.com`
- URL: `https://api.chat.ethora.com/v2/apps/{appId}/agents/{idOrAddress}/invite-to-chat`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Same operation, body and response as
`POST /v2/agents/{idOrAddress}/invite-to-chat`.
Supports `User JWT` and `B2B Server JWT`.

The target App is the one in the path; an `appId` in the body that
differs from it is a 422.

## Path parameters

- `appId` string, required
- `idOrAddress` string, required

## Request body

- object: One of `chatJid` or `chatId` is required.
  - `appId` string
  - `chatJid` string
  - `chatId` string

## Response `200`

```
{ ok: true, created: boolean, agent: Agent, botInstance: {...}, chatJid: string }
```

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: ``` { error: 'Agent is private', code: 'AGENT_PRIVATE' } ```
- `404`: `AGENT_NOT_FOUND`, `APP_NOT_FOUND`, or `CHAT_NOT_FOUND`.
- `422`: ``` { error: string, code: 'VALIDATION_ERROR' } ```
- `500`: Internal Server Error
- `502`: ``` { error: 'XMPP affiliate/invite failed', code: 'XMPP_UNAVAILABLE' } ```

---

[API](https://skmtc.dev/ethora/apis/platform-api.md) · [All operations](https://skmtc.dev/ethora/apis/platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ethora/apis/platform-api/revisions/01b6e64378ee?raw)
