# Transaction API

## Get User Balance

<mark style="color:blue;">`GET`</mark> `https://api.aquanow.io/users/v1/userbalance`

Get user balances by symbol.

#### Query Parameters

| Name                                     | Type   | Description                                                                                                                  |
| ---------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| symbol<mark style="color:red;">\*</mark> | string | Fetches the user balance for the symbol provided. If symbol is not specified in query parameters, it fetch all user balances |

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

```javascript
// https://api.aquanow.io/users/v1/userbalance?symbol=BTC
{
  "pendingTransfer": 0,
  "totalBalance": 0.00500797,
  "availableBalance": 0.00500797,
  "symbol": "BTC",
  "updatedAt": 1569964868574,
  "depositAddress": "-"
}
```

{% endtab %}
{% endtabs %}

## Get Transactions

<mark style="color:blue;">`GET`</mark> `https://api.aquanow.io/accounts/v1/transaction`

GET transaction records using one of the query parameters below.

#### Query Parameters

| Name            | Type   | Description                                                                                                                |
| --------------- | ------ | -------------------------------------------------------------------------------------------------------------------------- |
| startTime       | number | timestamp in `ms`, MUST be sent with endTime.                                                                              |
| endTime         | number | timestamp in `ms`, MUST be sent with startTime.                                                                            |
| address         | string | Specify the address to grab transactions associated with the address. You can optionally add startTime and endTime as well |
| txId            | string | GET single transaction via txId                                                                                            |
| txHash          | string | query all transactions with the same txHash                                                                                |
| transactionType | enum   | `DEPOSIT`, `WITHDRAW` or `CONVERSION`                                                                                      |
| limit           | number | default: `100`; max: `1000`                                                                                                |

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

```javascript
[
    {
        "quantity": 100,
        "isAutopilotAddress": false,
        "bankInfo": {
            "symbol": "CAD",
            "institutionNumber": "in",
            "beneficiaryName": "bn",
            "transitNumber": "tn",
            "verified": true,
            "swiftCode": "sw",
            "bankName": "bn",
            "label": "cadWithdrawTest",
            "accountNumber": "an",
            "beneficiaryAddress": "ba",
            "bankAddress": "ba"
        },
        "txId": "05468a4c-1c88-4b7e-ae96-9a216030d7c8",
        "symbol": "CAD",
        "createdAt": 1663620355631,
        "address": "-",
        "transactionType": "WITHDRAW",
        "freeOrNot": true,
        "updatedAt": 1663620355631,
        "networkFee": 0,
        "username": "jeffen",
        "itemDateTime": 1663620355630,
        "adminApproval": "PROCESSING"
    }
]
```

{% endtab %}
{% endtabs %}

## Create Withdrawal

<mark style="color:green;">`POST`</mark> `https://api.aquanow.io/accounts/v1/transaction`

A transaction of transferring crypto or fiat from Aquanow to an external address (a wallet, an exchange, or a bank account).

#### Request Body

| Name                                              | Type            | Description                                                                                                                       |
| ------------------------------------------------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| symbol<mark style="color:red;">\*</mark>          | string          | Currency you wish to withdraw, in uppercase.                                                                                      |
| address<mark style="color:red;">\*</mark>         | string          | Address you wish to withdraw to for **crypto withdrawal**                                                                         |
| addressId                                         | string          | Banking information you are withdrawing to for **fiat withdrawal**. Only required if you have multiple banking information stored |
| quantity<mark style="color:red;">\*</mark>        | number          | Quantity you wish to withdraw. Must have sufficient funds to be able to withdraw.                                                 |
| transactionType<mark style="color:red;">\*</mark> | string          | Type of transaction. Currently only WITHDRAW is supported.                                                                        |
| networkType                                       | "eth" \| "tron" | Only required when you withdraw from USDT                                                                                         |

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

