Skip to content
Install desktop app

Game SDKs

Guide version 1.10.0

JavaScript 1.3.0

Download inspacy-game-sdk-1.3.0.tgz

SHA-256 · d42c46cc56ecbb7f01b9abcfcb66b2332bc87b6b3ee274a777e022e408af7c1c

JavaScript 1.2.0

Download inspacy-game-sdk-1.2.0.tgz

SHA-256 · 6f3850067d6080e14a50680941910a2387256f4fc177e5da67d1b1a5a79578e1

JavaScript 1.0.0

Download inspacy-game-sdk-1.0.0.tgz

SHA-256 · 8ad105d46dba5888af374ec9a07d207b0d1effa95df27c626bc9dbb2b8bcf69e

Function reference

Modern HTTPS browsers and Node.js 22+. The browser entry uses the registered publisher origin. Publisher and reporter clients run on Node.

GameSignIn.begin · complete
Start sign-in with the game’s public client ID and registered callback. Open the returned URL in the system browser, then give the full callback URL to the same login attempt to get tokens.
BrowserSignIn.start · finish
In an HTTPS browser game, start sign-in before redirecting and finish it on the registered callback page. This entry keeps the one-use transaction in session storage by default.
GameSignIn.refresh · revoke
Request offline access during sign-in if the game needs to renew a session. Refresh using the saved refresh token, keep its replacement in protected storage and revoke a token on sign-out.
GamePlayer.me
Use the player’s game access token and the game ID. Read the scoped subject, entitlement, owned content and expansions, beta, membership and accumulated seconds.
GamePlayer.membership
Read active and the paid-through time for this game. Recheck at expiry before enabling a paid benefit.
GamePlayer.beta
Read the beta state, program ID and expiry for this player. Enable beta content only while the decision is active.
GamePlayer.playtime
Start one session UUID at sequence 0. Send increasing heartbeats about every 30 seconds and an end event on exit. Retry an uncertain write with the identical session, sequence and event.
PublisherBackend.player
On your backend, use a game-bound publisher key and the subject returned by sign-in or ticket redemption to read that player’s current game access.
PublisherBackend.unlock
Award a published achievement code on your trusted backend. Use a credential with achievement access. Repeating the same game, subject and code returns the original award time.
PublisherBackend.redeem
Exchange a single-use packaged-launch ticket on the publisher backend. Read the scoped subject and preview flag. Start a fresh launch after a spent ticket or an uncertain redemption.
DedicatedServer.report
Use the named server’s reporter key. Persist a new, increasing generation on restart and increase sequence for each observation. Report zero players when going offline.
GameSdkError.category · status · retryAfterSeconds
Inspect the error category, HTTP status when available, and retry delay. On rate limiting, wait for the indicated delay. Check the outcome of a write before retrying.
npm install ./inspacy-game-sdk-1.0.0.tgz
import { GamePlayer } from '@inspacy/game-sdk'

const { INSPACY_ORIGIN, INSPACY_GAME_ID, INSPACY_ACCESS_TOKEN } = process.env
const player = new GamePlayer(INSPACY_ORIGIN, Number(INSPACY_GAME_ID), INSPACY_ACCESS_TOKEN)
const { entitled, totalSeconds } = await player.me()
console.log({ entitled, totalSeconds })

Expected result

The player read uses INSPACY_ORIGIN, INSPACY_GAME_ID and INSPACY_ACCESS_TOKEN from a session for this game. Its result describes this player’s entitlement and accumulated playtime. Open the operation topics for write examples.

If something goes wrong

If a player read returns 401 or 403, check the token’s lifetime and that the game ID matches its session. Keep the publisher key on your backend and the reporter key on its named server.

Choose a language and run a player example

Use an SDK inside a game or on its server to work with a signed-in player. Pick your language to see the exact functions, installation instructions and examples shipped for that release.

