# Find a token (address or symbol)

- Section: Discovery (TTF API reference)
- Source: https://ttf.bot/developers/docs/#resolve
- The whole reference as one text: https://ttf.bot/developers/docs/llms-full.txt

`GET /v1/resolve`

- Base URL: `https://api.ttf.bot`
- Cost: 1 credit
- Plan: Free
- Chains: 40 chains
- API key: required. Send `Authorization: Bearer YOUR_KEY` (or `X-API-Key: YOUR_KEY`).
- A refused call costs nothing; a failed one costs 1 credit (the attempt fee).

Got a contract address or just a $TICKER from a Telegram chat? This tells you which chain and pool an address trades on, or the best-matching tokens for a symbol or name (most liquid first).

- A symbol search gives up to 5 matches, best first. Show them to your user and let them pick: many tokens share a ticker.
- Searching a symbol that matches nothing costs nothing.

## Exact rules

data.matches: for an address, ONE match (the chain and main pair it trades on; `listed` false = no market lists it, true with no pair = listed but the pair address is unknown); for a symbol or name, the best matching tokens (up to 5, with liquidity_usd and volume_24h_usd; the same search is shared for 10 s). Costs 1 credit (1 from the cache); a symbol with no match costs nothing, an address with no match costs 1 credit (the attempt fee).

## Parameters

### Query parameters

- `q` (string, query, required): A token address, or a symbol / name (at most 40 characters; at most 100 for an address).
  - At most 100 characters.
  - Example: `PEPE`
- `chain` (string, query, optional): Only this chain (optional). Chain id.
  - Allowed: `eth`, `sol`, `base`, `bsc`, `abstract`, `arbitrumnova`, `arc`, `berachain`, `bttc`, `celo`, `cronos`, `elysium`, `flare`, `fraxtal`, `gnosis`, `hedera`, `injective`, `ink`, `katana`, `linea`, `mantle`, `megaeth`, `merlinchain`, `monad`, `moonbeam`, `moonriver`, `opbnb`, `plasma`, `polygonzkevm`, `pulsechain`, `robinhood`, `scroll`, `seiv2`, `sophon`, `stable`, `swellchain`, `taiko`, `worldchain`, `xdc`, `zksync`.
  - At most 16 characters.
  - Example: `eth`

## Example request

```bash
curl -sS 'https://api.ttf.bot/v1/resolve?q=PEPE' \
  -H 'Authorization: Bearer YOUR_KEY'
```

Put your key in place of `YOUR_KEY`.

## Example answer

`200` (`default`): Resolve an address or a symbol

```json
{
  "data": {
    "matches": [
      {
        "address": "0x6982508145454ce325ddbe47a25d4ec3d2311933",
        "chain": "eth",
        "dex": "uniswap",
        "liquidity_usd": 41200000,
        "listed": true,
        "name": "Pepe",
        "pair": "0xa43fe16908251ee70ef74718545e4fe6c5ccec9f",
        "symbol": "PEPE",
        "volume_24h_usd": 512000000
      }
    ]
  },
  "meta": {
    "cost": 1,
    "request_id": "3f2a9c0e5b7d4e18a6c1f0b2d9e8a7c6"
  }
}
```

`200` (`address`): q=\<address>: one match, the chain and main pair it trades on.

```json
{
  "data": {
    "matches": [
      {
        "address": "0x6982508145454ce325ddbe47a25d4ec3d2311933",
        "chain": "eth",
        "dex": "uniswap",
        "listed": true,
        "name": "Pepe",
        "pair": "0xa43fe16908251ee70ef74718545e4fe6c5ccec9f",
        "symbol": "PEPE"
      }
    ]
  },
  "meta": {
    "cost": 1,
    "request_id": "3f2a9c0e5b7d4e18a6c1f0b2d9e8a7c6"
  }
}
```

`200` (`no_match`): q=\<a symbol nobody lists>: no match, costs nothing.

```json
{
  "data": {
    "matches": []
  },
  "meta": {
    "cost": 0,
    "request_id": "3f2a9c0e5b7d4e18a6c1f0b2d9e8a7c6"
  }
}
```

## Response fields

`always` = in every answer; `always*` = in every answer that does not narrow it with `fields`; any other field is left out when there is no value (never `null`). Objects are open: ignore keys you do not know.

A `200` answer is `{"data", "meta"}` (`ResolveAnswer`).

### `data`

- `matches` (array of objects, always): For an address: ONE match. For a symbol / name: the best matches (up to 5, most liquid first). Empty = no match.
  - `address` (string, always): Token address. Address on its chain: 0x + 40 hex (lower case) on EVM chains, base58 on Solana.
  - `chain` (string, always): Chain id.
  - `listed` (boolean, always): true = a market lists the token; false = no market lists it (then there is no pair).
  - `dex` (string): DEX of the main pair.
  - `liquidity_usd` (integer): Symbol / name search only (always there): liquidity over the token's pairs. Whole US dollars (integer).
  - `name` (string): Token name.
  - `pair` (string): Main pair (pool) address. A listed token can lack it (unknown).
  - `symbol` (string): Ticker.
  - `volume_24h_usd` (integer): Symbol / name search only (always there): 24 h volume over the token's pairs. Whole US dollars (integer).

### `meta`

- `cost` (integer, always): Credits this call finally spent (= the X-Credits-Cost header). 0 for free routes and refused calls.
- `request_id` (string, always): Id of this request (= the X-Request-Id header). Quote it to support.
- `cached` (array of strings): The groups answered from the shared answer cache (charged at their cached weight). Absent when none.
- `partial` (array of strings): Something is missing. A bare group name ("holders"): that group failed, its entry in data is {"error": {...}} and only the attempt fee can apply. A dotted "\<group>.\<part>" ("security.holders"): a part of a group that DID answer is missing (see its complete / missing); that group is still billed. Absent when nothing is missing.

## Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `bad_request` | Bad request: unknown chain, address, field or option. Not charged. Codes: bad_request. |
| 401 | `unauthorized` | The API key is missing or not valid. Not charged. Codes: unauthorized. |
| 402 | `payment_required` | The subscription of this API key has ended. Not charged. Codes: payment_required. |
| 403 | `forbidden` | The key has no developer plan, or does not include the asked groups. Not charged. Codes: forbidden. |
| 404 | `not_found` | Not found: no data for this token (the attempt fee applies, see the description), or the API is switched off / an unknown route (not charged). Codes: not_found. |
| 405 | `method_not_allowed` | Wrong HTTP method (every data route is GET). Not charged. Codes: method_not_allowed. |
| 422 | `refused` | This token cannot be scanned. The attempt fee (1 credit) applies. Codes: refused. |
| 429 | `rate_limited` | Too many requests per second, or the credits of the minute / day / month are used up. See Retry-After. Not charged. Codes: rate_limited. |
| 500 | `internal` | Unexpected error. Not charged. Codes: internal. |
| 502 | `upstream` | A data provider did not answer. The attempt fee (1 credit) applies to core and the paid-provider groups. Codes: upstream. |
| 503 | `capacity` `busy` `unavailable` | Capacity, shedding, busy providers or the limits store is unavailable. See Retry-After. Not charged. Codes: capacity, busy, unavailable. |
| 504 | `timeout` | The data took too long. The attempt fee (1 credit) applies to core and the paid-provider groups. Codes: timeout. |
| other | `error` | Any other refusal of the HTTP layer (rare): the status says which. Codes: error. |

Every error is `{"error": {"code", "message", "doc_url", "request_id"}}`. What each code means and how to fix it: [Errors](https://ttf.bot/developers/docs/md/errors.md).
