# Account

### `https://`quaiscan.io`/api?module=account`

## Return balance from a provided block

`quai_get_balance`

Mimics Quai Network JSON RPC's quai\_getBalance

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=quai_get_balance
   &address={addressHash}
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter    | Description                                                                                                                                                                                                                                                                                                                                                            |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **address**  | `string` containing the address hash.                                                                                                                                                                                                                                                                                                                                  |
| block        | <p><mark style="background-color:yellow;">optional</mark>. Block number as a string, or <code>latest</code>, <code>earliest</code> or <code>pending</code><br><br>Latest is the latest balance in a <em>consensus</em> block. Earliest is the first recorded balance for the address. Pending is the latest balance in a consensus <em>or</em> nonconsensus block.</p> |
| {% endtab %} |                                                                                                                                                                                                                                                                                                                                                                        |

{% tab title="Example Result" %}

```
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0234c8a3397aab58"
}
```

{% endtab %}
{% endtabs %}

## Get the Quai or Qi balance for an address

`balance`

Many chains use their own native tokens. On Quai Network, this will return the result in "Quai" or "Qi". Results are returned in its (quai) or qits (qi).

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=balance
   &address={addressHash}
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter    | Description                           |
| ------------ | ------------------------------------- |
| **address**  | `string` containing the address hash. |
| {% endtab %} |                                       |

{% tab title="Example Result" %}

```json
{
	"message": "OK",
	"result": "663046792267785498951364",
	"status": "1"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Also available through a GraphQL `address` query.
{% endhint %}

{% hint style="info" %}
If the balance hasn't been updated recently, the node is double-checked to fetch the absolute latest balance. This will not be reflected in the current request, but once it is updated, subsequent requests will show the updated balance. If you want to know if there is a check for another balance, use the `balancemulti` action. That contains a property called `stale` that will let you know to recheck that balance in the near future.
{% endhint %}

## Get balance for multiple addresses

`balancemulti`

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=balancemulti
   &address={addressHash1,addressHash2,addressHash3}
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter    | Description                                                                  |
| ------------ | ---------------------------------------------------------------------------- |
| **address**  | `string` containing the address hash, comma separated. **Max 20 addresses.** |
| {% endtab %} |                                                                              |

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": [
    {
      "account": "0x00a3e45aa16163f2663015b6695894d918866d19",
      "balance": "40807168566070000000000",
      "stale": true
    },
    {
      "account": "0x00a3e45aa16163f2663015b6695894d918866d19",
      "balance": "332567136222827062478",
      "stale": false
    },
  ],
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Also available through a GraphQL 'addresses' query
{% endhint %}

{% hint style="info" %}
If the balance hasn't been updated in a long time, the node is double checked to fetch the absolute latest balance. This is not reflected in the current request, but once it is updated, subsequent requests will show the updated balance. The **`stale`** attribute will be set to **`true`** if a new balance is being fetched.
{% endhint %}

## Get pending transactions by address

`pendingtxlist`

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=pendingtxlist
   &address={addressHash}
   &page=1
   &offset=5
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter    | Description                                                                                                                                           |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **address**  | `string` containing the address hash.                                                                                                                 |
| page         | <mark style="background-color:yellow;">optional</mark> `integer` representing the page number used for pagination. 'offset' must also be provided.    |
| offset       | <mark style="background-color:yellow;">optional</mark> `integer` representing number of transactions returned per page. `page` must also be provided. |
| {% endtab %} |                                                                                                                                                       |

{% tab title="Example Result" %}

```

  "message": "OK",
  "result": [
    {
      "contractAddress": "",
      "cumulativeGasUsed": "122207",
      "from": "0x00a3e45aa16163f2663015b6695894d918866d19",
      "gas": "122261",
      "gasPrice": "50000000000",
      "gasUsed": "122207",
      "hash": "0x009c00e4f7345d600b0cfe0dd2b3a0101d5d6f9d0f644d4435057b39141a3bea",
      "input": "0x",
      "nonce": "0",
      "to": "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae",
      "value": "0x1"
    }
  ],
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

## Get transactions by address

`txlist`

