# 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.

### API specifications

**Before you begin!**

{% stepper %}
{% step %}
**Generate a bearer token**

Use the token request [endpoint](https://developers.klasha.com/~/revisions/LgPYv1wt83TA5LzyGVuI/overview/token-generation) to generate a bearer token and pass in the header of the api calls below.
{% endstep %}

{% step %}
**Retrieve your merchant public key**

Find your keys on the Klasha dashboard → Settings → Generate API keys → Merchant public key (as shown below).&#x20;

<img src="/files/LFFicElNA6dWGpxBEdo1" alt="" data-size="original">
{% endstep %}
{% endstepper %}

## Get Virtual Account Balance

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

NB: You’d need to pass your merchant public key in the header as the x-auth-token and bearer token as the Authorization.

#### Headers

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

{% 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

> <mark style="color:yellow;">**POST**</mark> - <mark style="color:$primary;">`{{env_url}}/nucleus/tnx/paginated/filter/v2`</mark>

NB: You’d need to pass the merchant public key in the header as the x-auth-token.

#### Headers

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

#### Request Body

* The request body can be a combination of the filters below (all or just 1 or 2)
* When you send an empty request body, you get all your transactions.

| Name     | Type   | Description                  |
| -------- | ------ | ---------------------------- |
| currency | String | transaction currency         |
| status   | String | transaction status           |
| tnxRef   | String | unique transaction reference |

{% tabs %}
{% tab title="200: OK " %}
{% code overflow="wrap" %}

```json
{
    "message": "success",
    "error": null,
    "data": {
        "pageNo": 1,
        "totalPages": 1,
        "totalCount": 1,
        "transactions": [
            {
                "transaction": {
                    "status": "successful",
                    "virtualAccountNumber": "000000001",
                    "email": "tester@email.com",
                    "currency": "NGN",
                    "tnxRef": "e7ef0a9a-8898-4850-9290-2b28ece057fe",
                    "sourceCurrency": "NGN",
                    "paymentType": "BANK_TRANSFER",
                    "channel": "woo",
                    "previousBalance": 1003.02,
                    "amountCredited": 100,
                    "amountCollected": 200,
                    "newBalance": 1103.02,
                    "settledCurrency": "NGN",
                    "createdAt": "2023-01-01 01:01:00",
                    "payerDetails": {
                        "bank": "Wema Bank",
                        "accountName": "Tester Demo",
                        "accountNumber": "0000000022"
                    }
                }
            }
        ]
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.klasha.com/bank-account-collection/va-balance-and-statement.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
