---
title: "Add User to a Room (Realtime)"
slug: "add-user-to-a-room-realtime"
updated: 2026-05-14T21:50:10Z
published: 2026-05-14T21:50:10Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Add User to a Room (Realtime)

![](https://cdn.us.document360.io/27ca1fd4-36d7-4cde-b4eb-97fc1652954c/Images/Documentation/Deprecated.svg)

Add a user to a room.

| Method | Requires Auth |
| --- | --- |
| `addUserToRoom` | Yes |

## Payload parameters

| Argument | Example | Required | Description |
| --- | --- | --- | --- |
| `data` | `{` `"rid": "64f0f82c21c26843a68c1f7ba",` `"username": "rodriq"` `}` | Required | An object of the `roomid `and `userId` |

## Example call

```json
{
    "msg": "method",
    "method": "addUserToRoom",
    "id": "2",
    "params": [
        {
	"rid":"64f0f82c2c26843a68c1f7ba",
        "username":"rodriq"
	}
    ]
}
```

## **Example response**

### **Success**

```json
{
  "msg":"result",
  "id":"2"
}
```

### Error

Any of the following errors can occur on the endpoint.

- **Authorization**: Requires an authentication token for the request to be made.

```json
{
    "status": "error",
    "message": "You must be logged in to do this."
}
```
