# Security check

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

`GET /v1/token/{chain}/{address}/security`

- Base URL: `https://api.ttf.bot`
- Cost: 4 credits, 1 if cached
- Plan: requires Starter
- Chains: 33 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).

The honeypot and tax test, liquidity lock, owner powers and red flags of a token, with a score out of 100 and a one-line verdict. This is the same check the TTF bot runs in Telegram.

- `verdict.level` is `ok`, `warn` or `danger`: use it for a quick green / yellow / red badge.
- When `complete` is false, some checks could not run (see `missing`); never show such an answer as a final rating.

## Exact rules

Is it safe to touch? TTF's security scan (honeypot simulation, taxes, liquidity lock, ownership, source analysis, holder concentration), narrowed to what this group needs. An incomplete answer is never a rating: check complete / missing. `fields=tax` (or verdict, score, flags, checks, lp_lock, contract) narrows it; complete and missing are always kept.

One group (core, security, holders, candles, bubbles, deployer, resolve) or one field of a group (price, market, liquidity, tax ...). data is that group's answer (only the field, for a field). Costs that group's credits.

## Parameters

### Path parameters

- `chain` (string, path, required): Chain id.
  - Allowed: `eth`, `sol`, `base`, `bsc`, `abstract`, `arbitrumnova`, `arc`, `berachain`, `bttc`, `celo`, `elysium`, `flare`, `fraxtal`, `hedera`, `injective`, `ink`, `katana`, `mantle`, `megaeth`, `merlinchain`, `opbnb`, `plasma`, `polygonzkevm`, `robinhood`, `scroll`, `seiv2`, `sophon`, `stable`, `swellchain`, `taiko`, `worldchain`, `xdc`, `zksync`.
  - At most 16 characters.
  - Example: `eth`
- `address` (string, path, required): Token address of the chain (0x + 40 hex on EVM chains, base58 on Solana).
  - At most 64 characters.
  - Example: `0x6982508145454ce325ddbe47a25d4ec3d2311933`

## Example request

```bash
curl -sS 'https://api.ttf.bot/v1/token/eth/0x6982508145454ce325ddbe47a25d4ec3d2311933/security' \
  -H 'Authorization: Bearer YOUR_KEY'
```

Put your key in place of `YOUR_KEY`.

## Example answer

`200` (`default`): The security group

```json
{
  "data": {
    "checks": [
      {
        "id": "honeypot",
        "label": "Honeypot test",
        "state": "ok",
        "value": "sellable"
      },
      {
        "id": "tax",
        "label": "Buy / sell tax",
        "state": "ok",
        "value": "0% / 0%"
      },
      {
        "id": "holders",
        "label": "Holder concentration",
        "state": "ok",
        "value": "top 10: 31%"
      }
    ],
    "complete": true,
    "contract": {
      "owner_renounced": true,
      "proxy": false,
      "verified_source": true
    },
    "flags": [
      {
        "detail": "The owner keeps contract privileges.",
        "id": "owner_active",
        "severity": "info",
        "title": "Owner is not renounced"
      }
    ],
    "lp_lock": {
      "burned_pct": 100,
      "locked": true,
      "locked_pct": 100
    },
    "missing": [],
    "score": 92,
    "tax": {
      "buy_pct": 0,
      "honeypot": false,
      "sell_pct": 0
    },
    "verdict": {
      "known": true,
      "label": "No honeypot, no red flags",
      "level": "ok",
      "reasons": [
        "Sell tax 0%",
        "Owner renounced",
        "Liquidity locked"
      ],
      "sellable": true
    }
  },
  "meta": {
    "cost": 4,
    "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"}` (`TokenGroupAnswer`).

### `data`

- `complete` (boolean, always): true = every part of the scan answered. false = see missing; the answer is then not a rating.
- `missing` (array of strings, always): The parts of the scan that have no data (also in meta.partial as "security.\<part>"). Empty when complete. On eth, bsc, base and sol ask `security,holders` to fill "holders". "market": no market lists a pool for the token, so its liquidity is unknown and the low / dust liquidity checks could not run (verdict "Liquidity unknown: not rated"). Known values: `holders`, `tax`, `liquidity`, `contract`, `market` (more may come: handle unknown ones).
- `checks` (array of objects, always*): Every check the scan ran, with its outcome.
  - `id` (string, always): Stable id of the check. Known values: `honeypot`, `tax`, `lp_lock`, `mint`, `freeze`, `owner`, `source`, `contract`, `holders`, `liquidity` (more may come: handle unknown ones).
  - `label` (string, always): The check in words.
  - `state` (string, always): ok, warn, bad, or na (not answered). One of: `ok`, `warn`, `bad`, `na`.
  - `value` (string): What it found, in words ("0% / 0%", "top 10: 31%").
- `flags` (array of objects, always*): Findings, worst first. Empty = nothing found.
  - `id` (string, always): Stable id of the finding. Known values: `buy_tax_extreme`, `sell_tax_extreme`, `buy_tax_high`, `sell_tax_high`, `holders_concentrated`, `liquidity_dust`, `liquidity_low`, `very_new`, `mint_authority`, `freeze_authority`, `owner_active` (more may come: handle unknown ones).
  - `severity` (string, always): critical (a red flag), warn (risky), info (good to know). One of: `critical`, `warn`, `info`.
  - `title` (string, always): The finding in a few words.
  - `detail` (string): One more sentence about it.
- `verdict` (object, always*): The one-line answer.
  - `known` (boolean, always): true = enough checks answered to rate the token; false = not a rating, check it yourself.
  - `label` (string, always): The verdict in words ("No honeypot, no red flags", "Honeypot", "2 warnings", ...).
  - `level` (string, always): ok = nothing bad found, warn = look closer, danger = red flag (honeypot, critical finding). One of: `ok`, `warn`, `danger`.
  - `reasons` (array of strings, always): Short reasons behind the verdict (at most a few), most important first.
  - `sellable` (boolean): true = the sell simulation passed, false = it failed (honeypot). Absent = not simulated.
- `contract` (object): Contract facts (true / false; unknown = absent).
  - `freeze_authority` (boolean): Solana: true = the freeze authority is still set (wallets can be frozen).
  - `mint_authority` (boolean): Solana: true = the mint authority is still set (more tokens can be created).
  - `owner_renounced` (boolean): true = nobody owns the contract any more.
  - `proxy` (boolean): true = the contract is a proxy (its code can be swapped).
  - `verified_source` (boolean): true = the source code is verified on the explorer.
- `lp_lock` (object): Is the liquidity locked or burned?
  - `burned_pct` (number): Share of the liquidity that is burned. Percent (5.2 = 5.2 %).
  - `locked` (boolean): true = (part of) the liquidity is locked or burned.
  - `locked_pct` (number): Share of the liquidity that is locked. Percent (5.2 = 5.2 %).
  - `locker` (string): Who holds the lock (a locker service or contract).
  - `unlock_in_days` (number): Days until the lock ends.
- `score` (integer): Safety score 0-100 (higher is safer). Absent when the answer is not a rating (verdict.known false or something missing).
- `tax` (object): Trading taxes from the buy / sell simulation.
  - `buy_pct` (number): Buy tax. Percent (5.2 = 5.2 %).
  - `honeypot` (boolean): true = buying works but selling fails.
  - `max_tx_amount` (string): Largest amount one transaction may move, in tokens (absent = no limit found). Decimal string (never a float, no exponent).
  - `sell_pct` (number): Sell tax. Percent (5.2 = 5.2 %).
  - `transfer_pct` (number): Tax on a plain transfer between wallets. Percent (5.2 = 5.2 %).

### `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).
