# ERC721

### /getbalance

Retrieves the number of NFTs held in the owner's account. Currently available on Ethereum, Polygon, BSC, Avalanche, Mantle and zkSync.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/nft/getbalance`

#### Query Parameters

| Name                                            | Type   | Description                                                                                                                 |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- |
| rpc                                             | String | Remote procedural call URL.                                                                                                 |
| chainId                                         | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                        |
| chainSymbol                                     | String | <p>Refer to the <a href="../../ids/chain-ids">Chain ID </a>page for details. <br>Chain Symbols: eth, bsc, avax, matic. </p> |
| nftCollection<mark style="color:red;">\*</mark> | String | NFT collection address                                                                                                      |
| address<mark style="color:red;">\*</mark>       | String | User's account address                                                                                                      |
| nftProtocolId                                   | String | <p>721/1155 standard choice</p><p>by default it is 721</p>                                                                  |

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

```url
https://api.expand.network/nft/getbalance?nftCollection=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&address=0xc5c7b46843014B1591e9aF24de797156cde67f08
```

{% endtab %}

{% tab title="Sample Response" %}

<pre><code><strong>{
</strong>    "status": 200,
    "msg": "success",
    "data": {
        "balance": "2"
    }
}
</code></pre>

{% endtab %}
{% endtabs %}

### /getmetadata

Retrieves the metadata for the specified NFT. Currently available on Ethereum, Polygon, BSC, Avalanche, Mantle and zkSync.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/nft/getmetadata`

#### Query Parameters

| Name                                            | Type   | Description                                                                          |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                             | String | Remote procedural call URL.                                                          |
| chainId                                         | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                     | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| nftCollection<mark style="color:red;">\*</mark> | String | NFT collection address.                                                              |

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

```url
https://api.expand.network/nft/getmetadata?nftCollection=0x5af0d9827e0c53e4799bb226655a1de152a425a5
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "name": "Milady",
        "symbol": "MIL"
    }
}
```

{% endtab %}
{% endtabs %}

### /getowner

Retrieves the owner of the specified token ID. Currently available on Ethereum, Polygon, BSC, Avalanche, Mantle and zkSync.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/nft/getowner`

#### Query Parameters

| Name                                            | Type   | Description                                                                                                                   |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| rpc                                             | String | Remote procedural call URL.                                                                                                   |
| chainId                                         | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                          |
| chainSymbol                                     | String | <p>Refer to the <a href="../../ids/chain-ids">Chain ID </a>page for details.</p><p>Chain Symbols: eth, bsc, avax, matic. </p> |
| nftCollection<mark style="color:red;">\*</mark> | String | NFT collection address                                                                                                        |
| nftProtocolId                                   | String | <p>721/1155 standard choice</p><p>by default: 721</p>                                                                         |
| nftIndex<mark style="color:red;">\*</mark>      | String | Index of the nft in the Collection                                                                                            |

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

```url
https://api.expand.network/nft/getowner?nftIndex=1000&nftCollection=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "owner": "0x68761dE35422d8e36d18dC2F7f6313a58c1a3616"
    }
}
```

{% endtab %}
{% endtabs %}

### /historicaltransactions

&#x20;Retrieves past transactions associated with a designated address, sorted based on an NFT token contract, and limited within a specific block range. Currently available on ethereum.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/nft/historicaltransactions`

#### Query Parameters

| Name                                            | Type   | Description                                                                          |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                             | String | Remote procedural call URL.                                                          |
| chainId                                         | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                     | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| nftCollection<mark style="color:red;">\*</mark> | String | NFT collection address                                                               |
| nftProtocolId                                   | String | <p>721/1155 standard choice</p><p>by Default 721</p>                                 |
| startBlock                                      | String | <p>starting block of the range</p><p>by Default: latestBlock -100</p>                |
| page                                            | String | <p>page no to get</p><p>by Default 1</p>                                             |
| endBlock                                        | String | <p>end block of the range</p><p>by Default: latestBlock</p>                          |
| sort                                            | String | <p>asc/desc</p><p>by Default  desc</p>                                               |

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

