Run a read-only HQL query

POST /Platform/query/hql

Run a read-only HQL query. Returns JSON-safe rows.

HQL is the Hilus Query Language; its grammar and examples come from the query syntax operation. This operation only reads: a DELETE statement goes to the query service's delete operation, and targeted writes or tool runs to the entities delete / jobs execute-tool operations.

The default return_mode="llm_safe" makes every value a JSON-native scalar: binary dtypes become their hash plus a metadata excerpt (via .summary()), datetimes become ISO strings, and strings longer than max_chars are cut with a self-announcing …[truncated, N more chars] marker. When anything was cut, the response also carries truncated_values (a count) and a hint; rerun with a larger max_chars, or read the one full field with a single-field read (get with paths) on the entities service.

A query can also read a list inside a stored value (a tool result or report that came back as a handle) as a table: handle('<ref>', '<path>', headers='<path>') | .... Its rows can be exploded (explode a, b makes one row per line of multi-line cells, lined up by position), filtered, grouped by several keys with min/max/count/collect and as names, filtered after grouping with having, sorted by several keys and paged with offset. Dates (M/D/YYYY, ISO) and phone numbers compare as dates and numbers. x not in handle('<ref>', '<path>', column='<name>') excludes the values of a second handle. Unknown columns are refused with the list of columns. The query syntax operation documents every clause.

Query cost lives in two places. Projection: without select a query returns every column — large text and binary payloads included — and can time out on wide types (Call, Conversation, Document) even at limit 1; select the fields you need (field names per type: the entities describe operation). Search operator: ~* (fulltext), ~= (vector), ~~ (hybrid) use indexes; ILIKE gives exact substring/wildcard semantics but scans unindexed, so reserve it for when those semantics matter and other filters are narrow.

Log reads log lines. A member of an organization sees only their organization's own lines (errors that need them and what their agents did outside Hilus) and only the fields the query syntax operation lists for Log, over the last 7 days unless a timestamp filter says otherwise (at most 90).

Body parameters

Returns

QueryRows

Example request

curl -X POST "https://api.hilus.ai/Platform/query/hql" \
  -H "Authorization: Bearer $HILUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'