# Check a rule without saving

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

`POST /v1/webhooks/rules/check`

- 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: write

Validate what a user typed before you create an endpoint or a rule for it. Nothing is saved.

- Handy for your own form: show `message` next to the field named in `field`.

## Exact rules

Validates a rule exactly as a create would (the watched-wallet quota is only checked by a create) and saves nothing. Needs an API key with `webhooks: write`. Costs 0 credits; counted in your account's webhook change and read limits.

## Parameters

No parameters: just send it.

## Request body

`application/json`, required.

- `params` (object, required): The settings of a rule. Which keys apply depends on the rule type (GET /v1/webhooks/schema).
  - `above` (number, optional): price_cross: fire when the price rises to this many US dollars (give above or below).
  - `address` (string, optional): wallet_activity: the wallet to watch (give address or addresses).
  - `addresses` (array of strings, optional): wallet_activity: a watchlist of up to 1000 wallets.
  - `below` (number, optional): price_cross: fire when the price falls to this many US dollars.
  - `chain` (string, optional): Chain id (price_cross, pct_move, wallet_activity; trending_enter also takes "all"; wallet_activity also takes "evm" = All EVMs: the wallets on every EVM chain TTF watches, chains added later included, each event naming the chain it happened on).
  - `chains` (array of strings, optional): trending_enter: a list of chains (instead of chain).
  - `direction` (string, optional): wallet_activity: out (default) = sent by the wallet, in = received, any = both. One of: `out`, `in`, `any`.
  - `exclude_honeypot` (boolean, optional): trending_enter: true = only tokens that pass the honeypot check check (not a honeypot).
  - `fire_if_already_past` (boolean, optional): price_cross: fire at once when the price is already past the level.
  - `kind` (string, optional): signal: the signal kind. One of: `breakout`, `trending`, `call`, `cmd`.
  - `launchpad` (string, optional): trending_enter (Solana): only = launchpad tokens, none = no launchpad detected by TTF (a graduated Moonshot token, a LaunchLab token without its suffix or a pump.fun mint whose read failed can still pass none). One of: `only`, `none`.
  - `max_age_hours` (number, optional): trending_enter: at most this age in hours (0 to 87600).
  - `max_buy_tax_pct` (number, optional): trending_enter: at most this buy tax in percent (0 to 100).
  - `max_liquidity_usd` (number, optional): trending_enter: at most this liquidity in US dollars (0 to 1e+13).
  - `max_market_cap_usd` (number, optional): trending_enter: at most this market cap in US dollars (0 to 1e+13).
  - `max_per_hour` (integer, optional): trending_enter: at most this many alerts in any 60 minutes. Range: 1 to 1000.
  - `max_price_change_1h_pct` (number, optional): trending_enter: at most this 1 h change in percent (-100 to 1e+06).
  - `max_rank` (integer, optional): trending_enter: at most this place (1 to 30).
  - `max_sell_tax_pct` (number, optional): trending_enter: at most this sell tax in percent (0 to 100).
  - `max_top10_pct` (number, optional): trending_enter: at most this top 10 share in percent (0 to 100).
  - `min_age_hours` (number, optional): trending_enter: at least this age in hours (0 to 87600).
  - `min_buys_1h` (integer, optional): trending_enter: at least this 1 h buys (0 to 1e+09).
  - `min_holders` (integer, optional): trending_enter: at least this holders (0 to 1e+09).
  - `min_liquidity_usd` (number, optional): trending_enter: at least this liquidity in US dollars (0 to 1e+13).
  - `min_locked_pct` (number, optional): trending_enter: at least this locked or burned liquidity in percent (0 to 100).
  - `min_market_cap_usd` (number, optional): trending_enter: at least this market cap in US dollars (0 to 1e+13).
  - `min_price_change_1h_pct` (number, optional): trending_enter: at least this 1 h change in percent (-100 to 1e+06).
  - `min_scans` (integer, optional): trending_enter: scans a token needs on the board.
  - `min_usd` (number, optional): wallet_activity: smallest transfer in US dollars (0 = every transfer).
  - `min_volume_24h_usd` (number, optional): trending_enter: at least this 24 h volume in US dollars (0 to 1e+13).
  - `name_exclude` (array of strings, optional): trending_enter: words matched in the name and symbol (none of; at most 50 words of 32 characters, plain text, not case sensitive).
  - `name_include` (array of strings, optional): trending_enter: words matched in the name and symbol (any of; at most 50 words of 32 characters, plain text, not case sensitive).
  - `pair_with` (string, optional): trending_enter: pair coin. One of: `native`, `stable`.
  - `per_chain` (map of objects, optional): trending_enter: per chain, its own filter values: an absent key inherits the value above, a present one is that chain's own, null = no limit on that chain. Only filters the chain has.
    - `exclude_honeypot` (boolean, optional): true = only tokens that pass the honeypot check check (not a honeypot).
    - `launchpad` (string, optional): trending_enter (Solana): only = launchpad tokens, none = no launchpad detected by TTF (a graduated Moonshot token, a LaunchLab token without its suffix or a pump.fun mint whose read failed can still pass none). One of: `only`, `none`.
    - `max_age_hours` (number, optional): at most this age in hours (0 to 87600).
    - `max_buy_tax_pct` (number, optional): at most this buy tax in percent (0 to 100).
    - `max_liquidity_usd` (number, optional): at most this liquidity in US dollars (0 to 1e+13).
    - `max_market_cap_usd` (number, optional): at most this market cap in US dollars (0 to 1e+13).
    - `max_price_change_1h_pct` (number, optional): at most this 1 h change in percent (-100 to 1e+06).
    - `max_rank` (integer, optional): at most this place (1 to 30).
    - `max_sell_tax_pct` (number, optional): at most this sell tax in percent (0 to 100).
    - `max_top10_pct` (number, optional): at most this top 10 share in percent (0 to 100).
    - `min_age_hours` (number, optional): at least this age in hours (0 to 87600).
    - `min_buys_1h` (integer, optional): at least this 1 h buys (0 to 1e+09).
    - `min_holders` (integer, optional): at least this holders (0 to 1e+09).
    - `min_liquidity_usd` (number, optional): at least this liquidity in US dollars (0 to 1e+13).
    - `min_locked_pct` (number, optional): at least this locked or burned liquidity in percent (0 to 100).
    - `min_market_cap_usd` (number, optional): at least this market cap in US dollars (0 to 1e+13).
    - `min_price_change_1h_pct` (number, optional): at least this 1 h change in percent (-100 to 1e+06).
    - `min_scans` (integer, optional): scans a token needs on the board.
    - `min_volume_24h_usd` (number, optional): at least this 24 h volume in US dollars (0 to 1e+13).
    - `name_exclude` (array of strings, optional): words matched in the name and symbol (none of; at most 50 words of 32 characters, plain text, not case sensitive).
    - `name_include` (array of strings, optional): words matched in the name and symbol (any of; at most 50 words of 32 characters, plain text, not case sensitive).
    - `pair_with` (string, optional): pair coin. One of: `native`, `stable`.
    - `require_freeze_disabled` (boolean, optional): true = only tokens that pass the freeze authority check (required).
    - `require_mint_disabled` (boolean, optional): true = only tokens that pass the mint authority check (required).
    - `require_renounced` (boolean, optional): true = only tokens that pass the ownership check (required).
    - `require_telegram` (boolean, optional): true = only tokens that pass the Telegram group check (required).
    - `require_verified_source` (boolean, optional): true = only tokens that pass the source code check (required).
    - `require_website` (boolean, optional): true = only tokens that pass the website check (required).
    - `require_x` (boolean, optional): true = only tokens that pass the X account check (required).
    - `whole_words` (boolean, optional): true = the words match whole words only.
  - `percent` (number, optional): pct_move: the move in percent (negative = a drop).
  - `repeat` (string, optional): trending_enter: the same token again only after this long (absent = once each time it enters the board; never = remembered for 180 days). One of: `1h`, `6h`, `24h`, `never`.
  - `require_freeze_disabled` (boolean, optional): trending_enter: true = only tokens that pass the freeze authority check (required).
  - `require_mint_disabled` (boolean, optional): trending_enter: true = only tokens that pass the mint authority check (required).
  - `require_renounced` (boolean, optional): trending_enter: true = only tokens that pass the ownership check (required).
  - `require_telegram` (boolean, optional): trending_enter: true = only tokens that pass the Telegram group check (required).
  - `require_verified_source` (boolean, optional): trending_enter: true = only tokens that pass the source code check (required).
  - `require_website` (boolean, optional): trending_enter: true = only tokens that pass the website check (required).
  - `require_x` (boolean, optional): trending_enter: true = only tokens that pass the X account check (required).
  - `token` (string, optional): Token address (price_cross, pct_move).
  - `unknown` (string, optional): trending_enter: skip (default) = no alert when a value a filter needs is unknown; mark = alert and list them in detail.unknown. One of: `skip`, `mark`.
  - `whole_words` (boolean, optional): trending_enter: true = the words match whole words only.
  - `window` (string, optional): pct_move: the time window. One of: `1m`, `5m`, `15m`, `1h`, `4h`, `24h`.
