# Rule types and bounds

- Section: Webhook management (TTF API reference)
- Source: https://ttf.bot/developers/docs/#api-webhook-schema
- The whole reference as one text: https://ttf.bot/developers/docs/llms-full.txt

`GET /v1/webhooks/schema`

- Base URL: `https://api.ttf.bot`
- Cost: Free
- Plan: Free
- API key: required. Send `Authorization: Bearer YOUR_KEY` (or `X-API-Key: YOUR_KEY`).
- A refused or failed call costs nothing.
- Key needs: webhooks: read

Read this first when you build a rule form: every rule type, the settings it takes, their limits and the chains you can name.

- The one-click page key has no webhook access: paste a key made with **Webhook access** ([how](https://ttf.bot/developers/docs/md/webhook-api.md)).

## Exact rules

The same description of the rule types, their settings, bounds and chains the dashboard builds its form from. Needs an API key with `webhooks: read` (write includes read). Costs 0 credits; counted in your account's webhook read limit.

## Parameters

No parameters: just send it.

## Example request

```bash
curl -sS 'https://api.ttf.bot/v1/webhooks/schema' \
  -H 'Authorization: Bearer YOUR_KEY'
```

Put your key in place of `YOUR_KEY`.

## Example answer

`200` (`default`): Rule types, fields and bounds

```json
{
  "data": {
    "chains": [
      {
        "id": "eth",
        "name": "Ethereum"
      },
      {
        "id": "sol",
        "name": "Solana"
      }
    ],
    "coverage_notes": {
      "denied": "This address is not watched.",
      "full": "",
      "native_only": "On this chain only native coin moves are watched.",
      "never": "This rule cannot fire.",
      "no_source": "No TTF signals are coming in yet.",
      "not_watched": "This chain is not watched for webhook wallets yet.",
      "partial": "Some addresses are not read at the moment.",
      "pending": "The watcher has not loaded this address yet."
    },
    "event_types": [
      "price",
      "trending",
      "wallet",
      "signal"
    ],
    "limits": {
      "description_max": 120,
      "rotate_overlap_s": 86400,
      "test_per_minute": 5
    },
    "plan_groups": {
      "pct_move": "core",
      "price_cross": "core",
      "signal": "signals",
      "trending_enter": "trending",
      "wallet_activity": "wallet"
    },
    "rule_types": {
      "pct_move": {
        "event": "price",
        "hint": "Fires when the price moved at least percent within the window.",
        "percent_bounds": [
          -99,
          10000
        ],
        "percent_min_abs": 0.1,
        "required": [
          "chain",
          "token",
          "window",
          "percent"
        ],
        "windows": [
          "15m",
          "1h",
          "4h",
          "24h"
        ]
      },
      "price_cross": {
        "event": "price",
        "hint": "Fires once when the price moves past the level.",
        "optional": [
          "fire_if_already_past"
        ],
        "price_bounds": [
          1e-18,
          1000000000000
        ],
        "required": [
          "chain",
          "token",
          "above | below"
        ]
      },
      "signal": {
        "coverage": "full",
        "event": "signal",
        "hint": "Fires on every TTF signal of that kind.",
        "kinds": [
          "breakout",
          "trending",
          "call"
        ],
        "required": [
          "kind"
        ]
      },
      "trending_enter": {
        "board_size": 30,
        "chains_max": 64,
        "coverage": {
          "chains": {
            "eth": [
              "honeypot",
              "liquidity_usd"
            ],
            "sol": [
              "liquidity_usd"
            ]
          },
          "filters": {
            "exclude_honeypot": {
              "group": "simulation",
              "value": "honeypot"
            },
            "min_liquidity_usd": {
              "group": "market",
              "value": "liquidity_usd"
            }
          },
          "groups": {
            "market": {
              "chains": [
                "eth",
                "sol"
              ],
              "note": "Market lookup of the board tokens: every chain it lists.",
              "values": [
                "liquidity_usd"
              ]
            },
            "simulation": {
              "chains": [
                "eth"
              ],
              "note": "The scan's buy / sell simulation: Ethereum-type (EVM) chains only.",
              "values": [
                "honeypot"
              ]
            }
          }
        },
        "enter_window_s": 900,
        "event": "trending",
        "filters": {
          "exclude_honeypot": {
            "group": "simulation",
            "kind": "flag",
            "label": "honeypot check",
            "op": "false",
            "value": "honeypot"
          },
          "min_liquidity_usd": {
            "bounds": [
              0,
              10000000000000
            ],
            "group": "market",
            "kind": "usd",
            "label": "liquidity",
            "op": "min",
            "value": "liquidity_usd"
          }
        },
        "hint": "Fires when a token enters the trending board.",
        "max_per_hour_bounds": [
          1,
          1000
        ],
        "min_scans_bounds": [
          1,
          100000
        ],
        "modifiers": [
          "whole_words"
        ],
        "never_days": 180,
        "optional": [
          "chain",
          "chains",
          "exclude_honeypot",
          "max_per_hour",
          "min_liquidity_usd",
          "per_chain",
          "repeat",
          "unknown"
        ],
        "repeats": [
          "1h",
          "6h",
          "24h",
          "never"
        ],
        "required": [
          "chain (or all)",
          "min_scans"
        ],
        "unknown_modes": [
          "skip",
          "mark"
        ],
        "word_len": 32,
        "words_max": 50
      },
      "wallet_activity": {
        "all_evm": {
          "chain_names": [
            "Base",
            "BSC",
            "Ethereum"
          ],
          "chains": [
            "base",
            "bsc",
            "eth"
          ],
          "coverage": "full",
          "id": "evm",
          "name": "All EVMs",
          "native_only_chains": [],
          "not_covered": [
            "arb"
          ]
        },
        "coverage": "full",
        "directions": [
          "out",
          "in",
          "any"
        ],
        "event": "wallet",
        "full_chains": [
          "base",
          "bsc",
          "eth"
        ],
        "hint": "Fires on a transfer of the wallet.",
        "min_usd_max": 1000000000000,
        "native_only_chains": [],
        "optional": [
          "min_usd",
          "direction"
        ],
        "required": [
          "chain",
          "address"
        ]
      }
    }
  },
  "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"}` (`HookSchemaAnswer`).

### `data`

- `chains` (array of objects, always): Chains a rule may name.
  - `id` (string, always): Chain id.
  - `name` (string, always): Its name.
- `coverage_notes` (object, always): Every coverage value in words.
  - `denied` (string, always): The note of coverage denied.
  - `full` (string, always): The note of coverage full.
  - `native_only` (string, always): The note of coverage native_only.
  - `never` (string, always): The note of coverage never.
  - `no_source` (string, always): The note of coverage no_source.
  - `not_watched` (string, always): The note of coverage not_watched.
  - `partial` (string, always): The note of coverage partial.
  - `pending` (string, always): The note of coverage pending.
- `event_types` (array of strings, always): Every event type. One of: `price`, `trending`, `wallet`, `signal`.
- `limits` (object, always): Fixed limits.
  - `description_max` (integer, always): Longest endpoint description.
  - `rotate_overlap_s` (integer, always): Seconds the previous secret keeps signing after a rotation.
  - `test_per_minute` (integer, always): Test deliveries a minute per endpoint.
- `plan_groups` (object, always): The plan data group each rule type needs.
  - `pct_move` (string, always): The group a pct_move rule needs.
  - `price_cross` (string, always): The group a price_cross rule needs.
  - `signal` (string, always): The group a signal rule needs.
  - `trending_enter` (string, always): The group a trending_enter rule needs.
  - `wallet_activity` (string, always): The group a wallet_activity rule needs.
- `rule_types` (object, always): Per rule type: the event it sends, its params and bounds.
  - `pct_move` (object, always): Price moves by a percentage.
    - `event` (string, always): The event type a rule of this kind sends.
    - `hint` (string, always): When it fires, in words.
    - `percent_bounds` (array of numbers, always): Smallest and largest percent.
    - `percent_min_abs` (number, always): Smallest size of a move.
    - `required` (array of strings, always): The params a rule of this kind needs.
    - `windows` (array of strings, always): Windows available now.
  - `price_cross` (object, always): Price crosses a level.
    - `event` (string, always): The event type a rule of this kind sends.
    - `hint` (string, always): When it fires, in words.
    - `optional` (array of strings, always): The optional params.
    - `price_bounds` (array of numbers, always): Smallest and largest price.
    - `required` (array of strings, always): The params a rule of this kind needs.
  - `signal` (object, always): A TTF signal.
    - `coverage` (string, always): full while TTF signals are coming in; no_source while the signal feed is off. Known values: `full`, `not_watched`, `never`, `partial`, `pending`, `denied`, `native_only`, `no_source` (more may come: handle unknown ones).
    - `event` (string, always): The event type a rule of this kind sends.
    - `hint` (string, always): When it fires, in words.
    - `kinds` (array of strings, always): Signal kinds a rule may name.
    - `required` (array of strings, always): The params a rule of this kind needs.
  - `trending_enter` (object, always): A token enters the trending board.
    - `board_size` (integer, always): Places on the trending board.
    - `chains_max` (integer, always): Most chains in chains / per_chain.
    - `coverage` (object, always): Which value each chain has: a filter on a value a chain does not have does not apply there.
      - `chains` (map of array of stringss, always): Per chain id, the values it has.
      - `filters` (map of objects, always): Per filter, its value and group.
        - `group` (string, always): Its coverage group.
        - `value` (string, always): The value it reads.
      - `groups` (map of objects, always): Coverage groups, by name.
        - `chains` (array of strings, always): The chains that have them.
        - `note` (string, always): Where the values come from, in words.
        - `values` (array of strings, always): Its values.
    - `enter_window_s` (integer, always): Seconds after entering the board a token may still pass.
    - `event` (string, always): The event type a rule of this kind sends.
    - `filters` (map of objects, always): Every filter, by param name.
      - `group` (string, always): Its coverage group.
      - `kind` (string, always): int, usd, pct, hours, enum, words or flag.
      - `label` (string, always): The value in words.
      - `op` (string, always): min, max, eq, words_any, words_none, true, false or pad.
      - `value` (string, always): The event data value it reads.
      - `bounds` (array of integers): Smallest and largest value (numbers).
      - `choices` (array of strings): The values it takes (enum).
    - `hint` (string, always): When it fires, in words.
    - `max_per_hour_bounds` (array of integers, always): Smallest and largest max_per_hour.
    - `min_scans_bounds` (array of integers, always): Smallest and largest min_scans.
    - `modifiers` (array of strings, always): Params that change how filters match (whole_words).
    - `never_days` (integer, always): How long repeat: never remembers a token, days.
    - `optional` (array of strings, always): The optional params (the filters, per_chain, repeat, max_per_hour, unknown).
    - `repeats` (array of strings, always): repeat values.
    - `required` (array of strings, always): The params a rule of this kind needs.
    - `unknown_modes` (array of strings, always): unknown values.
    - `word_len` (integer, always): Longest word.
    - `words_max` (integer, always): Most words in a word list.
  - `wallet_activity` (object, always): A watched wallet makes a transfer.
    - `all_evm` (object, always): All EVMs: a wallet rule with chain "evm" watches its wallets on every chain listed here (chains switched on later are added by themselves).
      - `chain_names` (array of strings, always): Their names, in the same order.
      - `chains` (array of strings, always): The chains an All EVMs rule watches now.
      - `coverage` (string, always): full when at least one chain is watched. Known values: `full`, `not_watched`, `never`, `partial`, `pending`, `denied`, `native_only`, `no_source` (more may come: handle unknown ones).
      - `id` (string, always): The chain value of an All EVMs rule: evm.
      - `name` (string, always): Its name.
      - `native_only_chains` (array of strings, always): Of them, the chains where only native coin moves are seen.
      - `not_covered` (array of strings, always): EVM chains a rule may name that are not watched yet (Solana and other non-EVM chains are never part of All EVMs).
    - `coverage` (string, always): full when wallets are watched on at least one chain. Known values: `full`, `not_watched`, `never`, `partial`, `pending`, `denied`, `native_only`, `no_source` (more may come: handle unknown ones).
    - `directions` (array of strings, always): Direction values.
    - `event` (string, always): The event type a rule of this kind sends.
    - `full_chains` (array of strings, always): Chains where wallet rules fire now.
    - `hint` (string, always): When it fires, in words.
    - `min_usd_max` (number, always): Largest min_usd.
    - `native_only_chains` (array of strings, always): Chains where only native coin moves are watched (no token transfers): rules there have coverage native_only.
    - `optional` (array of strings, always): The optional params.
    - `required` (array of strings, always): The params a rule of this kind needs.

### `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 |
| --- | --- | --- |
| 401 | `unauthorized` | The API key is missing or not valid. Codes: unauthorized. |
| 402 | `payment_required` | The subscription of this API key has ended. Codes: payment_required. |
| 403 | `forbidden` | The key lacks the webhook permission (or its plan, IP or account refuses the call), or a plan limit is reached. Codes: forbidden. |
| 404 | `not_found` | No such endpoint or rule in your account, or the webhook API is switched off. Codes: not_found. |
| 405 | `method_not_allowed` | Wrong HTTP method for this route. Codes: method_not_allowed. |
| 429 | `rate_limited` | Too many requests, or too many webhook reads or changes of your account. See Retry-After. Codes: rate_limited. |
| 500 | `internal` | Unexpected error. Codes: internal. |
| 503 | `unavailable` | The service cannot answer right now. See Retry-After. Codes: unavailable. |
| 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).
