Skip to main content

What You’ll Learn

After completing this tutorial, you will be able to:
  • Create an application and obtain credentials
  • Generate an Access Token for API authentication
  • Call the API to get token metadata
  • Understand the API response structure
Estimated time: 5-10 minutes

Prerequisites


Step 1: Create Application and Get Credentials

  1. Log in to ChainStream Dashboard
  2. Go to Applications
  3. Click Create New App
  4. After creation, you will get your Client ID and Client Secret
Save your Client ID and Client Secret securely. You’ll use them to generate Access Tokens.

Step 2: Generate Access Token

Use your credentials to generate an Access Token. The token is used for API authentication.
curl -X POST "https://dex.asia.auth.chainstream.io/oauth/token" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "audience": "https://api.dex.chainstream.io",
    "grant_type": "client_credentials"
  }'
Access Tokens are valid for 24 hours. You can generate a new token anytime using your credentials.

Step 3: Make Your First Request

Let’s use “Get Token Metadata” as an example. We’ll query information about the SOL token on Solana.
curl -X GET "https://api-dex.chainstream.io/v1/token/sol/So11111111111111111111111111111111111111112/metadata" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Replace YOUR_ACCESS_TOKEN with the token you generated in Step 2.

Response Example

{
  "chain": "sol",
  "decimals": 9,
  "name": "Wrapped SOL",
  "symbol": "SOL",
  "address": "So11111111111111111111111111111111111111112",
  "imageUrl": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
  "tokenCreatedAt": 1710417600000
}

Step 4: Understand the Response

FieldTypeDescription
chainstringBlockchain network identifier
decimalsintegerToken decimal places
namestringToken name
symbolstringToken symbol
addressstringToken contract address
imageUrlstringToken logo URL
tokenCreatedAtintegerToken creation timestamp (milliseconds)
For complete field descriptions, see the Token Metadata API Reference.

Step 5: Try More APIs

Now that you’ve successfully completed your first call, try these APIs:

Common Issues

Please check:
  • Is the Access Token correct and not expired?
  • Is the Header format Authorization: Bearer YOUR_ACCESS_TOKEN?
  • Try generating a new token using your Client ID and Client Secret
You’ve reached the request rate limit. The free tier is limited to 10 requests/second. You can upgrade your plan to increase the limit.See API Security for details.
Change the chain parameter in the URL, for example:GET /v1/token/eth/{address}/metadata for EthereumGET /v1/token/bsc/{address}/metadata for BSCSee Realtime Streaming for the full list.

Next Steps

Choose your next learning path based on your use case:
Having issues? Check the FAQ or contact technical support.