```url
https://api.expand.network/nft/historicaltransactions?chainId=1&nftProtocolId=721&startBlock=0&nftCollection=0x306b1ea3ecdf94aB739F1910bbda052Ed4A9f949&page=1&sort=desc
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "transactions": [
            {
                "blockNumber": "18968332",
                "timeStamp": "1704790283",
                "hash": "0x719286621b2b2e4aeda8e61a0ce2e58bd6f4806d1d411653172ec5380ec2c3d6",
                "nonce": "722",
                "blockHash": "0x6929852257b9d94b5f9b5908d851a25488d3a2afd11c103229f7a8fb305b5898",
                "from": "0x2efdb6dd6daa243fdf30cac2391adb8350d5e322",
                "contractAddress": "0x306b1ea3ecdf94ab739f1910bbda052ed4a9f949",
                "to": "0xae78174d3ab843dd349acb975ed1b3b1431a55e8",
                "tokenID": "769",
                "tokenName": "Beanz",
                "tokenSymbol": "BEANZ",
                "tokenDecimal": "0",
                "transactionIndex": "43",
                "gas": "173141",
                "gasPrice": "16138857662",
                "gasUsed": "128215",
                "cumulativeGasUsed": "9277786",
                "input": "deprecated",
                "confirmations": "513",
                "methodId": "0x00000000",
                "methodSignature": "get_block_hash_257335279069929(uint256)"
            },
            ...
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### /historicallogs

Retrieves historical logs for any nftCollection. Currently available on ethereum.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/nft/historicallogs`

#### Query Parameters

| Name                                            | Type   | Description                                                                          |
| ----------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                             | String | Remote procedural call URL.                                                          |
| chainId                                         | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                     | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| nftCollection<mark style="color:red;">\*</mark> | String | NFT collection address                                                               |
| nftProtocolId                                   | String | <p>721/1155 standard choice</p><p>by Default 721</p>                                 |
| startBlock                                      | String | <p>starting block of the range</p><p>by Default: latestBlock -100</p>                |
| page                                            | String | <p>page no to get</p><p>by Default 1</p>                                             |
| endBlock                                        | String | <p>end block of the range</p><p>by Default: latestBlock</p>                          |
| type<mark style="color:red;">\*</mark>          | String | <p>ERC721: Approval, Transfer</p><p></p>                                             |

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

```url
https://api.expand.network/nft/historicallogs?chainId=1&nftCollection=0x08D7C0242953446436F34b4C78Fe9da38c73668d&type=Transfer&startBlock=17146713&endBlock=17157177
```

{% endtab %}

{% tab title="Sample Response" %}

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "status": 200,
    "msg": "success",
    "data": {
        "logs": [
            {
                "address": "0x08d7c0242953446436f34b4c78fe9da38c73668d",
                "topics": [
                    "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                    "0x00000000000000000000000050d36f27872f637ec9ecb4eedff300df44a608ab",
                    "0x000000000000000000000000fcbe7b6da18a08a86ab1beb68c7372a60ab4e331",
                    "0x00000000000000000000000000000000000000000000000000000000000003d5"
                ],
                "params": {
                    "from": "0x50d36f27872f637ec9ecb4eedff300df44a608ab",
                    "to": "0xfcbe7b6da18a08a86ab1beb68c7372a60ab4e331",
                    "tokenId": "981"
                },
                "data": "0x",
                "blockNumber": "17147007",
                "blockHash": "0x0af8cae4fce3cabdad9dbcac77ba4761afea961c040817ea835260ea6d56703a",
                "timeStamp": "1682713763",
                "gasPrice": "35684114147",
                "gasUsed": "267808",
                "logIndex": "250",
                "transactionHash": "0x0eb9b987533eee819a1509b5e50691438d0de6f9c43b46973fdd2516eccefd97",
                "transactionIndex": "98"
            },
            ...
           }
       ]
   }
}
</code></pre>

{% endtab %}
{% endtabs %}
