Skip to main content
A query is a JSON object sent as the body of POST /query or POST /query/json.

Keys

integer
default:"0"
First block of the range, inclusive.
integer
default:"chain head"
Last block of the range, inclusive. A value above the head is lowered to the head, without an error. Leave it out to read up to the head.
integer
default:"100000"
How many objects (blocks + transactions + logs) a response should hold before it stops. A target, not a hard cap: a response ends at the first block where the count reaches it, with that block included whole. Values above 100,000 are lowered to 100,000. See Pagination.
object[]
Log filters. A log is returned if it matches any object in the list. See Filters.
object[]
Transaction filters. A transaction is returned if it matches any object in the list.
boolean
default:"false"
Add the transaction of every matched log to the transactions stream. See Joining logs to transactions.
integer
Keep only blocks whose number is ≡ blockOffset (mod blockInterval) in the blocks stream. Needs block fields. See Sampling blocks.
integer
default:"0"
Offset for blockInterval; must be smaller than it.
boolean
default:"false"
Answer 400 invalid_query when a selected field doesn’t exist on this chain, instead of returning it as an all-null column. See Fields a chain doesn’t have.
object
required
Columns to return, per row type: log, transaction, block (singular). Each is an object of "<fieldName>": true. See Fields.
string
Instead of the filters and fields: the id of a prepared query. Only fromBlock, toBlock, maxObjects and strictFields may accompany it.

Which row types come back

logs absent or [] means “don’t query logs at all” (no rows, no cost). [{}] means “every log in the range”. The same goes for transactions.

Rules

The server validates the whole request before it reads any data, and answers 400 invalid_query with a message that names the problem: Unknown keys are always errors, never silently ignored. A typo can’t quietly give you fewer columns or a broader filter than you meant.

Range behavior

  • toBlock past the head is lowered to the head. The response’s to_block says what you actually got.
  • fromBlock past the head returns no rows (not an error) and next_block equal to your fromBlock, so a client waiting for a new block simply repeats the request.
  • Wide ranges are not refused. A response covers at most 50,000 blocks; next_block points to where the next page starts.
Always read the effective range from the response (from_block, to_block, next_block), never from what you sent. Near the head, the range you asked for and the range you got differ.