ClickAPIs
Docs · Query

Docs / Endpoints

Query

POST/v1/queryunits: 1 + expressions × decadesintraday

Evaluate any expressions over a symbol’s history and keep only the bars where a condition holds. Same expression language as screens, event studies and backtests.

Add "async": true to run it as a job, and "webhook_url" to be called when it finishes (Jobs & async). Calls estimated above 1,000 units run as jobs automatically. Supports interval for intraday bars at 5× the units (Intraday).

Parameters

FieldTypeDefaultDescription
symbolrequiredstring—Ticker.
selectrequiredarray of string—Columns to compute, each "expr as name" or a bare expression.
wherestring (expression)—Keep only bars where this condition is true.
start_datedate—YYYY-MM-DD. First date to include. Default: the full history available.
end_datedate—YYYY-MM-DD. Last date to include. Default: the latest bar.
sortstring"date"Column name to sort by (a name from select, or date).
order"asc" | "desc""desc"Sort direction.
limitinteger100Rows to return, ≤ 5000.
intervalstring"1day""1day" | "1hour" | "30min" | "15min" | "5min" | "1min". Intraday costs 5× the units; see Intraday.

Example request

Days AAPL traded three times its normal volume Read the walkthrough →

Request POST /v1/query
{
  "symbol": "AAPL",
  "select": [
    "close",
    "ret as day_return",
    "rvol(20) as rel_volume",
    "close / sma(200) - 1 as dist_200d"
  ],
  "where": "rvol(20) > 3",
  "limit": 10
}
The same call with curl, Python and JavaScript
curl https://clickapis.com/v1/query \
  -H "Authorization: Bearer $CLICKAPIS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"symbol":"AAPL","select":["close","ret as day_return","rvol(20) as rel_volume","close / sma(200) - 1 as dist_200d"],"where":"rvol(20) > 3","limit":10}'
import os, requests

r = requests.post(
    "https://clickapis.com/v1/query",
    headers={"Authorization": f"Bearer {os.environ['CLICKAPIS_KEY']}"},
    json={
      "symbol": "AAPL",
      "select": [
        "close",
        "ret as day_return",
        "rvol(20) as rel_volume",
        "close / sma(200) - 1 as dist_200d"
      ],
      "where": "rvol(20) > 3",
      "limit": 10
    },
    timeout=60,
)
print(r.json()["data"])
const r = await fetch("https://clickapis.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.CLICKAPIS_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "symbol": "AAPL",
    "select": [
      "close",
      "ret as day_return",
      "rvol(20) as rel_volume",
      "close / sma(200) - 1 as dist_200d"
    ],
    "where": "rvol(20) > 3",
    "limit": 10
  }),
});
console.log((await r.json()).data);

Example response

Response 200 OK
{
  "ok": true,
  "data": {
    "symbol": "AAPL",
    "columns": [
      "date",
      "close",
      "day_return",
      "rel_volume",
      "dist_200d"
    ],
    "rows_matched": 116,
    "sort": "date",
    "order": "desc",
    "rows": [
      {
        "date": "2026-06-26",
        "close": 283.54,
        "day_return": 0.031392,
        "rel_volume": 3.907235,
        "dist_200d": 0.054664
      },
      {
        "date": "2024-09-20",
        "close": 226.31,
        "day_return": -0.002908,
        "rel_volume": 5.245378,
        "dist_200d": 0.164473
      },
      {
        "date": "2024-06-12",
        "close": 211.06,
        "day_return": 0.028608,
        "rel_volume": 3.007962,
        "dist_200d": 0.172656
      },
      {
        "date": "2019-07-31",
        "close": 50.92,
        "day_return": 0.020441,
        "rel_volume": 3.2246,
        "dist_200d": 0.146663
      },
      {
        "date": "2018-08-01",
        "close": 47.44,
        "day_return": 0.058929,
        "rel_volume": 3.159113,
        "dist_200d": 0.147354
      },
      {
        "date": "2017-02-01",
        "close": 29.59,
        "day_return": 0.060954,
        "rel_volume": 3.464163,
        "dist_200d": 0.205303
      },
      {
        "date": "2016-09-14",
        "close": 25.56,
        "day_return": 0.035237,
        "rel_volume": 3.12957,
        "dist_200d": 0.104283
      },
      {
        "date": "2016-04-27",
        "close": 22.11,
        "day_return": -0.062738,
        "rel_volume": 3.066285,
        "dist_200d": -0.103701
      },
      {
        "date": "2014-09-09",
        "close": 21.57,
        "day_return": -0.003695,
        "rel_volume": 3.195199,
        "dist_200d": 0.169128
      },
      {
        "date": "2012-02-15",
        "close": 14.89,
        "day_return": -0.022966,
        "rel_volume": 3.137295,
        "dist_200d": 0.29327
      }
    ],
    "interval": "1day"
  },
  "meta": {
    "op": "query",
    "units": 26,
    "cost_usd": 0.0,
    "billing": "internal",
    "free_call": false,
    "free_calls_left": 0,
    "balance_usd": 5.0,
    "ms": 1,
    "interval": "1day",
    "data_as_of": "2026-11-12",
    "partial_last_bar": false
  }
}

Every response has the same envelope: ok, data and meta (op, units, cost_usd, ms, interval, billing, balance_usd, data_as_of, partial_last_bar). Numbers are decimals (0.05 = 5%), dates ISO, and a value that cannot be computed is null.

More examples