Steps

  1. Choose a language tab and download the published package. Compare the file’s SHA-256 with the value beside the download, then follow Install the SDK in that tab.
  2. For your first session, open Sign in a player and follow the callback registration steps. For an existing session, set INSPACY_ORIGIN, INSPACY_GAME_ID and INSPACY_ACCESS_TOKEN to the API origin, numeric game ID and that game’s player token.
  3. Open Function reference. Run its player read in the project you installed, or run the player example supplied in the archive. Check the entitlement and total seconds for the signed-in player. A new player can have zero seconds.

Example

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "get_sdk_docs",
    "arguments": {}
  }
}

Expected result

All five language guides offer SDK 1.3.0 with paginated game friends for players and publisher backends.

If something goes wrong

For an unknown selector, return to the published language, version and topic index.

C# function referenceC function referenceC++ function referenceJavaScript function referenceRust function reference

Which client should make this call?

The runtime has three callers. A player signs in to a particular game. Your backend holds the game’s publisher key. Each dedicated server has a reporter key tied to that server. Use the function reference for the spelling in your language.

GET /api/store/game-runtime/v1/{gameId}/me
Player. Read the scoped player identifier (subject), entitlement, content and expansion IDs, beta, membership and total seconds.
GET /api/store/game-runtime/v1/{gameId}/me/beta
Player. Read the beta program, current state and expiry after a key is redeemed.
GET /api/store/game-runtime/v1/{gameId}/me/membership
Player. Read active, asOf and validUntil before offering a monthly benefit.
POST /api/store/game-runtime/v1/{gameId}/playtime/{sessionId}/events
Player. Record start, heartbeat and end for one session. The receipt gives the updated total and identifies preview play.
GET /api/store/game-access/v1/{gameId}/players/{subject}
Publisher backend. Look up access for the authenticated player using the game-scoped subject.
POST /api/store/achievements/v1/unlocks
Publisher backend. Report an achievement code for a player. A credential may be authorized to report for a delegated expansion.
POST /api/store/tickets/v1/redeem
Publisher backend. Redeem the packaged game’s one-use ticket to establish your own session. Inspect the returned game, build, subject and purpose.
POST /api/store/server-reports/v1/{gameId}/{serverId}
Dedicated server. Publish its online status, player count and optional capacity. The receipt identifies the generation and sequence accepted.
GET /api/store/game-runtime/v1/{gameId}/rankings
Player. List published categories for this game.
GET /api/store/game-runtime/v1/{gameId}/rankings/{category}/standings
Player. Page through standings using the returned cursor and read your own rank.
POST /api/store/rankings/v1/scores
Publisher backend with score permission. Submit one player’s integer score with its saved request UUID.
POST /api/moderation/game-reports/v1/{gameId}
Player. Report another player in this game with a saved request UUID.
POST /api/moderation/game-reports/v1/{gameId}/server
Publisher backend with report permission. Submit a game-conduct report and optional evidence.
GET /api/moderation/game-reports/v1/{gameId}/server/{reportId}
Publisher backend with report permission. Read the state and outcome of a report submitted by your game.
POST /api/store/game-bans/v1/{gameId}
Publisher backend with ban permission. Ban a player from this game with a saved command UUID.
GET /api/store/game-access/v1/{gameId}/players/{subject}/ban
Publisher backend. Check the player’s current ban when starting a session and at least every five minutes.
Configure Windows ownership and sign-in

Sign in from a browser or standalone game

Register a public client for this game, then use the player’s system browser and S256 PKCE.

Before you start

  • Register the exact HTTPS callback in the game credential settings. For the runnable native sample, register http://127.0.0.1:48241/inspacy/callback and copy the new public client ID.

Steps

  1. Generate fresh state and a PKCE verifier for each attempt. Open the issuer’s /connect/authorize with response_type=code, scope=openid game.player and the S256 challenge. Browser clients use their own registered HTTPS callback.
  2. Compare the returned state, then post the code, verifier, client ID and original callback to /connect/token. Send the access token to this game’s runtime /me route. The sample keeps tokens in memory.
  3. Read expansionGameIds, betaAccess, membership and totalSeconds. A publisher service resolves the pairwise subject for that game. The dedicated server has its own separate reporting credential.

Example

