# Account Balance

This endpoint is used to get details about all wallets related to a user. The response contains a list of currencies with their corresponding amounts.

<mark style="color:green;">`POST`</mark> `https://api.oxapay.com/api/balance`

#### Request Body

<table><thead><tr><th width="122">Name</th><th width="100">Type</th><th width="530">Description</th></tr></thead><tbody><tr><td>key<mark style="color:red;">*</mark></td><td>string</td><td>Your payout API key for authentication and authorization.</td></tr><tr><td>currency</td><td>string</td><td>Specify a specific <a href="supported-currencies">currency</a> to get the balance for that currency. If not provided, the response will contain the balance for all available currencies.</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "result": integer, // The result code indicates the success or failure of the request.
  "message": string, // A message providing additional information about the result.
  "data": object array // An array of objects containing the balances for each currency. Each key is the currency symbol, and its value is the corresponding amount in that currency.
}
```

{% endtab %}
{% endtabs %}

Please note that the response will contain the balance for each currency as a string value. You may need to parse or convert these values to the appropriate data type based on your application's requirements.

Please note that a successful request will return a result code 100. In case of any issues or validation problems, refer to the corresponding [result codes](https://docs.oxapay.com/legacy/api-reference/result-code-table) for further details.

### Example codes

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.oxapay.com/api/balance \
     -d 'key=YOUR_PAYOUT_API_KEY'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://api.oxapay.com/api/balance';

$data = array(
    'key' => 'YOUR_PAYOUT_API_KEY'
);

$options = array(
    'http' => array(
        'header' => 'Content-Type: application/json',
        'method'  => 'POST',
        'content' => json_encode($data),
    ),
);

$context  = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response);
var_dump($result);
?>
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const axios = require('axios');
const url = 'https://api.oxapay.com/api/balance';
const data = JSON.stringify({
    key: 'YOUR_PAYOUT_API_KEY'
});

axios.post(url, data)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = 'https://api.oxapay.com/api/balance'
data = {
    'key': 'YOUR_PAYOUT_API_KEY'
}
response = requests.post(url, data=json.dumps(data))
result = response.json()
print(result)
```

{% endtab %}
{% endtabs %}

Now the API key is included in the request body, and you can proceed to use the appropriate code snippet based on your preferred programming language.