Maximum of 10,000 transactions. Also available through a GraphQL 'address' query. For faster results, specify a smaller block range to search using the `startblock` and `endblock` parameters

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=txlist
   &address={addressHash}
   &startblock=555555
   &endblock=666666
   &page=1
   &offset=5
   &sort=asc
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter        | Description                                                                                                                                                                                                        |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **address**      | `string` containing the address hash.                                                                                                                                                                              |
| sort             | <mark style="background-color:yellow;">optional</mark> sorting preference, `asc` for ascending and `desc` for descending. Descending is default.                                                                   |
| startblock       | <mark style="background-color:yellow;">optional</mark> `integer` block number to start transaction search                                                                                                          |
| endblock         | <mark style="background-color:yellow;">optional</mark>`integer` block number to stop transaction search.                                                                                                           |
| page             | <mark style="background-color:yellow;">optional</mark> `integer` representing the page number used for pagination. `offset` must also be provided.                                                                 |
| offset           | <mark style="background-color:yellow;">optional</mark> `integer` representing number of transactions returned per page. `page` must also be provided.                                                              |
| filter\_by       | <mark style="background-color:yellow;">optional</mark> string representing the field to filter by. Values include `to` and `from`. If none provided returns transactions that match to, from, or contract address. |
| start\_timestamp | <mark style="background-color:yellow;">optional</mark> starting block unix timestamp.                                                                                                                              |
| end\_timestamp   | <mark style="background-color:yellow;">optional</mark> ending block unix timestamp.                                                                                                                                |
| {% endtab %}     |                                                                                                                                                                                                                    |

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": [
    {
      "blockHash": "0x0000063bc2cbf2eefcb5af1b8db967de70c15401f191f4d53ff6057bc48a20c2",
      "blockNumber": "0x8b62",
      "contractAddress": null,
      "cumulativeGasUsed": "0x0",
      "effectiveGasPrice": "0x0",
      "etxs": null,
      "from": "0x00a3e45aa16163f2663015b6695894d918866d19",
      "gasUsed": "0x0",
      "logs": [],
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "status": "0x0",
      "to": "0x00a3e45aa16163f2663015b6695894d918866d19",
      "transactionHash": "0x009c00e4f7345d600b0cfe0dd2b3a0101d5d6f9d0f644d4435057b39141a3bea",
      "transactionIndex": "0x12",
      "type": "0x1"
    }
  ],
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

## Get internal transactions by transaction or address hash

`txlistinternal`

Up to a maximum of 10,000 internal transactions. Also available through a GraphQL 'transaction' query. For faster results, specify a smaller block range to search using the start\_block and end\_block parameters.

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=txlistinternal
   &txhash={transactionHash}
   &startblock=555555
   &endblock=666666
   &page=1
   &offset=5
   &sort=asc
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter    | Description                                                                                                                                                                                        |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **txhash**   | `string` representing the transaction hash to check for internal transactions                                                                                                                      |
| address      | <mark style="background-color:yellow;">optional</mark> `string` containing the address hash.                                                                                                       |
| sort         | <mark style="background-color:yellow;">optional</mark> sorting preference, `asc` for ascending and `desc` for descending. Descending is default. **Only available if 'address' is provided.**      |
| startblock   | <mark style="background-color:yellow;">optional</mark> `integer` block number to start transaction search. **Only available if 'address' is provided.**                                            |
| endblock     | <mark style="background-color:yellow;">optional</mark>`integer` block number to stop transaction search. **Only available if 'address' is provided.**                                              |
| page         | <mark style="background-color:yellow;">optional</mark> `integer` representing the page number used for pagination. `offset` must also be provided. **Only available if 'address' is provided.**    |
| offset       | <mark style="background-color:yellow;">optional</mark> `integer` representing number of transactions returned per page. `page` must also be provided. **Only available if 'address' is provided.** |
| {% endtab %} |                                                                                                                                                                                                    |

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": [
    {
      "blockNumber": "6153702",
      "callType": "delegatecall",
      "contractAddress": "0x883103875d905c11f9ac7dacbfc16deb39655361",
      "errCode": "",
      "from": "0x2ca1e3f250f56f1761b9a52bc42db53986085eff",
      "gas": "814937",
      "gasUsed": "536262",
      "index": "0",
      "input": "",
      "isError": "0",
      "timeStamp": "1534362606",
      "to": "",
      "transactionHash": "0xd65b788c610949704a5f9aac2228c7c777434dfe11c863a12306f57fcbd8cdbb",
      "type": "call",
      "value": "5488334153118633"
    }
  ],
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

