# Chains, groups and prices

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

`GET /v1/chains`

- Base URL: `https://api.ttf.bot`
- Cost: Free
- API key: not needed

Start here: which chains are supported, which groups each serves and what every group costs. Free, no key needed: read it once at start-up.

## Exact rules

The launch chains, the groups each one serves and what each group costs (`groups`: the field groups of GET /v1/token, `route_groups`: the routes of their own; all_chains true = served on every launch chain, false = only on the listed `chains`; tag free = no paid provider, paid = a failed answer keeps the attempt fee). /v1/resolve costs the resolve group's credits; /v1/chains and /v1/health are free. No key, no charge.

## Parameters

No parameters: just send it.

## Example request

```bash
curl -sS 'https://api.ttf.bot/v1/chains'
```

## Example answer

`200` (`default`): Chains, groups and credits

```json
{
  "data": {
    "chains": [
      {
        "family": "evm",
        "groups": [
          "core",
          "security",
          "holders"
        ],
        "id": "eth",
        "name": "Ethereum"
      }
    ],
    "groups": [
      {
        "all_chains": true,
        "cached_credits": 1,
        "credits": 1,
        "fields": [
          "price",
          "market",
          "liquidity",
          "socials",
          "token"
        ],
        "name": "core",
        "tag": "free"
      },
      {
        "all_chains": false,
        "cached_credits": 1,
        "chains": [
          "base",
          "bsc",
          "eth",
          "sol"
        ],
        "credits": 4,
        "fields": [
          "holders"
        ],
        "name": "holders",
        "tag": "paid"
      }
    ],
    "intervals": [
      "1m",
      "5m",
      "15m",
      "1h",
      "4h",
      "1d"
    ],
    "route_groups": [
      {
        "all_chains": true,
        "cached_credits": 1,
        "credits": 2,
        "name": "trending",
        "route": "/v1/trending",
        "tag": "free"
      },
      {
        "all_chains": false,
        "cached_credits": 1,
        "chains": [
          "arb",
          "eth"
        ],
        "credits": 3,
        "name": "wallet",
        "route": "/v1/wallet/{chain}/{address}/activity",
        "tag": "paid"
      },
      {
        "all_chains": true,
        "cached_credits": 1,
        "credits": 1,
        "name": "signals",
        "route": "/v1/signals",
        "tag": "paid"
      }
    ],
    "trending_windows": [
      "5m",
      "1h",
      "4h",
      "6h",
      "1d"
    ]
  },
  "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"}` (`ChainsAnswer`).

### `data`

- `chains` (array of objects, always): The launch chains.
  - `family` (string, always): Chain family: evm, solana, ...
  - `groups` (array of strings, always): The field groups of GET /v1/token it serves.
  - `id` (string, always): Chain id (use it in paths).
  - `name` (string, always): Display name.
- `groups` (array of objects, always): The field groups.
  - `all_chains` (boolean, always): true = served on every launch chain; false = only on `chains`.
  - `cached_credits` (integer, always): Credits of an answer from the shared cache.
  - `credits` (integer, always): Credits of a live answer.
  - `fields` (array of strings, always): Its field names (a group of one field lists itself).
  - `name` (string, always): Group name (use it in `fields`).
  - `tag` (string, always): free = no paid provider behind it; paid = a failed answer keeps the attempt fee. One of: `free`, `paid`.
  - `chains` (array of strings): The chains it is served on (only when all_chains is false).
- `intervals` (array of strings, always): Candle intervals.
- `route_groups` (array of objects, always): The routes that are groups of their own (trending, wallet, signals).
  - `all_chains` (boolean, always): true = served on every launch chain; false = only on `chains`.
  - `cached_credits` (integer, always): Credits of an answer from the shared cache.
  - `credits` (integer, always): Credits of a live answer.
  - `name` (string, always): Group name (use it in `fields`).
  - `route` (string, always): Its path.
  - `tag` (string, always): free = no paid provider behind it; paid = a failed answer keeps the attempt fee. One of: `free`, `paid`.
  - `chains` (array of strings): The chains it is served on (only when all_chains is false).
- `trending_windows` (array of strings, always): Trending windows.

### `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 |
| --- | --- | --- |
| 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. |
| 500 | `internal` | Unexpected error. Not charged. Codes: internal. |
| 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).
