Skip to content
Longplay
Docs
Browse docs / API overview
On this page

API overview

Find operations by business task and learn the API endpoint, headers, credentials, idempotent retries and error format.

Markdown
API v1Updated

API Reference#

Browse HTTP operations by business domain, or search the complete directory by method, path and permission. Each operation page includes requests, responses, SDK calls and recovery guidance.

All operations#

Every HTTP operation with its path, credential, scope, SDK methods and purpose, plus Funnel commands and public endpoints.

Funnel decision HTTP reference#

HTTP headers, JSON payloads, response statuses, and recovery for campaign_decide, read_decision, and report_used.

Error codes and recovery#

Server error codes, recovery actions, reasons and SDK client errors.

Operation groups#

Customer messaging and installations
7 operations, Browse operations
Customers, Guests and Sessions
10 operations, Browse operations
Entitlements and product presentation
4 operations, Browse operations
Balances, usage and ledger
16 operations, Browse operations
Seats
2 operations, Browse operations
Subscriptions and payments
20 operations, Browse operations
Invoices, refunds and billing
20 operations, Browse operations
Coupons, rewards and referrals
8 operations, Browse operations
Feature flags, evaluation and events
3 operations, Browse operations
Native purchases
1 operations, Browse operations
AI pricing
1 operations, Browse operations
CLI and CI
3 operations, Browse operations

Common operations#

Find or create a customer#

Find or create a Customer by externalUserId or email; an existing profile is never overwritten.

Check Feature access#

Check whether a Feature requirement is met; observes access without consuming usage.

Confirm or cancel a purchase#

Confirm or cancel a quoted purchase; the transaction and signed callbacks decide the result.

Endpoint and path#

These protocol-0.10 examples use production API https://api.longplayai.com with that deployment's Sandbox credentials. Every operation lives under /api/v1/; ordinary operations each have a path, and Funnel commands share POST /api/v1/funnels.

request.httpShell
POST https://api.longplayai.com/api/v1/customers/getAuthorization: Bearer <SERVER_KEY>X-Indiana-Protocol: 0.10Content-Type: application/json { "lookup": { "type": "externalUserId", "value": "user-42" } }

The X-Indiana-* headers and credential prefixes such as gg_sk_ are fixed protocol names that keep earlier internal names for Longplay. They belong to the same product as the LONGPLAY_ variables in SDK and CLI examples; send them exactly as written here and do not substitute the prefix.

Headers#

Headers
HeaderRequirement
AuthorizationExactly one Bearer <credential>.
X-Indiana-ProtocolRequired: 0.10. Missing or unsupported values return 400 UNSUPPORTED_PROTOCOL_VERSION.
Content-TypeUse application/json for non-GET requests.
X-Indiana-Project / X-Indiana-EnvironmentOptional scope assertions, sent together: the App UUID and sandbox/live. They must match the credential and cannot select another tenant.
X-Indiana-SDK-VersionOptional; sent by the SDKs.
OriginMust be absent on Server Key requests; browser origins must be registered in Console.

Headers

  • Authorization

    Requirement
    Exactly one Bearer <credential>.
  • X-Indiana-Protocol

    Requirement
    Required: 0.10. Missing or unsupported values return 400 UNSUPPORTED_PROTOCOL_VERSION.
  • Content-Type

    Requirement
    Use application/json for non-GET requests.
  • X-Indiana-Project / X-Indiana-Environment

    Requirement
    Optional scope assertions, sent together: the App UUID and sandbox/live. They must match the credential and cannot select another tenant.
  • X-Indiana-SDK-Version

    Requirement
    Optional; sent by the SDKs.
  • Origin

    Requirement
    Must be absent on Server Key requests; browser origins must be registered in Console.
  • GET operations accept no body or query parameters; other operations reject query parameters too.
  • Successful responses include requestId and scope, with X-Request-Id and Cache-Control: no-store. Success is normally HTTP 200; submitUsageBatch and pending Funnel decisions return 202.

Credentials#

Credential types
CredentialPrefixHolderUse
Server Keygg_sk_Your backendServer operations within the Key's App, environment and scopes.
Customer Tokengg_ct_Browser / appCustomer-allowed operations as exactly one Customer.
Refresh Tokengg_rt_Browser / appOnly refreshSession, to obtain a new Access/Refresh pair.
Run Tokengg_fr_Browser / app / backendOnly its own Funnel Run, with the original identity proof: either customerToken in the JSON body or the issuing Server Key in the X-Indiana-Server-Key header, never both. A mismatched proof returns 403.
Environment UUID—PublicRead published public configuration and website experiments; authenticates nothing.

Credential types

  • Server Key

    Prefix
    gg_sk_
    Holder
    Your backend
    Use
    Server operations within the Key's App, environment and scopes.
  • Customer Token

    Prefix
    gg_ct_
    Holder
    Browser / app
    Use
    Customer-allowed operations as exactly one Customer.
  • Refresh Token

    Prefix
    gg_rt_
    Holder
    Browser / app
    Use
    Only refreshSession, to obtain a new Access/Refresh pair.
  • Run Token

    Prefix
    gg_fr_
    Holder
    Browser / app / backend
    Use
    Only its own Funnel Run, with the original identity proof: either customerToken in the JSON body or the issuing Server Key in the X-Indiana-Server-Key header, never both. A mismatched proof returns 403.
  • Environment UUID

    Prefix
    —
    Holder
    Public
    Use
    Read published public configuration and website experiments; authenticates nothing.

Every call checks the credential, scope, App/environment/Customer and origin. A Customer Token cannot select another Customer; a Server Key proves backend access, not end-user identity.

Related: Scope list

Header and prefix names#

X-Indiana-* headers (such as X-Indiana-Protocol) and the gg_ credential prefixes (such as gg_sk_ for Server Keys) are fixed technical names in the protocol. They come from the platform's internal code names and do not refer to another product or service. Send, store and match them exactly as written; do not rename them to Longplay or anything else. Other API pages use them without repeating this note.

Idempotency and retries#

  • Writes carry a business ID: requestId, eventId or idempotencyKey. Generate and persist it before the first send, and replay the same ID with identical input after an unknown result; reusing an ID with different input returns CONFLICT (IDEMPOTENCY_CONFLICT).
  • The response requestId and X-Request-Id identify one HTTP attempt for diagnostics; never use them as the business ID. Exception: in Funnel decision responses (campaign_decide, read_decision), requestId is the decision's original business requestId.
  • Asynchronous work (purchases, changes, refunds, invoices, usage batches, Funnel decisions) returns an operation ID; after a timeout, read the original operation rather than creating a second one.

Error format#

error.jsonJSON
{  "requestId": "<HTTP_ATTEMPT_ID>",  "error": {    "code": "FORBIDDEN",    "message": "This credential cannot perform this operation.",    "retryable": false,    "recovery": "check_permissions"  }}

Handle failures by error.code, retryable and recovery; never parse message. error.reason is optional; when you should wait, the response sets the Retry-After header and error.retryAfterSeconds (seconds).

Related: Error codes and recovery