Skip to main content
When you consume Explorer query results programmatically, run the query yourself and track the run_id it returns. This gives you a run you triggered and can poll for, so you always fetch results from a run whose status you know is success.
Scheduled query runs are best suited for viewing data in the Allium App. Get latest run returns the most recent run regardless of status, so a failed scheduled refresh can shadow the last good dataset. Triggering your own run avoids this — you hold the run_id and decide when the data is valid.

The workflow

1

Run the query

Call Run query with your query_id. The response returns a run_id for the run you just triggered.
2

Poll for status

Poll Fetch query run status with the run_id until the status is terminal. Treat success as ready, and failed or canceled as a retry signal.
Statuses created, queued, and running mean the run is still in progress — keep polling.
3

Fetch results

Once the status is success, call Fetch query run results with the same run_id to retrieve the dataset for the run you triggered.

Polling example

Because you hold the run_id for the entire loop, you never depend on the latest run being the one you want, and you don’t need a separate store to track run statuses or preserve the last successful run.

Example: fetch transactions for multiple wallets

A common pattern is fetching data for a list of addresses. The naive approach fires one query per address — each run costs an execution unit and a cold-start overhead. Pass all addresses in a single parameterized query instead and split the flat results in code.

Step 1 — Create the query

Use {{param_name}} syntax to define parameters. The {{addresses}} parameter will receive a SQL-safe, comma-separated list of quoted address strings.
Save this in the Allium App or via Create query and copy the returned query_id.

Step 2 — Run once for all wallets

Format your address list as SQL string literals before substituting into the parameter, then trigger a single run.

Step 3 — Split by wallet in code

The query returns a flat list. Group it by wallet on the application side.
If a tracked wallet sends to another tracked wallet, that transaction appears in both lists. Deduplicate on hash before grouping if you need a unique-transaction count.

Why this matters

Batching into a single run eliminates per-query startup cost. The result set is identical — the split is just done in code instead of across API calls.