> For the complete documentation index, see [llms.txt](https://docs.main.atgraphite.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.main.atgraphite.com/token.md).

# Tokens

## Get ERC20-Token Account Balance for TokenContractAddress

Returns the current balance of an ERC-20 token of an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenbalance
   &contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055
   &address=0xe04f27eb70e025b78871a2ad7eabe85e61212761
   &tag=0xde6cf2
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenbalance&contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055&address=0xe04f27eb70e025b78871a2ad7eabe85e61212761&tag=0xde6cf2&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                                                                                                  |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token                                                                                     |
| address\*         | the string representing the address to check for token balance                                                               |
| tag               | the string pre-defined block parameter, either `earliest`, `latest` or block number in hex format, default value is `latest` |

#### Sample response

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

## Get Historical ERC20-Token TotalSupply by ContractAddress & BlockNo `PRO`

Returns the amount of an ERC-20 token in circulation at a certain block height.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokensupplyhistory
   &contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055
   &blockno=8000000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokensupplyhistory&contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055&blockno=8000000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                    |
| ----------------- | ---------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token       |
| blockno\*         | the integer block number to check total supply |

#### Sample response

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

## Get Historical ERC20-Token Account Balance for TokenContractAddress by BlockNo `PRO`

Returns the balance of an ERC-20 token of an address at a certain block height.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenbalancehistory
   &contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055
   &address=0xe04f27eb70e025b78871a2ad7eabe85e61212761
   &blockno=8000000
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenbalancehistory&contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055&address=0xe04f27eb70e025b78871a2ad7eabe85e61212761&blockno=8000000&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                              |
| ----------------- | -------------------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token                 |
| address\*         | the string representing the address to check for balance |
| blockno\*         | the integer block number to check total supply           |

#### Sample response

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

## Get Token Holder List by Contract Address `PRO`

Return the current ERC20 token holders and number of tokens held.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenholderlist
   &contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenholderlist&contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                                                                                     |
| ----------------- | --------------------------------------------------------------------------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token                                                                        |
| offset            | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit             | the number of records displayed per page, default value is `10000`                                              |
| sort              | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "address": "0xf977814e90da44bfa03b6295a0616a897441acec",
            "balance": "13578034371767156",
            "holdingPercentage": "17.8900",
            "tokenDivisor": "6",
            "balanceUSD": "13575848308.2333"
        },
        {
            "address": "0x5a52e96bacdabb82fd05763e25335261b270efcb",
            "balance": "5261766805626635",
            "holdingPercentage": "6.9328",
            "tokenDivisor": "6",
            "balanceUSD": "5451725524.4802"
        }
    ]
}
```

## Get Number of Token Balances by Contract Address `PRO`

Returns the number of current token balance entries for the specified token.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenbalancescount
   &contractaddress=0xd766ea5e716bbbc8b7185d176def07124c7a89ec
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenbalancescount&contractaddress=0xd766ea5e716bbbc8b7185d176def07124c7a89ec&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                              |
| ----------------- | ---------------------------------------- |
| contractaddress\* | the contract address of the ERC-20 token |

#### Sample response

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

## Get Token Info by ContractAddress `PRO`

Returns project information and social media links of an ERC20/ERC721/ERC1155 token.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokeninfo
   &contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokeninfo&contractaddress=0xdac17f958d2ee523a2206206994597c13d831ec7&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter         | Description                                                             |
| ----------------- | ----------------------------------------------------------------------- |
| contractaddress\* | the contract address of the ERC-20/ERC-721 token to retrieve token info |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result":[
        {
            "circulatingMarketCapUSD": "83535944312.996231",
            "contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "divisor": "6",
            "holders": "4543145",
            "holdersChangePercent": "0.036765",
            "priceChangePercent": "-0.010285",
            "symbol": "USDT",
            "tokenName": "Tether USD",
            "tokenPriceUSD": "1.000193",
            "tokenType": "ERC20",
            "totalSupply": "39024700485595726",
            "transfers": "208569273",
            "volumeUSD": "18641246057.291306"
        }
    ]
}
```

## Get Token List `PRO`

Returns a list of tokens (ERC-20, ERC-721).

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenlist
   &marketonly=true
   &type=erc20
   &sortby=circulating_market_cap
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenlist&marketonly=true&type=erc20&sortby=circulating_market_cap&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                                         |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| marketonly | the boolean flag, `false` to include all tokens, `true` to include only those tokens that have market data, default value is `true` |
| type       | the string representing the token type, either `erc20`, `erc721` or `erc1155`                                                       |
| sortby     | the sorting preference, either `holders`, `price`, `change`, `circulating_market_cap` or `volume`                                   |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                                             |
| limit      | the number of records displayed per page, default value is `10000`                                                                  |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc`                     |

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "circulatingMarketCapUSD": "83535944312.996231",
            "contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "divisor": "6",
            "holders": "4543145",
            "holdersChangePercent": "0.036765",
            "priceChangePercent": "-0.010285",
            "symbol": "USDT",
            "tokenName": "Tether USD",
            "tokenPriceUSD": "1.000193",
            "tokenType": "ERC20",
            "totalSupply": "39024700485595726",
            "transfers": "208569273",
            "volumeUSD": "18641246057.291306"
        }
    ]
}
```

