Skip to main content

How to Get Token Metadata with Tokenview APIs?

tokenviewAbout 1 min

How to Get Token Metadata with Tokenview APIs?

Token metadata provides valuable information about a token's properties, such as its name, symbol, supply, contract address, and more. With the proliferation of diverse tokens across various blockchain networks, accessing this metadata efficiently and reliably is essential.
We will explore how to retrieve token metadata using Tokenview APIs in this article.

Understanding Token Metadata

Token metadata refers to descriptive information associated with a token deployed on a blockchain network. This information typically includes:

  1. Token Name and Symbol: The name and ticker symbol that represent the token, e.g., "USDT" or "Uni".
  2. Token Supply: The total supply of tokens in circulation, including details such as maximum supply, circulating supply.
  3. Token Decimals: The number of decimal places used to represent fractional amounts of a token. Token decimals determine the precision of token values when dealing with fractional amounts.
  4. Token Address: The unique address of the smart contract governing the token on the blockchain.
  5. Token Logo and Description: Additional details such as a logo image, description, or links to official resources related to the token.

Using HTTP Request to get Token Metadata

Tokenview APIs support multiple endpointsopen in new window to query token metadata based on parameters such as token contract address, blockchain network, or token symbol.

Endpoints:

/vipapi/{network}/token/{token-address}
/vipapi/token/totalsupply/{network}/{token-address}
/vipapi/token/maxsupply/{network}/{token-address}
/vipapi/token/circulatingsupply/{network}/{token-address}

Code Examples:

import requests

# Tokenview APIs endpoint for retrieving token information
url = "https://services.tokenview.io/vipapi/{}/token/{}?apikey={}"

# Network to query
network = "eth"

# Token address for the desired token
token_address = "0x..."

# Tokenview API key for authentication
api_key = "YOUR_API_KEY"

# Construct API request URL
request_url = url.format(network,token_address,api_key)

# Send GET request to Tokenview API
response = requests.get(request_url)

# Parse JSON response
token_data = response.json()

# Extract relevant token metadata fields
token_name = token_data["data"]["tokenInfo"]["f"]
token_symbol = token_data["data"]["tokenInfo"]["s"]
token_supply = token_data["data"]["tokenInfo"]["t"]
token_decimals = token_data["data"]["tokenInfo"]["d"]

# Utilize token metadata as needed
print("Token Name:", token_name)
print("Token Symbol:", token_symbol)
print("Total Supply:", token_supply)
print("Decimals:", token_decimals)

Tokenview Token APIs serve as a gateway to token insights, empowering users to navigate the decentralized landscape with confidence and clarity.

About Tokenview Blockchain APIs & Data Service Platform:

Tokenview blockchain APIs & data service platform contained 120+ blockchains has powerful endpoints that simplify complex blockchain data into single API calls. Code for all supported blockchains using unified API calls. From here to easily get transaction, address, gas, contract, token, NFT, logs and any information from chain. And Yes you can also send tx to chain. One-click configuration with APIKey helps developers to Use, to Create, to Build.
Last update: