> For the complete documentation index, see [llms.txt](https://scorpioplay.gitbook.io/scorpio-play-casino-api-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scorpioplay.gitbook.io/scorpio-play-casino-api-doc/api-reference/images-and-media/balance.md).

# Balance

Our API will send this callback request when a player launches or enters games or every minute during gameplay to update the user's balance. You are required to verify whether the player's session is still active and authenticated before processing the request.

<table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>URL</td><td>{operatorCallbackURL}</td></tr><tr><td>Method</td><td>POST</td></tr><tr><td>Headers</td><td>X-Request-Signature<br>Content-Type<br>Accept</td></tr><tr><td>Request Body</td><td><pre class="language-json"><code class="lang-json">{
   command: "balance",
   playerId: "1101",
   currency: "EUR",
   timestamp: 1586335186372
}
</code></pre></td></tr><tr><td>Response Body</td><td><pre class="language-json"><code class="lang-json">{
   balance: 1501.52,
   statusCode: "OK"
}
</code></pre></td></tr></tbody></table>

## Request

<table><thead><tr><th width="146">Parameter</th><th width="107">Values</th><th width="104">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><strong>command</strong></td><td>string</td><td>Y</td><td>Indicates the request type.</td></tr><tr><td><strong>playerId</strong></td><td>string</td><td>Y</td><td>Unique identifier of the player from the operator's<br>system.</td></tr><tr><td><strong>currency</strong></td><td>string</td><td>Y</td><td>Player currency, according to ISO-4217 (EUR, USD ...)</td></tr><tr><td><strong>timestamp</strong></td><td>number</td><td>Y</td><td>Timestamp of the request.</td></tr></tbody></table>

## Response

<table><thead><tr><th width="146">Parameter</th><th width="107">Values</th><th width="104">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td><strong>balance</strong></td><td>number</td><td>N</td><td>Player balance.</td></tr><tr><td><strong>statusCode</strong></td><td>string</td><td>Y</td><td>Status code of the execution.</td></tr></tbody></table>

## Possible Status Codes

| Status codes                                   | Reason                                            |
| ---------------------------------------------- | ------------------------------------------------- |
| OK                                             | Request successful                                |
| ERR\_INVALID\_ACCOUNT                          | <p>In case the player currency does not match the |
| <br>provided currency code in the request.</p> |                                                   |
| ERR\_NOT\_AUTHENTICATED                        | Player is not authenticated                       |
| ERR\_INVALID\_PLAYER\_ID                       | Invalid player ID                                 |
| ERR\_INTEGRITY\_CHECK\_FAILED                  | Message integrity check failed.                   |
| ERR\_UNKNOWN                                   | Internal server error                             |

In case `statusCode` is different than "OK", the request will be treated as unsuccessful. Request retry schedule will not be created for any type of error. Current process flow will be terminated with an error message presented to the player.

## Example

### Request

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "command": "balance",
    "playerId": "1101",
    "currency": "EUR",
    "timestamp": 1586335186372
}
</code></pre>

### OK Response

<pre class="language-json"><code class="lang-json">{
<strong>    "balance": 19839891,
</strong>    "statusCode": "OK"
}
</code></pre>

### Error Response

```json
{
    "statusCode": "ERR_INVALID_ACCOUNT"
}
```
