Analytics API
The Analytics API (v2) gives you read access to the same data you see in nanoStream Analytics: viewer experience, playback start success and errors, ingest health, concurrent viewers, traffic usage, geography, alerts and AI Live Captions usage. Use it to feed your own dashboards, reports and monitoring. Every query returns data for your own organisation only.
| Value | |
|---|---|
| Base URL | https://metrics-api.nanostream.cloud |
| Path prefix | /v2/... |
| Auth header | x-access-token: <JWT> |
| Interactive reference | https://api.nanostream.cloud/docs/analytics/v2/ |
| OpenAPI spec | https://api.nanostream.cloud/docs/analytics/v2/openapi_v2.json |
The old base URL metrics.nanocosmos.de/api/v2/... no longer works. Use metrics-api.nanostream.cloud/v2/....
Authenticate
The Analytics API has no API key of its own. It accepts a JWT in the x-access-token header. You get one in two ways.
Option 1: access token from the Cloud Token Service (recommended)
Mint a token from your organisation API key with metrics in its audience. It can live up to 365 days, and one token with "aud": ["bintu","metrics"] also works for the REST API.
curl -X POST https://token.nanostream.cloud/bintu/token \
-H "X-BINTU-APIKEY: $BINTU_API_KEY" \
-H "content-type: application/json" \
-d '{ "exp": 1790261651, "aud": ["metrics"], "iss": "<READ_ONLY_USER_ID>" }'
Use this for services, CI jobs and dashboards. See APIs & SDKs overview for all fields.
Option 2: sign in with your Analytics login
Your Analytics login is your nanoStream Dashboard login (one shared user database). POST /authenticate returns a token that is valid for 24 hours. The lifetime is fixed: expiry fields in the request are ignored.
curl -X POST "https://metrics-api.nanostream.cloud/authenticate" \
-H "content-type: application/json" \
-d '{ "email": "<EMAIL>", "password": "<PASSWORD>" }'
Use a read-only user for API access. Never put a password or token into client-side code, logs or support tickets.
Your first query
Concurrent viewers for one day, hourly:
curl -s "https://metrics-api.nanostream.cloud/v2/viewers/concurrent/timeseries?from=2026-11-01T00:00:00&to=2026-11-02T00:00:00&interval=hour" \
-H "x-access-token: $NANO_API_TOKEN"
Buffering ratio for two streams, as CSV:
curl -s "https://metrics-api.nanostream.cloud/v2/h5live/bufferingratio/streams/timeseries?from=2026-11-01T00:00:00&to=2026-11-02T00:00:00&interval=hour&streams=abcde-11111&streams=abcde-22222&format=csv" \
-H "x-access-token: $NANO_API_TOKEN"
Common parameters
| Parameter | Description |
|---|---|
from, to | Time range in UTC, for example 2026-11-01T00:00:00. from rounds down and to rounds up to the minute. |
interval | Required on timeseries routes, for example hour |
streams | Filter by stream name. Repeat for several streams. |
tags | Filter by stream tag. Repeat for several tags. |
countries | Filter by country |
events | Filter by event ID (from the player's metrics.eventId) |
format=csv | Return CSV instead of JSON (most routes) |
streams, countries and events combine with OR. tags combine with AND: two tags return only streams that carry both. An empty intersection returns error 101010.
Route groups
| Group | Routes | What you get |
|---|---|---|
| Viewer experience (WebSocket/MSE playback) | /v2/h5live/... | Playtime, buffering ratio, latency, startup time, error codes, stop reasons, views and playtime per browser and OS |
| Viewer experience (MOQ playback) | /v2/moq/... | The same metrics for playback over MOQ (Media over QUIC) |
| Playback start success | /v2/playback/start/success/... | Successful Playback Start Ratio (SPSR) per stream, tag, country, with breakdowns |
| Playback start errors | /v2/playback/start/errors/... | Playback start errors (PSE) with the same breakdowns |
| Concurrent viewers | /v2/viewers/concurrent/timeseries | Concurrent viewers over time |
| Ingest monitoring | /v2/monitoring/ingest/... | Audio/video bitrate, SRT metrics, latest RTMP metrics, max frame delay, stream time ratio |
| Playout monitoring | /v2/monitoring/playout/... | Buffering ratio, error codes, startup time |
| Alerts | /v2/alerting/ingest | Current and past ingest alerts with recommended actions |
| Usage | /v2/usage/... | Traffic (bytes) over time, last month, ingest/playout breakdowns |
| World map | /v2/world/... | Usage, playtime, latency, buffering, ABR metrics, playouts and ingests per country |
| Webcaster | /v2/webrtc/... | nanoStream Webcaster ingest bitrate, browsers and OS |
| AI Live Captions | /v2/captions/usage/... | Caption uptime per stream and over time, source and target languages |
The interactive reference lists every route with its parameters and response schema. Some routes require a higher plan and return 403 (105002) on lower plans; a few are only available in the Analytics dashboard (105003).
Since API version 2.36.0, /v2/h5live/* covers WebSocket/MSE playback only. Playback over MOQ is reported under /v2/moq/*. Add both together for a total.
MOQ routes
| Route | Returns |
|---|---|
/v2/moq/views/os, /v2/moq/views/browser | Views by OS / browser |
/v2/moq/playtime/os, /v2/moq/playtime/browser | Playing time by OS / browser |
/v2/moq/playtime/timeseries, /v2/moq/playtime/streams/timeseries | Playing time (all / one stream) |
/v2/moq/latency/timeseries, /v2/moq/latency/streams/timeseries | Latency (all / one stream) |
/v2/moq/startuptime/timeseries, /v2/moq/startuptime/streams/timeseries | Startup time (all / one stream) |
/v2/moq/bufferingratio/timeseries, /v2/moq/bufferingratio/streams/timeseries | Buffering ratio (all / one stream) |
/v2/moq/errorcodes/timeseries | Error codes |
/v2/moq/stopReasons/timeseries | Stop reasons |
Playback start success (SPSR) and errors (PSE)
SPSR is the share of playback starts that do not end with an error within the first 30 seconds. Errors after a pause or a later restart are not counted. Values are calculated per minute with a 5-minute delay.
Breakdown terms include browser, browser version, referrer, OS, OS version, player version, city, IP, initial ABR profile, media playback API and fast start.
A typical investigation:
- Get the SPSR timeseries:
/v2/playback/start/success/ratio/timeseries?from=…&to=…&interval=hour - Narrow the time range and check countries:
/v2/playback/start/success/ratio/world?from=…&to=… - Break errors down for one country by IP:
/v2/playback/start/errors/countries/ip?from=…&to=…&countries=AM
Read results correctly
- HTTP 200 doesn't mean there is data. Check the body status:
1000OK,2000no data,2001no alerts. - Base units. Bytes come back in bytes, playtime and caption uptime in seconds. The dashboard converts to GB and hours.
- Usage is booked when a session stops. A running stream contributes nothing until it ends. Sum a usage timeseries over a range; don't read one bucket as throughput.
- Concurrent viewers arrive about 3 minutes late. A zero in the last few minutes fills in later.
- Player metrics need the player's
metricsconfig. Playtime, latency, startup time and buffering only exist for players that report metrics. See Player configuration reference. - Top lists are capped at 1,000 and not exact over long ranges. Filter by
streamsfor exact figures. - Long ranges are rejected per route with
400/101004. The error body names the limit. Split the range and sum the results. - World-map usage is slightly lower than the usage timeseries, because traffic without a resolvable country is left out.
Rate limit
1 request per second, with bursts of up to 30 requests per second processed immediately. Above that you get HTTP 502 (Bad Gateway) or 504 (Gateway Timeout).
Error codes
Request errors
| Code | Name | HTTP | Meaning |
|---|---|---|---|
101001 | Endpoint not found | 404 | Wrong path. Requests go to https://metrics-api.nanostream.cloud/v2/<route>. |
101002 | Param required | 400 | A required parameter is missing |
101003 | Wrong data type | 400 | A value has an unexpected type |
101004 | Invalid value | 400 | A parameter failed validation, for example an unknown country or invalid time range |
101005 | Too many params | 400 | The route limits the number of streams or tags |
101006 | Invalid request body | 400 | Unknown or wrong body structure |
101007 | Missing props request body | 422 | Required body properties missing |
101008 | General request body issue | 403 | For example a stream name not in your organisation |
101009 | Invalid header | 403 | A header doesn't follow the request scheme |
101010 | Tag stream intersection issue | 404 | The combined tag filter matches no stream |
Authentication errors
| Code | Name | HTTP |
|---|---|---|
102001 | User not found | 404 |
102002 | Invalid user credentials | 401 |
102011 | Organisation not found | 404 |
102012 | Organisation is not enabled | 403 |
102021 | API key not found | 404 |
Filter errors
| Code | Name | HTTP |
|---|---|---|
103001 | Stream not found | 404 |
103002 | Tag not found | 404 |
103003 | Country not found | 404 |
Processing and access errors
| Code | Name | HTTP | Meaning |
|---|---|---|---|
104XXX | Internal error | 500 | Server-side problem. Retry later; contact support if it persists. |
105001 | Access denied | 403 | No access to the requested content |
105002 | Access level too low | 403 | Your plan or user role doesn't include this route |
105003 | Analytics dashboard only | 403 | The route isn't available via API |
105011 | X-ACCESS-TOKEN error | 401 | Token invalid or malformed |
105012 | X-ACCESS-TOKEN missing | 401 | Add the x-access-token header |
Next steps
- nanoStream Analytics overview: which view to use for which question
- Metrics explained: what each metric means
- Alerts, monitoring & email notifications: get notified instead of polling
- Build with AI: the nanoStream Analytics Agent Skill queries this API for you
Try it in the Builder Hub: open nanoStream Analytics to see these metrics for your own streams. Start for Free