# Token

## Get token information

#### Method

get

#### Path

/v1/token

#### Parameters

* `chain_id` : required, chain id, eg: `eth`, `bsc`, `xdai`, [for more info](https://docs.cloud.debank.com/en/readme/chain#returns-1).
* `id` : required, - The address of the token contract or a native token id (eth, matic, bsc).

#### Returns

`Object` - An object with the following fields:

* `id` : `string` - The address of the token contract.
* `chain` : `string` - The chain's name.
* `name` : `string` - The token's name. `null` if not defined in the contract and not available from other sources.
* `symbol` : `string` - The token's symbol. `null` if not defined in the contract and not available from other sources.
* `display_symbol` : `string` - The token's displayed symbol. If two tokens have the same symbol, they are distinguished by `display_symbol` .
* `optimized_symbol` : `string` - For front-end display. `optimized_symbol || display_symbol || symbol`
* `decimals` : `integer` - The number of decimals of the token. `null` if not defined in the contract and not available from other sources.
* `protocol_id` : `string` - token associated protocol's id. Empty string if not available.
* `logo_url` : `string` - URL of the token's logo image. `null` if not available.
* `is_core`:`boolean` - Whether or not to show as a common token in the wallet.
* `price`: `double` - USD price. Price of 0 means no data.
* `time_at` : `integer` - The timestamp when the current token was deployed on the blockchain.

Request

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

```bash
curl -X 'GET' \
  'https://pro-openapi.debank.com/v1/token?chain_id=eth&id=0xdac17f958d2ee523a2206206994597c13d831ec7' \
  -H 'accept: application/json' -H 'AccessKey: YOUR_ACCESSKEY'
```

{% endtab %}
{% endtabs %}

Result

```json
{
  "id": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "chain": "eth",
  "name": "Tether USD",
  "symbol": "USDT",
  "display_symbol": null,
  "optimized_symbol": "USDT",
  "decimals": 6,
  "logo_url": "https://static.debank.com/image/eth_token/logo_url/0xdac17f958d2ee523a2206206994597c13d831ec7/66eadee7b7bb16b75e02b570ab8d5c01.png",
  "protocol_id": "",
  "price": 1,
  "is_verified": true,
  "is_core": true,
  "is_wallet": true,
  "time_at": 1511829681
}
```

## Get the list of the token information

#### Method

get

#### Path

/v1/token/list\_by\_ids

#### Parameters

* `chain_id` : required, chain id, eg: `eth`, `bsc`, `xdai`, [for more info](https://docs.cloud.debank.com/en/readme/chain#returns-1).
* `ids` : required, List of token addresses, up to 100.

#### Returns

`Array` of `Object` - An object with following fields:

* `id` : `string` - The address of the token contract.
* `chain` : `string` - The chain's name.
* `name` : `string` - The token's name. `null` if not defined in the contract and not available from other sources.
* `symbol` : `string` - The token's symbol. `null` if not defined in the contract and not available from other sources.
* `display_symbol` : `string` - The token's displayed symbol. If two tokens have the same symbol, they are distinguished by `display_symbol` .
* `optimized_symbol` : `string` - For front-end display. `optimized_symbol || display_symbol || symbol`
* `decimals` : `integer` - The number of decimals of the token. `null` if not defined in the contract and not available from other sources.
* `logo_url` : `string` - URL of the token's logo image. `null` if not available.
* `protocol_id` : `string` - token associated protocol's id. Empty string if not available.
* `is_core`:`boolean` - Whether or not to show as a common token in the wallet.
* `price`: `double` - USD price. Price of 0 means no data.
* `time_at` : `integer` - The timestamp when the current token was deployed on the blockchain.

Request

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

```bash
curl -X 'GET' \
  'https://pro-openapi.debank.com/v1/token/list_by_ids?chain_id=eth&ids=0xdac17f958d2ee523a2206206994597c13d831ec7,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' \
  -H 'accept: application/json' -H 'AccessKey: YOUR_ACCESSKEY'
```

{% endtab %}
{% endtabs %}

Result

```json
[
  {
    "id": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "chain": "eth",
    "name": "USD Coin",
    "symbol": "USDC",
    "display_symbol": null,
    "optimized_symbol": "USDC",
    "decimals": 6,
    "logo_url": "https://static.debank.com/image/eth_token/logo_url/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48/adee072b10b0db7c5bd7a28dd4fbe96f.png",
    "protocol_id": "",
    "price": 1,
    "is_verified": true,
    "is_core": true,
    "is_wallet": true,
    "time_at": 1533324504
  },
  {
    "id": "0xdac17f958d2ee523a2206206994597c13d831ec7",
    "chain": "eth",
    "name": "Tether USD",
    "symbol": "USDT",
    "display_symbol": null,
    "optimized_symbol": "USDT",
    "decimals": 6,
    "logo_url": "https://static.debank.com/image/eth_token/logo_url/0xdac17f958d2ee523a2206206994597c13d831ec7/66eadee7b7bb16b75e02b570ab8d5c01.png",
    "protocol_id": "",
    "price": 1,
    "is_verified": true,
    "is_core": true,
    "is_wallet": true,
    "time_at": 1511829681
  }
]
```

## Get top holders of token

#### Method

get

#### Path

/v1/token/top\_holders

#### Parameters

* `id` : `string` required, token address, also support native token id, eg. eth, bsc
* `chain_id` : required, chain id, eg: `eth`, `bsc`, `xdai`, [for more info](https://docs.cloud.debank.com/en/readme/chain#returns-1).
* `start`: `integer` offset, default is 0, max is 10000.
* `limit`: `integer` limit size, default is 100, max is 100.

#### Returns

`Array` of address with token amount, in reverse order of holding token amount.

Request

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

```bash
curl -X GET "https://pro-openapi.debank.com/v1/token/top_holders?chain_id=celo&id=celo&start=2&limit=1
    -H "accept: application/json" -H 'AccessKey: YOUR_ACCESSKEY'
```

{% endtab %}
{% endtabs %}

Result

```
[
    [
        "0x00000000219ab540356cbb839cbe05303d7705fa",  // user_address
        13702020.000069 // amount 
    ],
    [
        "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
        3624588.4884625035
    ],
    [
        "0xda9dfa130df4de4673b89022ee50ff26f6ea73cf",
        2113030.0863672243
    ],
    [
        "0x0716a17fbaee714f1e6ab0f9d59edbc5f09815c0",
        2014609.5884898424
    ],
    [
        "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8",
        1996008.354181282
    ]
]
```

## Get token history price

#### Method

get

#### Path

/v1/token/history\_price

#### Parameters

* `id` : `string` required, token address, also support native token id, eg. eth, bsc
* `chain_id` : required, chain id, eg: `eth`, `bsc`, `xdai`, [for more info](https://docs.cloud.debank.com/en/readme/chain#returns-1).
* `date_at`: `string` required, UTC time zone. eg. 2023-05-18

#### Returns

* `price`: `float`, history price at a specified time.

Request

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

```bash
curl -X GET "https://pro-openapi.debank.com/v1/token/history_price?id=eth&chain_id=eth&date_at=2023-05-18
    -H "accept: application/json" -H 'AccessKey: YOUR_ACCESSKEY'
```

{% endtab %}
{% endtabs %}

Result

```
{
    "price": 1820.89
}
```