## Get token transfer events by address

`tokentx`

Up to a maximum of 10,000 token transfer events. Also available through the GraphQL `token_transfers` query.

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=tokentx
   &address={addressHash}
   &page=1
   &offset=10
   &sort=asc
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter        | Description                                                                                                                                           |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **address**      | `string` containing the address hash.                                                                                                                 |
| contract address | <mark style="background-color:yellow;">optional</mark> `string` with the token contract address to identify a contract.                               |
| sort             | <mark style="background-color:yellow;">optional</mark> sorting preference, `asc` for ascending and `desc` for descending. Descending is default.      |
| startblock       | <mark style="background-color:yellow;">optional</mark> `integer` block number to start transaction search                                             |
| endblock         | <mark style="background-color:yellow;">optional</mark>`integer` block number to stop transaction search.                                              |
| page             | <mark style="background-color:yellow;">optional</mark> `integer` representing the page number used for pagination. `offset` must also be provided.    |
| offset           | <mark style="background-color:yellow;">optional</mark> `integer` representing number of transactions returned per page. `page` must also be provided. |
| {% endtab %}     |                                                                                                                                                       |

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": [
    {
      "blockHash": "0x6169c5dc05d0051564ba3eae8ebfbdefda640c5f5ffc095846b8aed0b44f64ea",
      "blockNumber": "5997843",
      "confirmations": "199384",
      "contractAddress": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
      "cumulativeGasUsed": "1043649",
      "from": "0x4e83362442b8d1bec281594cea3050c8eb01311c",
      "gas": "44758",
      "gasPrice": "7000000000",
      "gasUsed": "37298",
      "hash": "0xd65b788c610949704a5f9aac2228c7c777434dfe11c863a12306f57fcbd8cdbb",
      "input": "0xa9059cbb00000000000000000000000021e21ba085289f81a86921de890eed30f1ad23750000000000000000000000000000000000000000000000008ac7230489e80000",
      "logIndex": "0",
      "nonce": "765",
      "timeStamp": "1532086946",
      "to": "0x21e21ba085289f81a86921de890eed30f1ad2375",
      "tokenDecimal": "18",
      "tokenName": "Maker",
      "tokenSymbol": "MKR",
      "transactionIndex": "27",
      "value": "10000000000000000000"
    }
  ],
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

## Get ERC-721 token transfer events by address

`tokennfttx`

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=tokennfttx
   &address={addressHash}
   &page=1
   &offset=10
   &sort=asc
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter       | Description                                                                                                                                           |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **address**     | `string` containing the address hash.                                                                                                                 |
| contractaddress | <mark style="background-color:yellow;">optional</mark> `string` with the token contract address to identify a contract.                               |
| sort            | <mark style="background-color:yellow;">optional</mark> sorting preference, `asc` for ascending and `desc` for descending. Descending is default.      |
| startblock      | <mark style="background-color:yellow;">optional</mark> `integer` block number to start transaction search                                             |
| endblock        | <mark style="background-color:yellow;">optional</mark> `integer` block number to stop transaction search.                                             |
| page            | <mark style="background-color:yellow;">optional</mark> `integer` representing the page number used for pagination. `offset` must also be provided.    |
| offset          | <mark style="background-color:yellow;">optional</mark> `integer` representing number of transactions returned per page. `page` must also be provided. |
| {% endtab %}    |                                                                                                                                                       |

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": [
    {
      "blockHash": "0x3b8e5e9ecb0ad53e58cd99182de99a1166946dc758b85a5529710bd47e35a49d",
      "blockNumber": "8879951",
      "confirmations": "1295191",
      "contractAddress": "0xe0617cd5b8271070b68bfc275220ef5dd32b8f58",
      "cumulativeGasUsed": "15289706",
      "from": "0x0000000000000000000000000000000000000000",
      "gas": "59636",
      "gasPrice": "1503183880",
      "gasUsed": "59636",
      "hash": "0x844ddc178dbeed48c9caef9a71a86b2d017529c1074a0390d2a61d29baa94c94",
      "input": "deprecated",
      "logIndex": "83",
      "nonce": "301",
      "timeStamp": "1682283420",
      "to": "0x34aa3f359a9d614239015126635ce7732c18fdf3",
      "tokenDecimal": "0",
      "tokenID": "2",
      "tokenName": "YourMintableSoulboundCollectible",
      "tokenSymbol": "YMSC",
      "transactionIndex": "42"
    }
  ],
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

