Run a scan
https://api.tickerbot.io/ v2/ scanScreens every ticker with a SQL WHERE clause and returns the matches. Run it now, or add asof to backtest it on any past date.
Body parameters
stringrequiredSQL WHERE expression. Max 4000 chars; semicolons, comments and write keywords are rejected. Your custom signals are valid here: each expands to its SQL at run time. To scan named tickers: ticker IN ('AAPL', 'MSFT'); to scan one asset class: asset_class = 'crypto'. See the signals catalog for columns + flags you can compose.
stringScope to a built-in universe (top_10, top_100) or one of your own, by id. An unknown one answers 200 with no results and its id in not_found. Omitted, the screen runs across every ticker.
stringTarget moment as YYYY-MM-DD (that day's close) or an ISO timestamp (that intraday moment; daily-only signals then carry the previous session's close, never that day's): the same read as it stood then. In q, now() and current_date mean that moment, so last_earnings_date >= now() - interval '7 days' backtests as written. Full contract under As of a past date.
stringenumdefault autoOnly with asof. Grain the past state is read at: 1m, 1h, 1d or auto (default). auto blends: each signal comes from its freshest grain at or before the instant (minute, then hourly, then the last closed daily session), so nothing is refused for grain and no ticker is dropped; _meta.blended and _meta.grains_present say what contributed. Pin a grain for the fastest response: one grain is read instead of three, and every ticker is captured on the same clock. A signal the pinned grain does not store is a 400 interval_unavailable naming the grains that carry it (rsi_14, fundamentals and valuation ratios are 1d-only). 1m and 1h need a timestamp asof; with a bare date they are a 400 interval_unavailable. Under auto, _meta.plan_limits.grain names the finest grain served when a finer one was not served, and where finer is.
1m | Minute. The one-minute state at or before the instant. Covers the most liquid tickers and the signals stored at one minute. Needs a timestamp asof; with a bare date it is a 400 interval_unavailable. |
1h | Hour. The hourly state at or before the instant. Covers every ticker and the signals stored hourly. Needs a timestamp asof; with a bare date it is a 400 interval_unavailable. |
1d | Day. The last daily session closed before the instant; a bare date reads that day’s close. Covers every ticker and the most signals, including the daily-only ones such as rsi_14, fundamentals and valuation ratios. |
autodefault | Auto. Each signal from its freshest grain at or before the instant: minute, then hourly, then the last closed daily session. _meta.blended and _meta.grains_present say what contributed. |
string[]What each result carries, as in SQL. Omitted: the default row (ticker, name, asset_class, asset_type, price, change_1d_pct, gap_pct, relative_volume, market_cap) plus every signal used in q and order; a custom signal appears as its own value, and a cross-ticker reference (SPY.sma_50) is not added. A list: exactly those items, ticker always included; expressions with AS work (price / sma_50 AS dist) and are validated like q. *: every signal in the catalog. All aggregates (count(*), avg(rsi_14)) without group_by: one summary row, in results. With group_by, each item is an aggregate or a group key. Aggregates: count/avg/sum/min/max/stddev/string_agg/bool_and/bool_or, plus FILTER (WHERE …).
string[]Groups the scan: 1–6 group keys (signals, expressions or one of your custom signals as a boolean key). Results become rollups in results, each carrying its keys. Name a key with AS to choose its JSON key (market_cap > 1e11 AS mega); an un-named expression is named for you. Default select: the keys + COUNT(*) AS tickers. Works with asof; does not paginate.
stringOnly with group_by. Filter the rollups. Custom signals are valid here too.
stringdefault change_1d_pctSignal to sort by; it joins the default row. On a grouped scan the default is the count alias tickers (or, with a custom select, the last item's alias, so alias it with AS), sorted NULLS LAST with the group keys as tiebreak.
stringenumdefault descSort direction.
asc | Ascending: smallest or earliest first. |
descdefault | Descending: largest or most recent first. |
integerdefault 50Page size: rows on a row scan, groups on a grouped scan. Max 1000. Grouped scans do not paginate: without limit they return every group up to 1000, and truncated: true when groups were cut, so sort with order to keep the ones you want.
stringThe previous response's next_cursor. Send it with the same params as the first page (limit may change); a page whose params differ is a 400 naming the param. Row scans only.
Returns
as_ofstringServer time this response was assembled (ISO 8601); on an as-of read, the instant you asked for (as_of); when _meta.data_as_of_close or _meta.delayed_minutes is present, the time the data is from.
queryobjectYour query, echoed in param order (q, universe, asof, grain, select, group_by, having, order, dir, limit, cursor), each with its effective value: select lists the signals each result carries.
_metaobjectPresent when there is something to disclose. Row scans add null_coverage: per signal in the predicate (under signals), how many in-scope tickers are null and therefore never evaluated; absence from results means "no value", not "did not match". With asof: grain_scope (the snapshot spans every ticker in scope at one grain), signals_not_stored_at_grain (default-row signals this grain does not store, returned as null), minute_only_signals_fell_back_to_daily, empty_diagnostic (on an empty result, each signal's coverage at that instant) and a note naming the signals that have no history and show today's value. Shared keys: see the _meta reference.
countnumberRows in this page (matches on a row scan, groups on a grouped scan). It is not a total: for one, scan with select=count(*).
not_foundstring[]With universe only: the universe id you named when it does not exist (the scan then has no results). Absent otherwise.
next_cursorstringOpaque token for the next page; null on the last page. Pass it back as cursor. Row scans only.
truncatedbooleanOn grouped scans (group_by, or a select of aggregates alone), on every response: true when the rollup stopped at its result cap, false when the list is whole. Grouped responses are unpaged, so next_cursor is absent there.
resultsarrayRow scans: one result per match, carrying what select asked for (see select). Grouped scans (group_by, or a select of aggregates alone): one row per group, carrying the group keys, then the select items under their aliases (default: tickers, the count). A select of aggregates alone without group_by returns one row.
Status codes
| Code | Meaning |
|---|---|
200 | Success: the response shape is documented under Returns above. |
400 | bad_request, invalid_query, interval_unavailable or unknown_parameter: malformed q or select, unknown signal, a pinned grain that does not store a signal you named or comes with a bare-date asof, a select that mixes aggregates with per-ticker items or names an item that is neither an aggregate nor a group key, invalid order/dir, having without group_by, a cursor on a grouped scan, or an unknown parameter (the message names the one to use: where → q, order_by → order, tickers → q). |
403 | history_limit_exceeded: asof is older than your plan's history depth. grain_not_on_plan: a pinned grain finer than your plan's precision. See Limits. |
Notes
- GET /v2/scan is a permanent alias of this call: GET takes the same params in the query.
- To get an alert when a ticker starts matching, subscribe the same screen: Subscribe to a scan.
- A
nullin a result means that ticker has no value for the signal, not that the signal was dropped. - Ties sort by ticker, so pages are stable.
- Context tickers:
spy.price > spy.sma_50pulls SPY's signals into the same screen, evaluated at the same instant (underasoftoo). The qualifier is any symbol the catalog returns: an ETF (spy), any equity (nvda), a rate (r:sofr) or a crypto or FX pair (x:btcusd). - A qualifier that is not in the catalog is a
400 unknown_context_tickernaming it, never a raw SQL error or a silent empty result. - Symbols with a dot or hyphen in them (
BRK.B) cannot be qualifiers: the dot is the separator. Everything else in the catalog can, including prefixed ids (r:sofr,x:btcusd). vixanddxyanswer400 context_ticker_unavailable.- There is no cap on refs per screen beyond the 4,000-character limit on
q; each ref is one indexed lookup evaluated once per screen, whatever the symbol. - Refs inside a custom signal's
exprare not rewritten. Keep custom signals single-ticker and put the context ref inq.
More examples
Backtest it on a past date
curl -X POST "https://api.tickerbot.io/v2/scan" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "above_sma_200 AND market_cap > 1e10",
"asof": "2026-08-25",
"order": "change_1d_pct",
"dir": "desc",
"limit": 5
}'Choose what each result carries
curl -X POST "https://api.tickerbot.io/v2/scan" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "above_sma_200 AND market_cap > 1e10",
"select": "price, pe_ratio, price / sma_200 AS dist_200",
"limit": 1
}'Market breadth by sector (grouped scan)
curl -X POST "https://api.tickerbot.io/v2/scan" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "above_sma_200 AND market_cap > 1e9",
"group_by": "sector",
"having": "COUNT(*) >= 10"
}'Count the matches (one summary row)
curl -X POST "https://api.tickerbot.io/v2/scan" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "above_sma_200 AND market_cap > 1e10",
"select": "count(*) AS n, avg(rsi_14) AS avg_rsi"
}'Pagination: pass next_cursor back in the body
curl -X POST "https://api.tickerbot.io/v2/scan" \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "market_cap>300000000",
"order": "ticker",
"dir": "asc",
"limit": 100,
"cursor": "<next_cursor from the previous page>"
}'