Docs / API: Alert rules
Validate a rule
Parses a Beamline expression and tests it against the last 2,000 stored transfers. No key is needed.
POST/api/v1/rules/validate
| Property | Value |
|---|---|
| Authentication | Optional. A key raises your limit. |
| Rate-limit cost | 1 unit |
| Status | Live |
#Request body
JSON
{
"expression": "usd >= 1m and token in [\"USDC\",\"USDT\"]"
}#Request
curl -s -X POST "https://farbeamlabs.com/api/v1/rules/validate" \
-H "content-type: application/json" \
-d '{"expression": "usd >= 1m and token in [\"USDC\",\"USDT\"]"}'const res = await fetch("https://farbeamlabs.com/api/v1/rules/validate", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"expression": "usd >= 1m and token in [\"USDC\",\"USDT\"]"})
});
const { data, meta, error } = await res.json();
if (error) throw new Error(`${error.code}: ${error.message}`);
console.log(data);import os, requests
res = requests.post(
"https://farbeamlabs.com/api/v1/rules/validate",
json={'expression': 'usd >= 1m and token in ["USDC","USDT"]'},
timeout=30,
)
body = res.json()
if "error" in body:
raise RuntimeError(body["error"]["code"])
print(body["data"])You can send this request now in the API playground.
#Response
This response is real. It was captured from the running API when this page was built. Arrays are cut to two items.
JSON
{
"data": {
"valid": true,
"tested": 2000,
"matched": 72,
"sample": [
{
"id": 7252,
"uid": "ethereum:0xc613d9da59a1f0c4b39e90cc6ab7d991a4822a976fa28cddd1cbd29a1174f418:493",
"ts": "2026-11-04T20:10:35.000Z",
"chain": "ethereum",
"block": 26343752,
"tx": "0xc613d9da59a1f0c4b39e90cc6ab7d991a4822a976fa28cddd1cbd29a1174f418",
"kind": "token",
"token": "USDC",
"token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": 2500000,
"usd": 2499205,
"from": "0xd1dd6d99c5fb5d31ff52eacce5046c7158859e85",
"to": "0x3b4d794a66304f130a4db8f2551b0070dfcf5ca7",
"sampled": false,
"from_label": null,
"from_type": null,
"to_label": null,
"to_type": null
},
{
"id": 7251,
"uid": "ethereum:0x576b377d0019eac57b90f9080c0994150e15a6e4014cc52448ddb6cabd0c3ae3:19",
"ts": "2026-11-04T20:10:35.000Z",
"chain": "ethereum",
"block": 26343752,
"tx": "0x576b377d0019eac57b90f9080c0994150e15a6e4014cc52448ddb6cabd0c3ae3",
"kind": "token",
"token": "USDC",
"token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"amount": 1351931,
"usd": 1351501.085942,
"from": "0x420ad888c9524fd5929401730e633b079e70378a",
"to": "0x2a500f79c651759f12e67fedb7748ef2449590cf",
"sampled": false,
"from_label": null,
"from_type": null,
"to_label": null,
"to_type": null
}
],
"fields": [
"chain",
"token"
]
},
"meta": {
"request_id": "req_44d029c27159",
"as_of": "2026-11-04T20:10:58.168Z"
}
}#Errors
| HTTP | Code | Meaning |
|---|---|---|
| 422 | invalid_rule | The expression did not parse. The message gives the position. |
| 400 | invalid_json | The body is not a JSON object. |
All errors share one format. See errors.