python game-session.py --origin "$INSPACY_API_ORIGIN" --client "$GAME_CLIENT_ID" --game 42

Expected result

The response contains this game’s decisions for the signed-in player. An empty collection of expansions is valid.

If something goes wrong

After a callback change, revoked authorization, spent code or mismatched audience, start a new authorization with the current client ID.

Download game-session.py

Report a dedicated server’s status

Players can see the status and current player count of named servers on the game page.

Before you start

  • Create an active server record and issue its reporter credential from the game’s settings. Keep the secret on that server.

Steps

  1. Send an initial observation on startup. Use a persisted increasing generation for each process restart and increase the sequence within that generation.
  2. Send fresh online observations while running. When possible send one final offline observation. Retry a lost response with the identical generation and sequence.

Example

curl --fail-with-body -X POST "$INSPACY_API_ORIGIN/api/store/server-reports/v1/42/7" -H "X-Api-Key: $SERVER_REPORTER_KEY" -H "Content-Type: application/json" --data '{"generation":1,"sequence":0,"online":true,"players":0,"capacity":24}'

Expected result

A fresh online report can show zero players. After 90 seconds without a fresh observation the listing shows a stale status.

If something goes wrong

On 429 honor Retry-After. When a key is rotated, install the replacement on its assigned server.

Submit scores and read standings

List the published categories with a game player session. Set INSPACY_RANKING_CATEGORY to a category code. The standings include the player’s own place, even outside the current page. Private profiles have no public name. A tie shares a rank.

Steps

  1. In the publisher’s game editor, publish a category and issue a backend credential with score permission.
  2. Submit a score from the backend example, then use the player example to read the same category.

Example

inspacy docs sdk --language javascript --version 1.3.0 --topic rankings --locale en

Expected result

Select your language for its sample commands and function names.

If something goes wrong

On your backend, set INSPACY_PUBLISHER_KEY to a game credential with score permission, INSPACY_SUBJECT to the retail player subject, INSPACY_SCORE to the integer score and INSPACY_REQUEST_ID to a UUID saved with this submission. The receipt gives the best score. Retry a lost response with identical values and UUID. A changed submission under that UUID returns 409.

Report a player

Set INSPACY_REPORTED_SUBJECT to another player’s retail subject for this game and INSPACY_REQUEST_ID to a saved UUID. The game player session identifies the reporter. The receipt gives an opaque report ID and its state. A backend with report permission can also submit evidence and check its own case by INSPACY_REPORT_ID.

Steps

  1. Sign in through the game client and run the player report example with a second participant’s retail subject.
  2. For a server-originated case, run the publisher report example with report permission. Save its receipt and request the status with the same game credential.

Example

inspacy docs sdk --language javascript --version 1.3.0 --topic reports --locale en

Expected result

Select your language for its sample commands and function names.

If something goes wrong

Set INSPACY_REPORT_REASON to the applicable reason and supply INSPACY_REPORT_EXPLANATION for other. Retry identical inputs after an uncertain response. Respect Retry-After on 429. If the store returns moderation_unavailable, use the support channel in the store.

Manage game bans

Run the publisher example on your server with a game credential that has ban permission. Set INSPACY_SUBJECT, your own INSPACY_BAN_REASON and a saved UUID in INSPACY_COMMAND_ID. The ban applies only to this player in this game. Only Inspacy staff may remove it. Players can contest it through their account.

Steps

  1. Issue a game credential with ban permission and store it on your backend.
  2. Run the ban example with your own reason code. Read player-ban again after staff have reviewed a removal request.

Example

inspacy docs sdk --language javascript --version 1.3.0 --topic game-bans --locale en

Expected result

Select your language for its sample commands and function names.

If something goes wrong

After a lost reply, repeat the same command with the original ID. Check player-ban when starting each server session and at least every five minutes thereafter. An active ban returns game_banned at store enforcement points. A replay after staff removal returns the removed state.

Independent game store

Extraordinary worlds.
A place to make them yours.

© 2026 Inspacy.GameStore

Looking for your next adventure?

Explore new worlds and keep your favorites close.