> For the complete documentation index, see [llms.txt](https://developers.klasha.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.klasha.com/~/revisions/LgPYv1wt83TA5LzyGVuI/bank-account-collection/va-balance-and-statement.md).

# VA balance and statement

### Summary

These APIs give Klasha’s merchants the ability to retrieve the balance of their Virtual Account as well as the statement of their transactions.

{% hint style="info" %}
&#x20;**Before you begin!**

* [Link](https://api.postman.com/collections/25963887-e69fa4f5-9279-418c-b6a4-80eeb9fbe97a?access_key=PMAT-01HG0E31P1RFBBTX05ZBW59CT6) to the Postman collection
* Find your keys on the Klasha Dashboard → Settings → Generate API Keys ([here](https://dashboard.klasha.com/settings/keys)).&#x20;
* Klasha Dashboard, Generate API Keys page

<img src="https://257545343-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNw4nU37LIEg41plxXG5u%2Fuploads%2FvBXI8QATrncq17zlRm1P%2Fdashboad-klasha-settings.png?alt=media&amp;token=1ebaf2b3-7e99-4490-9ede-a660c8d0035c" alt="" data-size="original">
{% endhint %}

### API specifications

**Generate a bearer token**

Using the token generation [endpoint](https://developers.klasha.com/~/revisions/LgPYv1wt83TA5LzyGVuI/overview/token-generation), the token can be obtained from the headers under the header name: token.

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| {{token}}<mark style="color:red;">\*</mark> | String | token       |

**Get Virtual Account Balance**

## Get Virtual Account Balance

<mark style="color:blue;">`GET`</mark> `{{env_url}}/nucleus/virtual/account/collections/business/`

You’d need to pass the merchant public key in the header as the x-auth-token. This can be obtained from your merchant dashboard → Settings → Generate API keys → Merchant public key.

#### Headers

| Name                                           | Type   | Description         |
| ---------------------------------------------- | ------ | ------------------- |
| x-auth-token<mark style="color:red;">\*</mark> | String | merchant public key |

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

```json
{
    "message": "success",
    "error": null,
    "data": {
        "virtualAccountCollectionSettlement": 100.00,
        "virtualAccountCollectionsBalance": 200.00
    }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
    "message": "A human readable error message",
    "error": "Bad Request",
    "data": null
}
```

{% endtab %}
{% endtabs %}

**Retrieve Transaction Statements**

## Retrieve Transaction Statements

<mark style="color:green;">`POST`</mark> `{{env_url}}/nucleus/tnx/paginated/filter/v2`

You will need to pass the merchant public key in the header as the x-auth-token. This can be obtained from your merchant dashboard → Settings → Generate API keys → Merchant public key.

You can get all your transactions by passing an empty body, or you can pass a body with any combination of the following 3 filters (all of them or just 1 or 2)

#### Headers

| Name                                           | Type   | Description         |
| ---------------------------------------------- | ------ | ------------------- |
| x-auth-token<mark style="color:red;">\*</mark> | String | merchant public key |

#### Request Body

| Name     | Type   | Description                                  |
| -------- | ------ | -------------------------------------------- |
| currency | String | NGN                                          |
| status   | String | failed                                       |
| tnxRef   | String | paylink-8e3172ac-4cb4-422f-a805-9a571f236939 |

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

```json
{
  "message": "success",
  "error": null,
  "data": {
    "pageNo": 1,
    "totalPages": 1,
    "totalCount": 1,
    "transactions": [
      {
        "transaction": {
          "status": "successful",
          "virtualAccountNumber": "000000001",
          "email": "email@email.com",
          "currency": "NGN",
          "tnxRef": "reference",
          "sourceCurrency": "NGN",
          "paymentType": "paymentType",
          "channel": "channel",
	  "previousBalance": 1003.02,
          "amountCredited": 100.00,
          "amountCollected": 200.00,
          "newBalance": 1103.02,
          "settledCurrency": "NGN",
          "createdAt": "2023-01-01 01:01:00",
          "payerDetails": {
            "bank": "bank name",
            "accountName": "account name",
            "accountNumber": "0000000022"
          }
        }
      },
    ]
  }
}     
```

{% endtab %}
{% endtabs %}
