# Token endpoint

GET /token reads a pair the same way the panel does. Use it to validate an address before spending a package on it.

```
GET https://www.dextrending.net/api/v1/token?chain=solana&address=...
```

The same lookup the panel runs when you paste a contract address: the pair is read from Dexscreener
first, then the token contract directly through our RPC pool as a fallback.

## Parameters

| Name | Required | Notes |
| --------- | -------- | ------------------------------------------------------------------------- |
| `chain` | Yes | `solana`, `ethereum`, `bsc`, `base`, `arbitrum`, `polygon` or `avalanche` |
| `address` | Yes | Token contract address. Solana addresses are case sensitive. |

## Response

```
{
  "token": {
    "chain": "solana",
    "address": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
    "name": "Bonk",
    "symbol": "Bonk",
    "decimals": 5,
    "logo_url": "https://cdn.dexscreener.com/cms/images/...",
    "pair_url": "https://dexscreener.com/solana/5zpyutju9ee6jfymdgok7f6s5kczqtc9fomp3uekuya9"
  }
}
```

| Field | Type | Notes |
| ---------- | --------------- | ----------------------------------------- |
| `name` | string or null | Null if neither source publishes one |
| `symbol` | string or null | Null if neither source publishes one |
| `decimals` | integer or null | Read from the token contract |
| `logo_url` | string or null | Null when the token has no published logo |
| `pair_url` | string or null | The pair on Dexscreener, when one exists |

## Use it before launching

A 404 here means a launch would fail too, so this is the cheap way to validate input:

```
const ok = await fetch(`${BASE}/token?chain=${chain}&address=${address}`, {
  headers: { "X-API-Key": KEY }
}).then(r => r.ok);

if (!ok) {
  throw new Error("Address does not resolve on " + chain + ", not spending a package");
}
```

This endpoint spends nothing. It is rate limited like everything else, but it costs no package and
has no side effects.

## When it returns 404

- The address is wrong for that chain — an EVM address queried on Solana, or the reverse

- The pair has no liquidity pool yet, so Dexscreener has nothing indexed

- The contract exists but is not a token

Results are cached, so repeated lookups for the same pair are fast and do not re-hit the upstream
sources.

## Questions

**Does this endpoint cost a package?**

No. It reads only, spends nothing, and has no side effects beyond the rate limit.

**Why does it return null for name or symbol?**

Some tokens publish no metadata on chain and are not indexed by Dexscreener. The address is still valid; there is simply nothing to display.

**Is the result cached?**

Yes. Repeat lookups for the same pair are served from cache rather than re-querying the upstream sources.

