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[]
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 answers400 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
toBlockpast the head is lowered to the head. The response’sto_blocksays what you actually got.fromBlockpast the head returns no rows (not an error) andnext_blockequal to yourfromBlock, 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_blockpoints to where the next page starts.