# Participants

To list all the participants in live rooms, you need to execute a **GET** request against the **/rooms/live/participants** endpoint. The result list is grouped by room. The current **session\_duration** of each live room is specified in seconds.

Since potentially there could be thousands of rooms, pagination is supported with **limit**, **order** and **after** arguments. Read about [pagination](/reference/rest-api/pagination.md) to learn the details of it. By default maximum 100 live rooms will be returned in the response.

{% hint style="info" %}
If you want to retrieve the participants of one concrete live room execute a **GET** request against the **/rooms/:id/live/participants** endpoint
{% endhint %}

#### Request (listing all participants in live rooms)

{% tabs %}
{% tab title="cURL" %}

```bash
curl --request GET \
  --url https://api.digitalsamba.com/api/v1/rooms/live/participants \
  --user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY
```

{% endtab %}

{% tab title="Java" %}

```java
import com.fasterxml.jackson.databind.ObjectMapper;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.Base64;
import java.util.Map;

String TEAM_ID = "YOUR_TEAM_ID";
String DEVELOPER_KEY = "YOUR_DEVELOPER_KEY";
String authorizationHeader = "Bearer " + Base64.getEncoder().encodeToString((TEAM_ID + ":" + DEVELOPER_KEY).getBytes());

HttpRequest request = HttpRequest.newBuilder()
  .GET()
  .uri(new URI("https://api.digitalsamba.com/api/v1/rooms/live/participants"))
  .header("Authorization", authorizationHeader)
  .build();

HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());

System.out.println("Status code: " + response.statusCode());
System.out.println("Body: " + response.body());
```

{% endtab %}
{% endtabs %}

#### Response (200 OK)

```json
{
    "total_count": 5134,
    "data": [
        {
            "id": "bdaa431a-681a-424b-bbcd-30dedb48e6ba",
            "external_id": null,
            "start_time": "2023-02-13T16:45:05.000000Z",
            "session_duration": 2366,
            "live_participants": [
                {
                    "id": "eb70c648-e01f-498b-96c8-c3aa2899b2f9",
                    "external_id": null,
                    "name": "John Smith",
                    "role": "moderator",
                    "join_time": "2023-02-13T16:45:05.000000Z"
                },
                .........................
            ]
        },
        {
            "id": "16e4c86d-3030-411a-bfac-4e5a7c427e0a",
            "external_id": null,
            "start_time": "2023-02-13T16:45:41.000000Z",
            "session_duration": 2330,
            "live_participants": [
                {
                    "id": "48a12f4c-2262-4ea3-b294-2d24682cc507",
                    "external_id": null,
                    "name": "Earl Grey",
                    "role": "moderator",
                    "join_time": "2023-02-13T16:45:41.000000Z"
                }
            ]
        }
    ]
}
```

{% hint style="info" %}
The **total\_count** is the total amount of rooms which are live. It is **NOT** the amount of rooms in the current page returned in the **data** array. In the above example you have 5134 rooms live in total, but in the data array there will be maximum 100 rooms (the default limit argument value).
{% endhint %}

#### Request (get participants for a concrete live room)

{% tabs %}
{% tab title="cURL" %}

```bash
curl --request GET \
  --url https://api.digitalsamba.com/api/v1/rooms/bdaa431a-681a-424b-bbcd-30dedb48e6ba/live/participants \
  --user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY
```

{% endtab %}

{% tab title="Java" %}

```java
import com.fasterxml.jackson.databind.ObjectMapper;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.Base64;
import java.util.Map;

String TEAM_ID = "YOUR_TEAM_ID";
String DEVELOPER_KEY = "YOUR_DEVELOPER_KEY";
String authorizationHeader = "Bearer " + Base64.getEncoder().encodeToString((TEAM_ID + ":" + DEVELOPER_KEY).getBytes());
//Put your room id here - this value is just an example
String roomId = "bdaa431a-681a-424b-bbcd-30dedb48e6ba";

HttpRequest request = HttpRequest.newBuilder()
  .GET()
  .uri(new URI("https://api.digitalsamba.com/api/v1/rooms/" + roomId + "/live/participants"))
  .header("Authorization", authorizationHeader)
  .build();

HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());

System.out.println("Status code: " + response.statusCode());
System.out.println("Body: " + response.body());
```

{% endtab %}
{% endtabs %}

#### Response (200 OK)

```json
{
    "id": "bdaa431a-681a-424b-bbcd-30dedb48e6ba",
    "external_id": null,
    "start_time": "2023-02-13T16:45:05.000000Z",
    "session_duration": 2366,
    "live_participants": [
        {
            "id": "eb70c648-e01f-498b-96c8-c3aa2899b2f9",
            "external_id": null,
            "name": "John Smith",
            "role": "moderator",
            "join_time": "2023-02-13T16:45:05.000000Z"
        },
        .........................
    ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalsamba.com/reference/rest-api/live-usage/participants.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
