---
title: "add user to chat (v2)"
method: POST
path: "/v2/chats/users-access"
tags: ["Chats"]
---

# add user to chat (v2)

`POST /v2/chats/users-access`

## Request

- Base URL: `https://api.chat.ethora.com`
- URL: `https://api.chat.ethora.com/v2/chats/users-access`
- Auth: HTTP bearer

**Auth**: User JWT

add user to chat (v2)

## Request body

- object
  - `chatName` string: Internal chat name in the form `<appId>_<chatId>`. Returned by every chat-listing endpoint as `chats[].name`.
  - `members` string[]: Array of `xmppUsername` strings (`<appId>_<userId>`) to add or remove from the room. Already-member adds and not-yet-member removes are no-ops.

## Response `200`

```
{
  results: [UserPublic],        // newly-added users only
  details: [{ xmppUsername, status, code? }], // per-member outcome (idempotent)
}
```

- ChatUsersAccessAddResponse
  - `ok` boolean, required
  - `summary` BatchSummary, required
    - `requested` integer, required: How many items the client requested to process.
    - `byStatus` object, required
  - `results` UserPublic[], required
    - `_id` string
    - `uuid` string, nullable
    - `xmppUsername` string
    - `email` string, nullable
    - `firstName` string, nullable
    - `lastName` string, nullable
    - `username` string, nullable
    - `profileImage` string, nullable
    - `profilePicture` string, nullable
    - `description` string, nullable
    - `tags` string[], nullable
  - `details` ChatUsersAccessDetail[], required
    - `xmppUsername` string
    - `status` string: Per-member status.
    - `code` string, nullable: Optional machine-readable code for non-success statuses.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: ``` { error: 'Forbidden' } ```
- `404`: Not Found
- `422`: ``` { error: string } ```
- `500`: Internal Server Error

---

[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)