## Get the total number of tokens `PRO`

Returns the total number of tokens for a given token type.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokencount
   &marketonly=false
   &type=erc20
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokencount&marketonly=false&type=erc20&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                                         |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| marketonly | the boolean flag, `false` to include all tokens, `true` to include only those tokens that have market data, default value is `true` |
| type       | the string representing the token type, either `erc20`, `erc721` or `erc1155`                                                       |

#### Sample response

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

## Get Address ERC20 Token Holding `PRO`

Returns the ERC-20 tokens and amount held by an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=addresstokenbalance
   &address=0x983e3660c0bE01991785F80f266A84B911ab59b0
   &offset=0
   &limit=10
   &sort=desc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=addresstokenbalance&address=0x983e3660c0bE01991785F80f266A84B911ab59b0&offset=0&limit=10&sort=desc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                                                                                                                                |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| address\* | the string representing the address to check for balance                                                                                   |
| offset    | skips the `offset` records before beginning to return the records, default value is `0`                                                    |
| limit     | the number of records displayed per page, default value is `10000`                                                                         |
| sort      | the sorting preference by amount of tokens in usd, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result":[
        {
            "TokenAddress": "0xffffffff2ba8f66d4e51811c5190992176930278",
            "TokenName": "Furucombo",
            "TokenSymbol": "COMBO",
            "TokenQuantity": "1861606940000000000",
            "TokenDivisor": "18",
            "TokenPriceUSD": "0.002999"
        },
        {
            "TokenAddress": "0xb753428af26e81097e7fd17f40c88aaa3e04902c",
            "TokenName": "Spice",
            "TokenSymbol": "SFI",
            "TokenQuantity": "7",
            "TokenDivisor": "18",
            "TokenPriceUSD": null
        }
    ]
}
```

## Get the number of ERC20 holding tokens `PRO`

Returns the number of ERC-20 holding tokens by an address.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=addresstokencount
   &address=0x983e3660c0bE01991785F80f266A84B911ab59b0
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=addresstokencount&address=0x983e3660c0bE01991785F80f266A84B911ab59b0&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter | Description                         |
| --------- | ----------------------------------- |
| address\* | the string representing the address |

#### Sample response

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

## Get a list of 'ERC20 - Token Transfer Events' `PRO`

Returns the list of ERC-20 token transfers.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokentx
   &startblock=0
   &endblock=1000
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokentx&startblock=0&endblock=1000&offset=0&limit=10&sort=asc&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter  | Description                                                                                                     |
| ---------- | --------------------------------------------------------------------------------------------------------------- |
| startblock | the integer block number to start searching for transactions                                                    |
| endblock   | the integer block number to stop searching for transactions                                                     |
| offset     | skips the `offset` records before beginning to return the records, default value is `0`                         |
| limit      | the number of records displayed per page, default value is `10000`                                              |
| sort       | the sorting preference, use `asc` to sort by ascending and `desc` to sort by descending, default value is `asc` |

#### Sample response

```json
{
    "status":"1",
    "message":"OK",
    "result":[
        {
            "blockNumber":"4730207",
            "index": 0,
            "timeStamp":"1513240363",
            "hash":"0xe8c208398bd5ae8e4c237658580db56a2a94dfa0ca382c99b776fa6e7d31d5b4",
            "nonce":"406",
            "blockHash":"0x022c5e6a3d2487a8ccf8946a2ffb74938bf8e5c8a3f6d91b41c56378a96b5c37",
            "from":"0x642ae78fafbb8032da552d619ad43f1d81e4dd7c",
            "contractAddress":"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
            "to":"0x4e83362442b8d1bec281594cea3050c8eb01311c",
            "value":"5901522149285533025181",
            "tokenName":"Maker",
            "tokenSymbol":"MKR",
            "tokenDecimal":"18",
            "tokenPriceUSD": "1123.78",
            "transactionIndex":"81",
            "gas":"940000",
            "gasPrice":"32010000000",
            "gasUsed":"77759",
            "cumulativeGasUsed":"2523379",
            "input":"deprecated",
            "confirmations":"7968350",
            "methodId": "0xa9059cbb",
            "functionName": "transfer(address _to, uint256 _value)"
        },
        {
            "blockNumber":"4764973",
            "index": 0,
            "timeStamp":"1513764636",
            "hash":"0x9c82e89b7f6a4405d11c361adb6d808d27bcd9db3b04b3fb3bc05d182bbc5d6f",
            "nonce":"428",
            "blockHash":"0x87a4d04a6d8fce7a149e9dc528b88dc0c781a87456910c42984bdc15930a2cac",
            "from":"0x4e83362442b8d1bec281594cea3050c8eb01311c",
            "contractAddress":"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2",
            "to":"0x69076e44a9c70a67d5b79d95795aba299083c275",
            "value":"132520488141080",
            "tokenName":"Maker",
            "tokenSymbol":"MKR",
            "tokenDecimal":"18",
            "tokenPriceUSD": "1123.78",
            "transactionIndex":"167",
            "gas":"940000",
            "gasPrice":"35828000000",
            "gasUsed":"127593",
            "cumulativeGasUsed":"6315818",
            "input":"deprecated",
            "confirmations":"7933584",
            "methodId": "0xa9059cbb",
            "functionName": "transfer(address _to, uint256 _value)"
        }
    ]
}
```

## Get the total number of token transactions `PRO`

Returns the total number of token transactions.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokentxcount
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokentxcount&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Sample response

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

## Get a list of 'ERC20 - Token Approvals' `PRO`

Returns the list of ERC-20 token approvals.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=tokenapproval
   &owner=0x7d71f82611ba86bc302a655ec3d2050e98baf49c
   &contractaddress=0x306000d966a28ca768e2a3b84b63a7bcf4cca58a
   &offset=0
   &limit=1
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=tokenapproval&owner=0x7d71f82611ba86bc302a655ec3d2050e98baf49c&contractaddress=0x306000d966a28ca768e2a3b84b63a7bcf4cca58a&offset=0&limit=1&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter       | Description                                                                             |
| --------------- | --------------------------------------------------------------------------------------- |
| owner           | the string representing the address of the token owner                                  |
| spender         | the string representing the address of the token spender                                |
| contractaddress | the contract address of the ERC-20 token                                                |
| offset          | skips the `offset` records before beginning to return the records, default value is `0` |
| limit           | the number of records displayed per page, default value is `10000`                      |

**Note:** You must specify at least one of the following parameters: `owner`, `spender`, or `contractaddress`. Approvals are returned in reverse chronological order.

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "4663",
            "contractAddress": "0x306000d966a28ca768e2a3b84b63a7bcf4cca58a",
            "hash": "0xfcadea3e4de19fe4a17a15fda09fac6c95195648809efb7aa14bc9133de78845",
            "index": "0",
            "owner": "0x7d71f82611ba86bc302a655ec3d2050e98baf49c",
            "spender": "0xcbccce385ad801376b31d6038eee3d3a7e8f7351",
            "timestamp": "1748989380",
            "tokenDecimal": "18",
            "tokenName": "Test Graphite Token",
            "tokenPriceUSD": null,
            "tokenSymbol": "TGT",
            "transactionIndex": "0",
            "value": "22000000000000000000"
        }
    ]
}
```