Usage:

* To fetch ERC-721 token transfers by address, specify `address` parameter
* To fetch ERC-721 token transfers by token, specify `contractaddress` parameter
* To fetch ERC-721 token transfers by address filtered by token, specify both `address` and `contractaddress` parameters

## Get token account balance for token contract address

`tokenbalance`

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=tokenbalance
   &contractaddress={contractAddressHash}
   &address={addressHash}
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter            | Description                                                           |
| -------------------- | --------------------------------------------------------------------- |
| **contract address** | `string` containing the contract address hash.                        |
| **address**          | `string` containing the account address hash to retrieve balance for. |
| {% endtab %}         |                                                                       |

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": "135499",
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

## Get list of tokens owned by address

`tokenlist`

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=tokenlist
   &address={addressHash}
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter    | Description                                   |
| ------------ | --------------------------------------------- |
| **address**  | `string` containing the account address hash. |
| {% endtab %} |                                               |

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": [
    {
      "balance": "135499",
      "contractAddress": "0x0000000000000000000000000000000000000000",
      "decimals": "18",
      "name": "Example Token",
      "symbol": "ET",
      "type": "ERC-20"
    },
    {
      "balance": "1",
      "contractAddress": "0x0000000000000000000000000000000000000001",
      "decimals": "18",
      "name": "Example ERC-721 Token",
      "symbol": "ET7",
      "type": "ERC-721"
    }
  ],
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

## Get list of blocks mined by address

`getminedblocks`

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=getminedblocks
   &address={addressHash}
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter    | Description                                                                                                                                           |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **address**  | `string` containing the address hash.                                                                                                                 |
| page         | <mark style="background-color:yellow;">optional</mark> `integer` representing the page number used for pagination. 'offset' must also be provided.    |
| offset       | <mark style="background-color:yellow;">optional</mark> `integer` representing number of transactions returned per page. `page` must also be provided. |
| {% endtab %} |                                                                                                                                                       |

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": [
    {
      "blockNumber": "3462296",
      "blockReward": "5194770940000000000",
      "timeStamp": "1491118514"
    }
  ],
  "status": "1"
}
```

{% endtab %}
{% endtabs %}

## Get a list of accounts and their balances

`listaccounts`

Lists accounts and native balances, sorted ascending by the time they were first seen by the explorer.

**Example:**

```
https://quaiscan.io/api
   ?module=account
   &action=listaccounts
   &address={addressHash}
   &page=1
   &offset=3
```

{% tabs %}
{% tab title="Request Params" %}

| Parameter | Description                                                                                                                                           |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| page      | <mark style="background-color:yellow;">optional</mark> `integer` representing the page number used for pagination. 'offset' must also be provided.    |
| offset    | <mark style="background-color:yellow;">optional</mark> `integer` representing number of transactions returned per page. `page` must also be provided. |

{% hint style="info" %}
If the balance hasn't been updated in a long time, the node is double checked to fetch the absolute latest balance. This is not reflected in the current request, but once it is updated, subsequent requests will show the updated balance. The **`stale`** attribute will be set to **`true`** if a new balance is being fetched.
{% endhint %}
{% endtab %}

{% tab title="Example Result" %}

```
{
  "message": "OK",
  "result": [
    {
      "address": "0x00a3e45aa16163f2663015b6695894d918866d19",
      "balance": "3790064387342000000",
      "stale": false
    },
    {
      "address": "0x00a3e45aa16163f2663015b6695894d918866d19",
      "balance": "2047176464264000000",
      "stale": false
    },
  ],
  "status": "1"
}
```

{% 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://docs.quaiscan.io/developer-support/api/rpc-endpoints/account.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.
