Skip to main content

Enriched Sessions API

Overview​

Returns a page of sessions, each with who the viewer is and what authorized them:

  • user_ident -- the viewer's ID with your identity provider: the sub of the JWT they logged in with. Omitted if the viewer never logged in through your identity provider, for example one signed in with an Eluvio account.
  • authorized_by -- the NFTs the viewer held when the session started (view_start) that the content's access rules admit, however the viewer got them: bought, rented, subscribed, transferred or gifted. An NFT held then counts even if it was revoked or transferred later. An empty list means the viewer played without one, for example as a tenant admin.
  • For each NFT: when and how this viewer got it, its marketplace sku, and, if the tenant has a title catalog listing the content played, billing -- the title catalog offer it was sold under.

A subscription covers many titles, and each title has its own offer, so it has no single billing ID. Each session gets the billing_id of the title watched.


Endpoint​

POST

https://appsvc.svc.eluv.io/casa/main/:tid/sessions_enriched

Authentication: tenant admin bearer token.


Request​

The same query parameters and request body as Sessions, with these differences:

ParameterDescription
limitDefault and maximum 200
offsetMust not be negative
search_indexiq__ ID of a title catalog search index to use instead of the tenant's configured one

JSON only; no CSV.


Paging Through History​

  • Request one time window at a time with start_ts/end_ts (for example, a day), and use offset only within a window. Large offsets get slower.
  • Send one request at a time per tenant. A request made while another is running gets HTTP 429 with a Retry-After header: wait that many seconds and retry.
  • Which NFTs a viewer held when a session started never changes, but billing, title_iq and the access rules come from the title catalog and the content as they are now. A session's result can change when either is updated, for example once a title is added to the catalog, so fetch a range again after such a change.

Response​

Success (HTTP 200)​

Each session has the session fields, plus:

FieldDescription
user_identThe viewer's ID with your identity provider (the login JWT's sub), if any
authorized_byThe NFTs that authorized the session; see below. Empty if none
title_iqTitle catalog title of the content played, if the catalog lists it
authorized_by_errorSet if this session could not be checked (for example, an invalid object_id)

The response also has paging and, if a title catalog was used, its search_index.

authorized_by entries​

FieldDescription
contract_addrNFT contract address
token_idToken ID
acquired_atWhen this viewer got it, unix seconds
acquired_bymint (issued to this viewer) or transfer (received from someone else)
skuMarketplace item that mints it, when one can be identified
billingTitle catalog offers it was sold under, for the content played; see below. Omitted if none

billing entries​

FieldDescription
billing_idThe offer's billing ID
offer_typeEST, TVOD or SVOD
access_tierSubscription tier, for SVOD
regionOffer region, for example US
variantOffer variant, for example hd-3d-sdr

The offer is the one for the variant played whose licensing window covers the date the NFT was first issued (for SVOD, the session start). Where no offer matches a condition, that condition is dropped.

Example Response​

{
"sessions": [
{
"uuid": "<session-id>",
"auth_addr": "0xabc123...",
"object_id": "iq__...",
"title": "Example Title",
"view_start": 1796102181,
"watched_secs": 1320,
"user_ident": "<idp-user-id>",
"title_iq": "iq__...",
"authorized_by": [
{
"contract_addr": "0xdef456...",
"token_id": "3957",
"acquired_at": 1796102163,
"acquired_by": "mint",
"sku": "<svod-sku>",
"billing": [
{
"billing_id": "<billing-id>",
"offer_type": "SVOD",
"access_tier": "premium",
"region": "US",
"variant": "hd-3d-sdr"
}
]
}
]
}
],
"paging": { "offset": 0, "limit": 200, "total": 1, "start_ts": 1796000000, "end_ts": 1796103000 },
"search_index": "iq__..."
}

Errors​

StatusMeaning
400Invalid parameter or body, for example a negative offset
401Missing or invalid token, or the user is not a tenant admin
403The user is a content admin, not a tenant admin
429Another request for this tenant is running; wait Retry-After seconds
502The authorization lookup failed; retry later

If You Use the Entitlements API​

If you create entitlements with the Entitlements API, each authorized_by entry's contract_addr and token_id match an entitlement's minted[] in List Entitlements, listed by the session's auth_addr. That gives each session the entitlement's metadata: customer_id, affiliate_id, and any fields you set on Create Entitlement.


Curl Example​

curl -X POST "https://appsvc.svc.eluv.io/casa/main/<tenantId>/sessions_enriched?start_ts=1796000000&end_ts=1796086400&limit=200" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{}'