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

# Queue Analytics

> How often viewers waited for a streaming server and how long.

Return queueing statistics for a window: how many viewers queued, average, median and 95th-percentile wait, the peak number waiting at once and when, plus an hourly or daily series. A non-zero queue means demand exceeded the project's concurrent-user allowance at that time.

<Info>
  Scope: `read`.
</Info>

## Path parameters

<ParamField path="projectId" type="string" required>
  The project.
</ParamField>

## Query parameters

<ParamField query="startDate" type="string">ISO 8601 start of the window.</ParamField>
<ParamField query="endDate" type="string">ISO 8601 end of the window.</ParamField>
<ParamField query="granularity" type="string" default="hourly">`hourly` or `daily`.</ParamField>

## Headers

<ParamField header="x-api-key" type="string" required>
  Your Streampixel API key.
</ParamField>

## Response

<ResponseField name="data.summary" type="object">
  `totalQueued`, `avgWaitMs`, `medianWaitMs`, `p95WaitMs`, `peakConcurrent`, `peakBucket`.
</ResponseField>

<ResponseField name="data.timeseries" type="array">
  Per bucket: `bucket` (ISO 8601), `queuedCount`, `peakConcurrentQueued`, `avgWaitMs`, `peakWaitMs`.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"dark"}
  curl "https://platform.streampixel.io/api/v1/analytics/projects/664f1a2b3c4d5e6f7a8b9c0d/analytics/queue?startDate=2026-09-19T00:00:00Z&endDate=2026-09-26T00:00:00Z&granularity=daily" \
    -H "x-api-key: $STREAMPIXEL_API_KEY"
  ```

  ```javascript Node.js theme={"dark"}
  const u = new URL('https://platform.streampixel.io/api/v1/analytics/projects/664f1a2b3c4d5e6f7a8b9c0d/analytics/queue');
  u.search = new URLSearchParams({ startDate: '2026-09-19T00:00:00Z', endDate: '2026-09-26T00:00:00Z', granularity: 'daily' });
  const { data } = await (await fetch(u, { headers: { 'x-api-key': process.env.STREAMPIXEL_API_KEY } })).json();
  if (data.summary.p95WaitMs > 60_000) console.warn('viewers waited over a minute at p95; consider more capacity');
  ```

  ```python Python theme={"dark"}
  import os, requests

  r = requests.get(
      "https://platform.streampixel.io/api/v1/analytics/projects/664f1a2b3c4d5e6f7a8b9c0d/analytics/queue",
      params={"startDate": "2026-09-19T00:00:00Z", "endDate": "2026-09-26T00:00:00Z", "granularity": "daily"},
      headers={"x-api-key": os.environ["STREAMPIXEL_API_KEY"]},
  )
  print(r.json()["data"]["summary"])
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={"dark"}
  {
    "success": true,
    "data": {
      "summary": { "totalQueued": 37, "avgWaitMs": 41200, "medianWaitMs": 28000, "p95WaitMs": 131000, "peakConcurrent": 4, "peakBucket": "2026-09-23T00:00:00.000Z" },
      "timeseries": [
        { "bucket": "2026-09-22T00:00:00.000Z", "queuedCount": 9, "peakConcurrentQueued": 2, "avgWaitMs": 30500, "peakWaitMs": 88000 },
        { "bucket": "2026-09-23T00:00:00.000Z", "queuedCount": 21, "peakConcurrentQueued": 4, "avgWaitMs": 52100, "peakWaitMs": 131000 }
      ]
    }
  }
  ```
</ResponseExample>

## Errors

| Status | Cause                                                            |
| ------ | ---------------------------------------------------------------- |
| `403`  | The key lacks `read`, or the project belongs to another account. |
