curl https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats \
-H "x-api-key: [YOUR_API_KEY]"
const axios = require('axios');
const { data } = await axios.get(
`https://platform.streampixel.io/api/v1/projects/${projectId}/user-stats`,
{ headers: { 'x-api-key': '[YOUR_API_KEY]' } }
);
console.log(`Live: ${data.liveUser}, Queue: ${data.queueUser}`);
import requests
response = requests.get(
f"https://platform.streampixel.io/api/v1/projects/{project_id}/user-stats",
headers={"x-api-key": "[YOUR_API_KEY]"},
)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("x-api-key", "[YOUR_API_KEY]")
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println("Response:", string(body))
}
import okhttp3.*;
public class ProjectUserStats {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats")
.header("x-api-key", "[YOUR_API_KEY]")
.get()
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
{
"liveUser": 7,
"queueUser": 2
}
{
"message": "projectId is required"
}
{
"message": "Authentication required"
}
{
"message": "Access denied"
}
{
"message": "Project not found"
}
{
"message": "Internal server error"
}
Project User Stats
Get a live snapshot of how many users are actively streaming and how many are waiting in queue for a project.
GET
/
api
/
v1
/
projects
/
{projectId}
/
user-stats
curl https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats \
-H "x-api-key: [YOUR_API_KEY]"
const axios = require('axios');
const { data } = await axios.get(
`https://platform.streampixel.io/api/v1/projects/${projectId}/user-stats`,
{ headers: { 'x-api-key': '[YOUR_API_KEY]' } }
);
console.log(`Live: ${data.liveUser}, Queue: ${data.queueUser}`);
import requests
response = requests.get(
f"https://platform.streampixel.io/api/v1/projects/{project_id}/user-stats",
headers={"x-api-key": "[YOUR_API_KEY]"},
)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("x-api-key", "[YOUR_API_KEY]")
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println("Response:", string(body))
}
import okhttp3.*;
public class ProjectUserStats {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats")
.header("x-api-key", "[YOUR_API_KEY]")
.get()
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
{
"liveUser": 7,
"queueUser": 2
}
{
"message": "projectId is required"
}
{
"message": "Authentication required"
}
{
"message": "Access denied"
}
{
"message": "Project not found"
}
{
"message": "Internal server error"
}
Return real-time counts of live users (active streaming sessions) and queued users (waiting for a worker) for a single project. Use this to power live status indicators, capacity dashboards, and autoscaling triggers without pulling the full session list.
Live and queue state is read from Redis, so this endpoint is fast enough to poll on a short interval. A few seconds between polls is plenty — the counts update in near real time.
The legacy path
GET /projects/userStats/{projectId} still works and returns the same response, but is deprecated — use GET /projects/{projectId}/user-stats in new integrations.Typical workflow
1
Authenticate
Send your API key in the
x-api-key request header. The project must belong to the key’s account.2
Request the counts
Call
GET /projects/{projectId}/user-stats for the project you want to inspect.3
Render or react
Use
liveUser and queueUser in your dashboard, or compare against thresholds to trigger alerts.Prerequisites
| Requirement | Where to get it |
|---|---|
| Project ID | Finding your IDs or List Projects |
| API Key | API authentication |
Do not put the API key in the URL. Query-string keys (
?apikey=) are rejected with 400 API_KEY_IN_QUERY. Send the key in the x-api-key header.Path parameters
string
required
The ID of the project to fetch live and queue user counts for. Must belong to the authenticated account.
Headers
string
required
Your Streampixel API key.
Query parameters
string
Optional, for backward compatibility. If provided, it must be the ID of the authenticated account — any other value returns
403 Access denied. Omit it in new integrations.Response
number
Number of users currently in an active streaming session for this project. Sessions in
Terminated or Terminating state are excluded.number
Number of users waiting in the project’s queue for a worker to become available.
curl https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats \
-H "x-api-key: [YOUR_API_KEY]"
const axios = require('axios');
const { data } = await axios.get(
`https://platform.streampixel.io/api/v1/projects/${projectId}/user-stats`,
{ headers: { 'x-api-key': '[YOUR_API_KEY]' } }
);
console.log(`Live: ${data.liveUser}, Queue: ${data.queueUser}`);
import requests
response = requests.get(
f"https://platform.streampixel.io/api/v1/projects/{project_id}/user-stats",
headers={"x-api-key": "[YOUR_API_KEY]"},
)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
url := "https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("x-api-key", "[YOUR_API_KEY]")
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println("Request failed:", err)
return
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println("Response:", string(body))
}
import okhttp3.*;
public class ProjectUserStats {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://platform.streampixel.io/api/v1/projects/[PROJECT_ID]/user-stats")
.header("x-api-key", "[YOUR_API_KEY]")
.get()
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
{
"liveUser": 7,
"queueUser": 2
}
{
"message": "projectId is required"
}
{
"message": "Authentication required"
}
{
"message": "Access denied"
}
{
"message": "Project not found"
}
{
"message": "Internal server error"
}
Error reference
| Status | Message | Cause |
|---|---|---|
400 | API_KEY_IN_QUERY | The key was sent as a query parameter. Move it to the x-api-key header and rotate the key. |
401 | Authentication required | The x-api-key header is missing, or the key is invalid/rotated. |
403 | Access denied | The project isn’t owned by the key’s account (or a mismatched userId was supplied). |
404 | Project not found | No project with the supplied projectId. |
500 | Internal server error | Unexpected failure. Retry; if it persists, contact support. |
Polling pattern
For a live dashboard, poll on a short interval and stop the timer when the page is hidden. This keeps the UI responsive without hammering the API.Node.js / Browser
async function fetchStats(projectId, apiKey) {
const res = await fetch(
`https://platform.streampixel.io/api/v1/projects/${projectId}/user-stats`,
{ headers: { 'x-api-key': apiKey } }
);
if (!res.ok) throw new Error(`stats failed: ${res.status}`);
return res.json();
}
let timer = setInterval(async () => {
try {
const { liveUser, queueUser } = await fetchStats('[PROJECT_ID]', '[YOUR_API_KEY]');
render({ liveUser, queueUser });
} catch (err) {
console.error(err);
}
}, 5000);
Call this endpoint server-side only — shipping your API key to a browser exposes it to anyone who opens DevTools. If browsers need these counts, proxy the call through your backend and push updates over WebSocket or SSE.
Next
List projects
Enumerate every project so you can fetch stats for each.
Rate limits & errors
Limits per endpoint and the standard error response format.