# Indexer Restful API

## Use the Endless Indexer API

The Endless Indexer is an API you can use to get:

1. Aggregate data (ex. How many NFTs exist?)
2. Historical data (ex. What transactions has this account submitted?)
3. Data that is hard to get from the simpler fullnode Rest API (ex. What account owns a token named “ExampleToken”?).

## Indexer API Endpoints

* Mainnet: <https://idx.endless.link/api/v1>
* Testnet: <https://idx-test.endless.link/api/v1>

Indexer provide three categories of information to query:

1. Tokens owned by the account
2. NFTs owned by the account
3. Transactions invoked by the account

Future support will include more info types!

## Examples

### Get list of transactions's version associated with account

`curl -X 'GET' \ 'https://idx-testnet.endless.link/api/v1/accounts/C6tmmUSGrKfMpRh6xhhkBbKjEeUji8S8UQxxQmg6kBiz/transactions' \ -H 'accept: application/json'`

the response as below: `{"total":13,"page":0,"pageSize":30,"data":[1469227,1468912,1412032,1411964,1408547,1408480,1408473,1408396,875159,874994,755821,755732,755083]}`

we find 13 transactions associated with account(C6tmmUSGrKfMpRh6xhhkBbKjEeUji8S8UQxxQmg6kBiz). We can then use an RPC request to view the details of any of these transactions.

### Get NFT collection list owned by account

`curl -X 'GET' \ 'https://idx.endless.link/api/v1/accounts/C6tmmUSGrKfMpRh6xhhkBbKjEeUji8S8UQxxQmg6kBiz/collections' \ -H 'accept: application/json'`

Response as below:

```json
{
  "total": 1,
  "page": 0,
  "pageSize": 30,
  "data": [
    {
      "id": "7DZxr2KSL5xhfM6GH3VVcR467gEfWyo7eBZhWqLZUSqv",
      "creator": "C6tmmUSGrKfMpRh6xhhkBbKjEeUji8S8UQxxQmg6kBiz",
      "description": "Tea",
      "name": "U",
      "uri": "https://api-wallet.endless.link/api/btc/cid-nft-gateway/Qmdcdx5B2FFQ7GtGxufMvEPJjsT2d4JPBxWjUkRAbrBSLr",
      "current_supply": 2,
      "total_minted": 2,
      "max_supply": null,
      "royalty": {
        "percent": "10.00",
        "payee_address": "C6tmmUSGrKfMpRh6xhhkBbKjEeUji8S8UQxxQmg6kBiz"
      },
      "last_transaction_version": 1469227,
      "last_transaction_hash": "7j56eTq4zThwLazgdVqoVPMsRh6cuETuhsBK3nHfj3gj"
    },
    //.........................
  ]
}
```

Please refer Indexer API schema for more usages.