```javascript
{
    "itemDateTime": 1611713964494,
    "address": "CD7iJgfC1BF1a26LuTxAuQ35E5TSPsTsDr",
    "networkFeeAqua": 0,
    "quantity": 0.005,
    "bankInfo": {},
    "txId": "373a49c7-b829-43de-a4dd-5462723d63e3",
    "symbol": "BTC",
    "tag": "withdrawal_address",
    "username": "pratikstaging",
    "fullNodeEnabled": true,
    "networkFee": 0.0001,
    "freeOrNot": false,
    "transactionType": "WITHDRAW",
    "isAutopilotAddress": false,
    "adminApproval": "PROCESSING",
    "createdAt": 1611713964495,
    "updatedAt": 1611713964495
}
```

{% endtab %}
{% endtabs %}

## Get payouts & deposits

<mark style="color:blue;">`GET`</mark> `https://api.aquanow.io/payment/v1/payout`

Get withdrawals and non-payment deposits

#### Query Parameters

| Name                                        | Type   | Description                                                                    |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------ |
| startTime<mark style="color:red;">\*</mark> | number | Time in `ms`                                                                   |
| endTime                                     | number | Time in `ms`. Default to now.                                                  |
| txId                                        | string | Get single record by transaction id                                            |
| startsAfter                                 | string | Pagination token, only returns when there's more data available for the query. |

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

```javascript
{
    "data": [
        {
            "quantity": 20,
            "txId": "e7e234ee-4b53-405d-bcdf-d01c855cd1f1",
            "symbol": "USDT",
            "createdAt": 1662492193696,
            "username": "jeffen",
            "address": "0x3AD7847CfD5E9DB721E454c8D13506aBc294F642",
            "transactionType": "DEPOSIT",
            "adminApproval": "DONE"
        },
        {
            "quantity": 100,
            "txId": "22c78fd3-702a-4fa4-ac11-f5c616ccf9b5",
            "symbol": "USD",
            "createdAt": 1662591787879,
            "username": "jeffen",
            "transactionType": "DEPOSIT",
            "adminApproval": "DONE"
        }
    ],
    "pagination": {
        "startsAfter": "eyJ0eElkIjoiNTg2YjZiZWUtNjAzMy00OThjLTlkMzEtZjQyYTBmNTAzMDMxIn0="
    }
}
```

{% endtab %}
{% endtabs %}

### Transaction Response Fields

| Field Name         | Description                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| address            | The destination address of the transaction                                                                                                                                                                                                                                                                                                                                                                |
| adminApproval      | <p>Status of transaction. </p><p><strong>UNCONFIRMED:</strong> Tx detected but not yet deposited (as there is not enough confirmations</p><p><strong>PROCESSING:</strong> Tx is in transit and will be processed shortly</p><p><strong>REJECTED:</strong> Tx is deposited but not executed to fiat (for autopilot/aquapay transactions)</p><p><strong>DONE</strong>: Transaction has been processed. </p> |
| bankInfo           | If FIAT, bankInfo                                                                                                                                                                                                                                                                                                                                                                                         |
| createdAt          | Date Transaction was created in ms                                                                                                                                                                                                                                                                                                                                                                        |
| isAutopilotAddress | Whether or not this transaction is an autopilot (NOTE: Aquapay transactions are autopilot addresses)                                                                                                                                                                                                                                                                                                      |
| itemDateTime       | Date of transaction                                                                                                                                                                                                                                                                                                                                                                                       |
| networkFeeAqua     | Blockchain NetworkFee, if applicable                                                                                                                                                                                                                                                                                                                                                                      |
| quantity           | Size of transaction                                                                                                                                                                                                                                                                                                                                                                                       |
| symbol             | Currency symbol i.e BTC or USD                                                                                                                                                                                                                                                                                                                                                                            |
| tag                | Tag set by you to differentiate transactions                                                                                                                                                                                                                                                                                                                                                              |
| transactionType    | `WITHDRAW`, `DEPOSIT` or `CONVERSION`                                                                                                                                                                                                                                                                                                                                                                     |
| txId               | Uuid of transaction                                                                                                                                                                                                                                                                                                                                                                                       |
| updatedAt          | Date Transaction was last updated in ms                                                                                                                                                                                                                                                                                                                                                                   |
| username           | Username                                                                                                                                                                                                                                                                                                                                                                                                  |


---

# 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://docs.aquapay.io/api-endpoints/transaction-api.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.
