careful-branch-64770
09/17/2025, 3:07 PMtall-airline-16756
09/17/2025, 3:07 PMtall-airline-16756
09/17/2025, 3:08 PMcareful-branch-64770
09/17/2025, 3:10 PMtall-airline-16756
09/17/2025, 3:12 PMroomList grant, then use the /api/v1/sessions endpoint to pull session data, including how many participants are connected.
• Server SDKs: If you prefer using SDKs like Python, Node.js, or Rust, you can connect to the RoomService API to list participants in a room. For instance, with Python, the livekit-api library makes it straightforward to fetch participant details.
Just a quick heads-up: the Analytics API is available for customers on the Scale plan or higher. If you’d like to dive deeper, the Analytics API documentation and Server SDKs documentation are great resources to explore.
Sources: Analytics API | LiveKit Docs | examples/multiple_connections.py | src/pages/api/room_info/[room].ts | README.md | README.mdcareful-branch-64770
09/18/2025, 1:33 AMconst token = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET);
token.addGrant({ roomList: true });
const jwt = await token.toJwt();
const endpoint = `<https://cloud-api.livekit.io/api/project/${PROJECT_ID}/sessions/>`;
<http://log.info|log.info>("Checking LiveKit sessions", { endpoint });
const response = await fetch(endpoint, {
method: "GET",
headers: {
Authorization: `Bearer ${jwt}`,
"Content-Type": "application/json",
},
});
but i'm getting a 401 unauthorized error. what is the issue?tall-airline-16756
09/18/2025, 1:34 AM/api/v1/sessions endpoint. This usually happens for a few common reasons, so let’s walk through them together:
• Token Issues: It’s important to make sure your token includes the roomList grant and is generated correctly. A handy way to check this is by decoding your token using a tool like jwt.io, which lets you see the token’s structure and claims.
• Clock Drift: Since JWT tokens are time-sensitive, if the system clock that generates the token isn’t synced with LiveKit’s servers, the token might get rejected. Double-checking your system time can really help here.
• API Key/Secret Issues: Please verify that your LIVEKIT_API_KEY and LIVEKIT_SECRET_KEY are correctly formatted and don’t have any extra spaces or unexpected characters.
• Project ID Mismatch: Make sure the PROJECT_ID in your API URL matches the project linked to your API key and secret. This can sometimes be an easy thing to overlook.
Here are a few steps you can try to troubleshoot further:
1. Decode your JWT and confirm it includes the roomList grant.
2. Check the token’s nbf (not before) and exp (expiration) claims to ensure it’s valid at the current time.
3. Try making the API call with minimal parameters using a tool like curl to rule out any malformed requests.
If you’re still stuck after these steps, please don’t hesitate to reach out—I’m here to help you get this sorted!
Sources: Analytics API | LiveKit Docs | auth/grants.go | Authentication | LiveKit Docs