155API

Balance

Return the current player balance


We call this endpoint to retrieve the player's current balance. We never store player balances in our system.

The balance response should be in the correct currency for the player's session (identified by clientSessionId).

Endpoint

POST /balance

Request

POST /balance HTTP/1.1
Host: your.game.api
X-Marbles-Signature: <signature>
Content-Type: application/json

{
  "clientSessionId": "06mnrpyv2qd9jbwhoniyimxsy",
  "clientPlayerId": "02mnrpyv2qd9jbwhoniyimxsy",
  "requestId": "4ec4a295-cd84-46df-b225-4b72bd84892c",
  "timestamp": "2025-06-15T14:30:00.000Z"
}

Request Fields

FieldTypeDescription
clientSessionIdstringThe player's session identifier
clientPlayerIdstringThe player's unique identifier
requestIdstringUnique request identifier (UUID)
timestampstringISO 8601 UTC timestamp of when the request was created

Success Response

HTTP/1.1 200 OK
X-Marbles-Signature: <signature>
Content-Type: application/json

{
  "status": "SUCCESS",
  "requestId": "4ec4a295-cd84-46df-b225-4b72bd84892c",
  "clientPlayerId": "02mnrpyv2qd9jbwhoniyimxsy",
  "currency": "USD",
  "balance": 1000000
}

Response Fields

FieldTypeDescription
statusstring"SUCCESS"
requestIdstringEcho back the request ID
clientPlayerIdstringEcho back the player ID
currencystringISO 4217 currency code
balanceint64Balance with 5-digit precision ($10.00 = 1000000)

Error Response

HTTP/1.1 200 OK
X-Marbles-Signature: <signature>
Content-Type: application/json

{
  "status": "SESSION_EXPIRED_ERROR",
  "requestId": "4ec4a295-cd84-46df-b225-4b72bd84892c",
  "clientPlayerId": "02mnrpyv2qd9jbwhoniyimxsy"
}

Error Statuses

StatusDescription
SESSION_EXPIRED_ERRORPlayer session has expired
PLAYER_NOT_FOUND_ERRORPlayer does not exist
SESSION_NOT_FOUND_ERRORSession does not exist
UNKNOWN_ERRORAny other error

On this page