spotMeta
Get metadata for all available spot trading assets on Hyperliquid, including token details, decimal precision, and trading pair information.
When to Use This Endpoint#
The spotMeta endpoint is essential for:
- Spot Trading Interfaces — Display available spot markets with correct token information
- Token Discovery — List all tradeable spot assets
- Decimal Handling — Format token amounts with correct precision
- Token Validation — Verify token addresses and canonical status
Request#
Endpoint#
POST https://api-hyperliquid-mainnet-info.n.dwellir.com/info
Headers#
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
X-Api-Key | Your API key | Yes |
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be "spotMeta" |
Example Request#
{
"type": "spotMeta"
}
Response#
Success Response#
{
"universe": [
{
"tokens": [0, 1],
"name": "USDC/USDT"
}
],
"tokens": [
{
"name": "USDC",
"szDecimals": 8,
"weiDecimals": 8,
"index": 0,
"tokenId": "0x6d1e7cde53ba9467b783cb7c530ce054",
"isCanonical": true,
"fullName": "USD Coin"
},
{
"name": "USDT",
"szDecimals": 8,
"weiDecimals": 8,
"index": 1,
"tokenId": "0x4ed5f9b9547c4fbb52be8b24fcb5e8ba",
"isCanonical": true,
"fullName": "Tether USD"
}
]
}
Response Fields#
| Field | Type | Description |
|---|---|---|
universe | array | Array of spot trading pair objects |
tokens | array | Array of token metadata objects |
Token Object#
| Field | Type | Description |
|---|---|---|
name | string | Token symbol (e.g., "USDC") |
szDecimals | integer | Decimal places for size formatting |
weiDecimals | integer | Decimal places for wei conversions |
index | integer | Unique token index |
tokenId | string | Unique token identifier |
isCanonical | boolean | Whether the token is canonical |
fullName | string | Full token name |
Code Examples#
- cURL
- JavaScript
- Python
curl -X POST 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info' \
-H 'X-Api-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"type":"spotMeta"}'
const ENDPOINT = 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info';
async function getSpotMeta() {
const response = await fetch(ENDPOINT, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({ type: 'spotMeta' })
});
return await response.json();
}
// Usage
const spotMeta = await getSpotMeta();
console.log(`Available spot tokens: ${spotMeta.tokens.length}`);
console.log(`Available spot pairs: ${spotMeta.universe.length}`);
// Find specific token
const usdc = spotMeta.tokens.find(t => t.name === 'USDC');
console.log(`USDC decimals: ${usdc.szDecimals}`);
import requests
ENDPOINT = 'https://api-hyperliquid-mainnet-info.n.dwellir.com/info'
def get_spot_meta():
response = requests.post(
ENDPOINT,
json={'type': 'spotMeta'},
headers={
'Content-Type': 'application/json',
'X-Api-Key': 'YOUR_API_KEY'
},
timeout=10
)
response.raise_for_status()
return response.json()
# Usage
spot_meta = get_spot_meta()
print(f"Available spot tokens: {len(spot_meta['tokens'])}")
# Find USDC
usdc = next(t for t in spot_meta['tokens'] if t['name'] == 'USDC')
print(f"USDC ID: {usdc['tokenId']}")
print(f"USDC canonical: {usdc['isCanonical']}")
Common Use Cases#
1. Format Token Amounts#
function formatTokenAmount(tokenName, amount, spotMeta) {
const token = spotMeta.tokens.find(t => t.name === tokenName);
if (!token) return amount.toString();
return amount.toFixed(token.szDecimals);
}
// Usage
const spotMeta = await getSpotMeta();
console.log(formatTokenAmount('USDC', 1000.123456, spotMeta)); // "1000.12345600"
2. Build Token Selector#
async function getTokenList() {
const spotMeta = await getSpotMeta();
return spotMeta.tokens
.filter(t => t.isCanonical)
.map(token => ({
symbol: token.name,
fullName: token.fullName,
tokenId: token.tokenId,
decimals: token.szDecimals
}));
}
3. Validate Token#
function isValidToken(tokenName, spotMeta) {
return spotMeta.tokens.some(t => t.name === tokenName);
}
Best Practices#
- Cache spot metadata for extended periods as it changes infrequently
- Use correct decimals when formatting token amounts
- Filter canonical tokens when presenting token lists to users
- Validate tokens before attempting trades
Related Endpoints#
- meta — Get perpetual trading pair metadata
- spotClearinghouseState — Get spot account balances
Access Hyperliquid spot market metadata with Dwellir's HyperCore Info Endpoint. Get your API key →