GET
/
data
/
views
/
query
/
creator
import { Livepeer } from "livepeer";

const livepeer = new Livepeer({
  apiKey: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await livepeer.metrics.getCreatorViewership({});

  // Handle the result
  console.log(result);
}

run();
[
  {
    "playbackId": "1bde4o2i6xycudoy",
    "creatorId": "john@doe.com",
    "viewerId": "1bde4o2i6xycudoy",
    "dStorageUrl": "ipfs://QmZ4",
    "timestamp": 1587667174725,
    "device": "iPhone",
    "deviceType": "mobile",
    "cpu": "ARM",
    "os": "iOS",
    "browser": "Safari",
    "browserEngine": "WebKit",
    "continent": "North America",
    "country": "United States",
    "subdivision": "California",
    "timezone": "America/Los_Angeles",
    "geohash": 123,
    "viewCount": 100,
    "playtimeMins": 10,
    "ttffMs": 100,
    "rebufferRatio": 0.1,
    "errorRate": 0.1,
    "exitsBeforeStart": 0.5
  }
]

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

from

Start timestamp for the query range (inclusive)

to

End timestamp for the query range (exclusive)

timeStep
enum<string>

The time step to aggregate viewership metrics by

Available options:
hour,
day,
week,
month,
year
assetId
string

The asset ID to filter metrics for

streamId
string

The stream ID to filter metrics for

creatorId
string

The creator ID to filter the query results

breakdownBy[]
enum<string>[]

The list of fields to break down the query results. Specify this query-string multiple times to break down by multiple fields.

Available options:
deviceType,
device,
cpu,
os,
browser,
browserEngine,
continent,
country,
subdivision,
timezone,
viewerId

Response

200
application/json
A list of Metric objects

The response is of type object[].