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"
}

Request Fields

FieldTypeDescription
clientSessionIdstringThe player's session identifier
clientPlayerIdstringThe player's unique identifier
requestIdstringUnique request identifier (UUID)

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
balanceintegerBalance with 5-digit precision ($10.00 = 1000000)

Error Response

HTTP/1.1 401 Unauthorized
X-Marbles-Signature: <signature>
Content-Type: application/json

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

Error Statuses

StatusHTTP CodeDescription
SESSION_EXPIRED_ERROR400Player session has expired
PLAYER_NOT_FOUND_ERROR404Player does not exist
SESSION_NOT_FOUND_ERROR404Session does not exist

On this page