Skip to content
Longplay
Docs
Browse docs / Create a Server Key

Create a Server Key

Create a backend credential for one App and environment.

Markdown
API v1Updated

Credentials and identity#

Who holds each credential
CallerCredentialPurpose
Longplay console memberBetter Auth account sessionSign in to Console and the CLI and create Apps and Keys; not an SDK API credential
Your backendServer Key / gg_sk_Call APIs within the Key's App, environment, and scopes
Your userexternalUserIdVerified by your own login system; not a Longplay login credential
Browser or appAccess Token / gg_ct_Call business APIs as the verified Customer
Browser or appRefresh Token / gg_rt_Refresh the same session only; cannot call business APIs

Who holds each credential

  • Longplay console member

    Credential
    Better Auth account session
    Purpose
    Sign in to Console and the CLI and create Apps and Keys; not an SDK API credential
  • Your backend

    Credential
    Server Key / gg_sk_
    Purpose
    Call APIs within the Key's App, environment, and scopes
  • Your user

    Credential
    externalUserId
    Purpose
    Verified by your own login system; not a Longplay login credential
  • Browser or app

    Credential
    Access Token / gg_ct_
    Purpose
    Call business APIs as the verified Customer
  • Browser or app

    Credential
    Refresh Token / gg_rt_
    Purpose
    Refresh the same session only; cannot call business APIs

A Server Key proves backend access, not end-user identity. Verify the user in your backend before sending a stable user ID to Decide.

Open the creation flow#

  • Open https://console.longplayai.com/workspace/developers?tab=keys and select the App and Sandbox.
  • In the sidebar, choose Integrations → Server keys, then click Create Key.
  • The account needs apiKeys:write for the App. An Owner, or an Admin or Developer with App access, can do this.

Generate and store#

Enter a name and expiry, and select only the scopes you use (see the scope list below). A first request needs only customers:write; Funnel server decisions need customers:write, sessions:create, funnels:run. A Run uses the permissions of the Key that started it: Paywall and Offering steps need entitlements:read; buying from a Paywall also needs billing:write (quote, confirm and cancel) and billing:read (settlement and recovery reads); claiming or showing Coupons needs offers:resolve. In the Console's Create Key dialog, "Use Funnel start permissions" selects all of them: funnels:run, sessions:create, customers:write, entitlements:read, offers:resolve, billing:read, billing:write.

A Key is bound to one App and environment, expires in 1–365 days, and counts toward a limit of 20 active Keys per App/environment. Click Generate Key. The complete Key appears once. Save it in your backend secret store or a Git-ignored local .env as LONGPLAY_SERVER_KEY; never put it in browser code or public docs.

Related: Open Server keys in Console·Install SDKs and CLI·Environments

Scope list#

Scopes a Server Key can hold
ScopeAllows
messaging:writeManage Customer messaging preferences and devices; send and read messages from a trusted server.
customers:readRead Customers, lists and seats.
customers:writeCreate, update and claim Customers.
sessions:createIssue, renew and revoke Customer/Guest sessions; also required to start Funnels.
content:readRead standalone Page, Popup and Banner content by resource or fixed version for the verified Customer or Guest.
entitlements:readCheck access, read holdings, resolve Offerings and Paywalls; also required when a Funnel Run started with the Key reaches a Paywall or Offering step.
credits:readRead balances, usage, ledger, statements, analytics and AI pricing.
credits:consumeReport usage and consume or reserve balance.
credits:manageGrant and adjust balances, set usage and manage Entities.
billing:readRead payments, subscriptions, trials, invoices and refunds; also required when a Funnel Run started with the Key reads a Paywall purchase's settlement or recovery.
billing:writePurchases, subscription changes, refunds, invoices, billing controls, seats and native purchases; also required when a Funnel Run started with the Key quotes, confirms or cancels a Paywall purchase.
offers:resolveCustomer coupon redemption, claims and lists, referral codes and rewards; also required when a Funnel Run started with the Key claims or shows Coupons.
offers:grantGrant coupons to Customers from your backend.
features:readDownload and evaluate feature flags.
events:writeReport behavior, exposure and feature-flag usage events.
funnels:runStart and advance Funnels, server decisions and adoption reports.
code-references:readCLI/CI reads the code-reference scan configuration.
code-references:writeCLI/CI uploads code-reference scan reports.
app-manifests:writeUpload the App page map (IAM) from builds; must be the Key's only permission.

Scopes a Server Key can hold

  • messaging:write

    Allows
    Manage Customer messaging preferences and devices; send and read messages from a trusted server.
  • customers:read

    Allows
    Read Customers, lists and seats.
  • customers:write

    Allows
    Create, update and claim Customers.
  • sessions:create

    Allows
    Issue, renew and revoke Customer/Guest sessions; also required to start Funnels.
  • content:read

    Allows
    Read standalone Page, Popup and Banner content by resource or fixed version for the verified Customer or Guest.
  • entitlements:read

    Allows
    Check access, read holdings, resolve Offerings and Paywalls; also required when a Funnel Run started with the Key reaches a Paywall or Offering step.
  • credits:read

    Allows
    Read balances, usage, ledger, statements, analytics and AI pricing.
  • credits:consume

    Allows
    Report usage and consume or reserve balance.
  • credits:manage

    Allows
    Grant and adjust balances, set usage and manage Entities.
  • billing:read

    Allows
    Read payments, subscriptions, trials, invoices and refunds; also required when a Funnel Run started with the Key reads a Paywall purchase's settlement or recovery.
  • billing:write

    Allows
    Purchases, subscription changes, refunds, invoices, billing controls, seats and native purchases; also required when a Funnel Run started with the Key quotes, confirms or cancels a Paywall purchase.
  • offers:resolve

    Allows
    Customer coupon redemption, claims and lists, referral codes and rewards; also required when a Funnel Run started with the Key claims or shows Coupons.
  • offers:grant

    Allows
    Grant coupons to Customers from your backend.
  • features:read

    Allows
    Download and evaluate feature flags.
  • events:write

    Allows
    Report behavior, exposure and feature-flag usage events.
  • funnels:run

    Allows
    Start and advance Funnels, server decisions and adoption reports.
  • code-references:read

    Allows
    CLI/CI reads the code-reference scan configuration.
  • code-references:write

    Allows
    CLI/CI uploads code-reference scan reports.
  • app-manifests:write

    Allows
    Upload the App page map (IAM) from builds; must be the Key's only permission.

The Key that issues a Customer session bounds what that session can call in the browser: for example, to let the browser read access, buy and redeem coupons, the issuing Key needs sessions:create plus entitlements:read, billing:read, billing:write and offers:resolve. CI code-reference scanning uses a separate Key with only code-references:read and code-references:write.

Rotate and revoke#

If scopes change or a Key is lost or near expiry, create a replacement for the same App/environment. Update backend configuration, confirm successful requests, then revoke the old Key. Revocation or expiry affects later authentication; it does not roll back committed operations.