Skip to content
Longplay
Docs
Browse docs / Read memberships, purchases and balances
On this page

Read memberships, purchases and balances

Operation
readHoldings
Server SDK
readHoldings
Python
read_holdings
Go
ReadHoldings
Browser SDK
readHoldings
POST/api/v1/customer-holdings

Read a Customer or Entity's memberships, purchases and balances.

Markdown
API v1Updated

Request#

Credential
Server Key (with customerId) or Customer Token, scope entitlements:read.
SDK
JavaScript createLongplayServer().readHoldings · JavaScript createLongplay().readHoldings · Python read_holdings · Go ReadHoldings
Success
HTTP 200
request.shShell
curl -X POST "$LONGPLAY_API_URL/api/v1/customer-holdings" \  -H "Authorization: Bearer $LONGPLAY_SERVER_KEY" \  -H "X-Indiana-Protocol: 0.10" \  -H "Content-Type: application/json" \  -d '{  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d"}'

The response shows example data.

Body parameters#

application/json

customerIduuidOptional

The Customer's UUID.

entityIduuidOptional

Entity ID within the current customer scope, for configured Entity and license Features.

Response fields#

Every successful response includes requestId (this request's ID, for support) and scope (App and environment).

HTTP 200 · application/json

requestIduuidRequired

UUID the server generated for this HTTP request; include it when reporting a problem. It is not your business requestId.

scopeobjectRequired

The App and environment of this response. Headers only verify scope; they cannot switch key scope.

Show child fields
projectIdstringRequired

App ID bound to the credential.

minLength: 1

environmentenumRequired

Separate data scope: sandbox or live.

Show allowed values

"sandbox""live"

holdingsobjectRequired

The Customer's holdings at snapshotAt, scoped to entityId when given: memberships and per-Feature balances.

Show child fields
customerIduuidRequired

The Customer's UUID.

snapshotAtdate-timeRequired

Statement snapshot time; pass the first page's value when paging, null for the first page.

membershipsarrayRequired

membership; fields below.

maxItems: 100

Show child fields
iduuidRequired

The membership's ID.

productIdstringRequired

Product ID.

minLength: 1 · maxLength: 255

productVersionIduuidRequired

Product Version ID.

billingProductVersionIduuidRequired

UUID of the Product Version this membership is billed under; it equals productVersionId.

versionintegerRequired

Version number.

max: 9007199254740991

keystringRequired

The Product key (its public ID), the same value as productId.

minLength: 1 · maxLength: 64

namestringRequired

Display name; not a unique identifier.

minLength: 1 · maxLength: 120

groupIdstring | nullRequired

The Product's group: main Products in the same group are mutually exclusive. null means the default group.

membershipTypeenumRequired

main is a main Product, which replaces other main Products in its group; addon is an add-on held alongside other Products.

Show allowed values

"main""addon"

statusenumRequired

Status; see the allowed values.

Show allowed values

"trial""active""past_due""ended""expired""trialing""paused""pending""scheduled""unknown"

cancelAtPeriodEndbooleanRequired

Whether it cancels at the end of the current period.

accessEnabledbooleanRequired

Whether the membership grants its Product's access right now: it has started, has not ended, and is active, past due or in an unexpired trial.

renewalChangeobject | nullRequired

A pending or scheduled change to this membership (another Product Version, a seat quantity or a Feature quantity) with its timing and status; null when none is pending.

Show child fields
productVersionIduuidRequired

Product Version ID.

namestringRequired

Display name; not a unique identifier.

minLength: 1 · maxLength: 120

versionintegerRequired

Version number.

max: 9007199254740991

effectiveAtdate-timeRequired

Timestamp (ISO 8601).

benefitsAppliedAtdate-time | nullRequired

Timestamp (ISO 8601).

timingenumRequired

Immediate or end-of-cycle timing, only for supported plan-change actions.

Show allowed values

"immediate""renewal"

changeKindenumRequired

plan switches to another Product Version; seats changes a seat quantity (see seat); quantity changes a Feature's purchased quantity (see feature).

Show allowed values

"plan""seats""quantity"

featureobjectOptional

Feature; fields below.

seatobject | nullRequired

For a seats change, the seat key with its quantity before (fromQuantity) and after (toQuantity); null for other change kinds.

statusenumRequired

Status; see the allowed values.

Show allowed values

"prepared""quoted""confirmed""pending""scheduled"

periodobject | nullRequired

The membership's current period: phase, startsAt and endsAt (ISO 8601; endsAt is null when open-ended). null when the membership has no start time.

Show child fields
phaseenumRequired

trial while a free trial is running; otherwise paid.

Show allowed values

"paid""trial"

startsAtdate-timeRequired

Timestamp (ISO 8601).

endsAtdate-time | nullRequired

Timestamp (ISO 8601).

membershipsLimitedbooleanRequired

Whether the Customer has more than 100 memberships, in which case memberships lists only the 100 most recently created.

balancesarrayRequired

One entry per Feature the Customer (or the requested Entity) currently holds, combining all current sources and sorted by Feature name; at most 500.

maxItems: 500

Show child fields
internal_feature_iduuidRequired

Feature ID.

keystringRequired

The Feature key.

minLength: 1 · pattern: ^[a-zA-Z0-9_-]+$

namestringRequired

Display name; not a unique identifier.

minLength: 1 · maxLength: 120

kindenumRequired

Kind; see the allowed values.

Show allowed values

"access""metered""credit"

usageTypeenum | nullRequired

For metered Features: consumable when usage is spent from the balance (such as requests), non_consumable for allocated capacity such as seats, reported in usage. null when kind is access or credit.

accessiblebooleanRequired

Whether the balance can be used now; when false, available and held are 0.

unlimitedbooleanRequired

Whether it is unlimited.

availablestringRequired

Available quantity.

pattern: ^(0|[1-9]\d{0,17})(\.\d{1,12})?$

heldstringRequired

Holdings.

pattern: ^(0|[1-9]\d{0,17})(\.\d{1,12})?$

debtstringRequired

Outstanding debt on this balance as a decimal string, settled by later payments or refunds; 0 when nothing is owed.

pattern: ^(0|[1-9]\d{0,17})(\.\d{1,12})?$

nextExpiresAtdate-time | nullRequired

Timestamp (ISO 8601).

usageobject | nullRequired

Usage.

Show child fields
internal_feature_iduuidRequired

Feature ID.

entityIduuid | nullRequired

Entity ID within the current customer scope, for configured Entity and license Features.

operationIduuid | nullRequired

Business operation UUID. Subscription execution references operationId from previewAttach; balance refunds reference the original consumption.

usagestringRequired

Usage.

pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$

capacitystring | nullRequired

Capacity.

remainingstring | nullRequired

Remaining allowance at evaluation time. It is not reserved and does not guarantee later consumption.

withinLimitbooleanRequired

Whether it is within the limit.

revisionintegerRequired

Revision of the specific versioned resource; Customer profile updates have no revision.

min: 0 · max: 9007199254740991

updatedAtdate-time | nullRequired

ISO 8601 UTC time of the last record update.

balancesLimitedbooleanRequired

Whether more than 500 balances exist, in which case balances lists only the first 500 by Feature name.

Errors#

Failures return an error object; handle them by error.code and error.recovery. The table lists the errors that follow from this operation's credential, scope and idempotency fields; depending on the request it can also return NOT_FOUND (a referenced resource doesn't exist), NOT_CONFIGURED (a required integration isn't connected) or PAYLOAD_TOO_LARGE. Some refusals, such as insufficient balance, are not errors but a reason in a successful response.

Possible errors
codeHTTPWhenrecovery
INVALID_REQUEST400The request doesn't match this page's parameters. A missing or malformed protocol header returns UNSUPPORTED_PROTOCOL_VERSION or INVALID_PROTOCOL_VERSION instead.fix_request
UNAUTHENTICATED401The credential is missing, invalid, expired or revoked.authenticate
FORBIDDEN403The credential lacks entitlements:read.check_permissions
SCOPE_MISMATCH403X-Indiana-Project or X-Indiana-Environment doesn't match the credential's App and environment.check_scope
RATE_LIMITED429Too many requests; wait for Retry-After and retry the same request.retry_same_request
SERVICE_UNAVAILABLE503The service is temporarily unavailable; retry the same request.retry_same_request
INTERNAL_ERROR500The outcome is unknown; retry later.recover_operation

Possible errors

  • INVALID_REQUEST

    HTTP
    400
    When
    The request doesn't match this page's parameters. A missing or malformed protocol header returns UNSUPPORTED_PROTOCOL_VERSION or INVALID_PROTOCOL_VERSION instead.
    recovery
    fix_request
  • UNAUTHENTICATED

    HTTP
    401
    When
    The credential is missing, invalid, expired or revoked.
    recovery
    authenticate
  • FORBIDDEN

    HTTP
    403
    When
    The credential lacks entitlements:read.
    recovery
    check_permissions
  • SCOPE_MISMATCH

    HTTP
    403
    When
    X-Indiana-Project or X-Indiana-Environment doesn't match the credential's App and environment.
    recovery
    check_scope
  • RATE_LIMITED

    HTTP
    429
    When
    Too many requests; wait for Retry-After and retry the same request.
    recovery
    retry_same_request
  • SERVICE_UNAVAILABLE

    HTTP
    503
    When
    The service is temporarily unavailable; retry the same request.
    recovery
    retry_same_request
  • INTERNAL_ERROR

    HTTP
    500
    When
    The outcome is unknown; retry later.
    recovery
    recover_operation

Related: Error codes and recovery·Request conventions·All operations