- `type` (string, required): The rule type. One of: `price_cross`, `pct_move`, `trending_enter`, `wallet_activity`, `signal`.
- `enabled` (boolean, optional): As in a new rule.
- `endpoint_id` (string, optional): Also check this endpoint's event types and plan limit.
- `labels` (map of strings, optional): Wallet labels: address -> text.
- `name` (string, optional): A name. At most 60 characters.

Example body:

```json
{
  "params": {
    "above": 1e-05,
    "chain": "eth",
    "token": "0x6982508145454ce325ddbe47a25d4ec3d2311933"
  },
  "type": "price_cross"
}
```

## Example request

```bash
curl -sS -X POST 'https://api.ttf.bot/v1/webhooks/rules/check' \
  -H 'Authorization: Bearer YOUR_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "params": {
    "above": 1e-05,
    "chain": "eth",
    "token": "0x6982508145454ce325ddbe47a25d4ec3d2311933"
  },
  "type": "price_cross"
}'
```

Put your key in place of `YOUR_KEY`.

## Example answer

`200` (`default`): Check a rule without saving

```json
{
  "data": {
    "coverage": "full",
    "coverage_note": "",
    "ok": true
  },
  "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"}` (`HookRuleCheckAnswer`).

### `data`

- `coverage` (string, always): What the sources deliver for this rule (coverage_note says it in words). Known values: `full`, `not_watched`, `never`, `partial`, `pending`, `denied`, `native_only`, `no_source` (more may come: handle unknown ones).
- `coverage_note` (string, always): The coverage in words (empty text when full).
- `ok` (boolean, always): true.

### `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: an unknown field or a bad value. Nothing changed. Codes: bad_request. |
| 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` `quota_exceeded` `account_suspended` `plan_required` | The key lacks the webhook permission (or its plan, IP or account refuses the call), or a plan limit is reached. Codes: forbidden, quota_exceeded, account_suspended, plan_required. |
| 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. |
| 408 | `request_timeout` | The request body did not arrive in time. Nothing changed. Codes: request_timeout. |
| 409 | `over_limit` | The change conflicts with the current state. Nothing changed. Codes: over_limit. |
| 413 | `too_large` | The body is too large. Codes: too_large. |
| 415 | `unsupported_media_type` | The body is not declared as JSON. Codes: unsupported_media_type. |
| 422 | `invalid_rule` `type_not_subscribed` | The URL or the rule was refused. Nothing changed. Codes: invalid_rule, type_not_subscribed. |
| 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).
