Subscriptions API
Overview
Returns a tenant's subscriptions -- one record per subscriber per subscription, from any source: Eluvio-hosted (Stripe) checkout or the Entitlements API -- with each one's status, paid-through date and the NFT it holds.
Three calls:
| Operation | Endpoint |
|---|---|
| List subscriptions | POST /authd/tnt/:tid/subscriptions |
| One subscription, with payments | GET /authd/tnt/:tid/subscriptions/:id |
| Values of one field, counted | POST /authd/tnt/:tid/subscriptions/attr/:field |
All take a tenant admin bearer token, under the same base URL as the other
Analytics APIs: https://appsvc.svc.eluv.io/casa/main.
List Subscriptions
POST
https://appsvc.svc.eluv.io/casa/main/authd/tnt/:tid/subscriptions
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
start_ts | integer | No | Start of the range of creation times, unix seconds. Default: 1 week ago |
end_ts | integer | No | End of the range, unix seconds. Default: now |
limit | integer | No | Max results to return (paging) |
offset | integer | No | Result offset (paging) |
The time range selects subscriptions by when they were created.
Request Body (optional)
{
"filters": { "status": ["active"], "sku": ["<svod-sku>"] },
"exclude_filters": { "country": ["CA"] },
"search": { "text": "example.com", "fields": ["email"] },
"order_by": "paid_to desc"
}
| Field | Description |
|---|---|
filters | Restrict results: OR within a field, AND across fields |
exclude_filters | Leave out matching results, in the same form |
search | Case-insensitive substring text, matched in any of fields |
order_by | A field, optionally followed by asc or desc. Default: newest created first |
Fields for filters, exclude_filters and search: status, period, description, currency, email,
user_addr, token_addr, token_id, sub_id, stripe_sub, stripe_cus, sku, country, discount_code,
name, or attr.<key> for any other attributes key. order_by also takes created, updated, start_time,
end_time, paid_to, canceled_at and last_payment.
CSV
Send Accept: text/csv to get CSV. Without limit, CSV returns every matching row.
Response
{
"subscriptions": [
{
"id": "<uuid>",
"sub_id": "3pp:<tenantId>:pi_sub_1234",
"user_addr": "0xabc123...",
"token_addr": "0xdef456...",
"token_id": "3957",
"description": "Example monthly subscription",
"status": "active",
"period": "month",
"email": "user@example.com",
"attributes": { "sku": ["<svod-sku>"], "country": ["US"], "customer_id": ["cus_1234"] },
"start_time": 1796102158,
"paid_to": 1798694157,
"last_payment": 1796102158,
"created": 1796102158,
"updated": 1796102164
}
],
"period": { "start_ts": 1795497358, "end_ts": 1796102358 },
"paging": { "offset": 0, "limit": 50, "total": 1 }
}
| Field | Description |
|---|---|
id | Subscription record ID, for One Subscription |
sub_id | Subscription ID: for the Entitlements API, the trans_id from Create Entitlement |
user_addr | Subscriber's wallet address |
token_addr, token_id | The NFT the subscription holds |
status | active, canceled, expired or refunded |
period | Billing period: month, year or season, when known |
attributes | Details such as sku, country and customer_id |
metadata | Your own metadata, as sent on Create Entitlement |
start_time, paid_to, end_time, canceled_at, last_payment | Unix seconds; omitted when not set |
token_removed | When the NFT was revoked, unix seconds, if it has been |
user_ident, user_name, user_extras | From the user's login, masked when the user has not agreed to share their email; not masked for users of your own identity provider |
One Subscription, with Payments
GET
https://appsvc.svc.eluv.io/casa/main/authd/tnt/:tid/subscriptions/:id
:id is the id field of a list entry. Returns the subscription, its payments (purchases: the initial purchase,
renewals, refunds and credits, each with its kind), and all the subscriber's primary purchases in the tenant
(user_purchases). Returns HTTP 404 if there is no such subscription.
Values of One Field
POST
https://appsvc.svc.eluv.io/casa/main/authd/tnt/:tid/subscriptions/attr/:field
Returns the distinct values of one field, with the number of matching subscriptions for each, most common first --
for example status or sku, to build filter choices. Takes the same query parameters and request body as the
list.
Curl Example
curl -X POST "https://appsvc.svc.eluv.io/casa/main/authd/tnt/<tenantId>/subscriptions?start_ts=1793000000&limit=50" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"filters": {"status": ["active"]}}'