> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hub2.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Balances

The accounts balances are available at any time using the HUB2 API.

<Info>
  Please check the endpoint in the [API reference](/api-reference/balance/check-merchant-balance).
</Info>

# Request

Here is a sample of a request to that endpoint :

<CodeGroup>
  ```bash Curl theme={null}
  curl --location --request GET 'https://api.hub2.io/balance?currency=XOF&date=2023-10-01T00:00:00.000Z' \
  --header 'ApiKey: [REDACTED]' \
  --header 'MerchantId: [REDACTED]' \
  --header 'Environment: sandbox' \
  ```

  ```typescript Typescript theme={null}
  import fetch from 'node-fetch';

  async function getBalance() {
      const response = await fetch('https://api.hub2.io/balance?currency=XOF&date=2023-10-01T00:00:00.000Z', {
          method: 'GET',
          headers: {
              'ApiKey': '[REDACTED]',
              'MerchantId': '[REDACTED]',
              'Environment': 'sandbox'
          }
      });

      if (response.ok) {
          const result = await response.json();
          console.log(result);
      } else {
          console.log(`HTTP Status: ${response.status}`);
      }
  }

  getBalance();
  ```

  ```python Python theme={null}
  import requests

  url = 'https://api.hub2.io/balance?currency=XOF&date=2023-10-01T00:00:00.000Z'

  headers = {
      'ApiKey': '[REDACTED]',
      'MerchantId': '[REDACTED]',
      'Environment': 'sandbox',
  }

  response = requests.get(url, headers=headers)

  if response.status_code == 200:
      print(response.json())
  else:
      print(f'HTTP Status: {response.status_code}')
  ```
</CodeGroup>

Please note the following parameters :

* Parameter `currency` : identify the currency to fetch, here the value is `XOF`
* Parameter `date` : identify the date for which the balance will be fetched, here the value is `2023-10-01T00:00:00.000Z`, default value is now if the field is missing

# Response

Here is a sample of the response in JSON format :

```json theme={null}
{
  "collectionAccount": [
    {
      "amount": 100,
      "availableBalance": 100,
      "currency": "XOF",
      "date": "2023-10-01T00:00:00.000Z"
    }
  ],
  "transferAccount": [
    {
      "availableBalance": 100,
      "reservedBalance": 100,
      "currency": "XOF",
      "date": "2023-10-01T00:00:00.000Z",
      "amount": 100
    }
  ]
}
```