## Get the most recent 'ERC20 - Token Approvals' `PRO`

Returns a list of the latest ERC-20 token approvals.

#### Sample request

{% tabs %}
{% tab title="Plain" %}

```
https://api.main.atgraphite.com/api
   ?module=token
   &action=latestapproval
   &owner=0x7d71f82611ba86bc302a655ec3d2050e98baf49c
   &contractaddress=0x306000d966a28ca768e2a3b84b63a7bcf4cca58a
   &includezero=true
   &offset=0
   &limit=1
   &apikey=YourApiKeyToken
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl 'https://api.main.atgraphite.com/api?module=token&action=latestapproval&owner=0x7d71f82611ba86bc302a655ec3d2050e98baf49c&contractaddress=0x306000d966a28ca768e2a3b84b63a7bcf4cca58a&includezero=true&offset=0&limit=1&apikey=YourApiKeyToken'
```

{% endtab %}
{% endtabs %}

#### Request query parameters

| Parameter       | Description                                                                                      |
| --------------- | ------------------------------------------------------------------------------------------------ |
| owner           | the string representing the address of the token owner                                           |
| spender         | the string representing the address of the token spender                                         |
| contractaddress | the contract address of the ERC-20 token                                                         |
| includezero     | the boolean flag (`true` or `false`) for including zero value approvals, default value is `true` |
| offset          | skips the `offset` records before beginning to return the records, default value is `0`          |
| limit           | the number of records displayed per page, default value is `10000`                               |

**Note:** You must specify at least one of the following parameters: `owner`, `spender`, or `contractaddress`.

#### Sample response

```json
{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "blockNumber": "4663",
            "contractAddress": "0x306000d966a28ca768e2a3b84b63a7bcf4cca58a",
            "hash": "0xfcadea3e4de19fe4a17a15fda09fac6c95195648809efb7aa14bc9133de78845",
            "index": "0",
            "owner": "0x7d71f82611ba86bc302a655ec3d2050e98baf49c",
            "spender": "0xcbccce385ad801376b31d6038eee3d3a7e8f7351",
            "timestamp": "1748989380",
            "tokenDecimal": "18",
            "tokenName": "Test Graphite Token",
            "tokenPriceUSD": null,
            "tokenSymbol": "TGT",
            "transactionIndex": "0",
            "value": "22000000000000000000"
        }
    ]
}
```
