> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Query Result

Retrieve results from a Dune Analytics query by query ID. Returns cached results including rows, column metadata, and execution timing. Supports pagination, sorting, and filtering. Ideal for: blockchain analytics, on-chain metrics, historical data analysis, custom dashboards.

![Get Query Result logo](https://ai-icon.b3.fun/logo/dune)
Catalog action Blockchain Data

Retrieve results from a Dune Analytics query by query ID. Returns cached results including rows, column metadata, and execution timing. Supports pagination, sorting, and filtering. Ideal for: blockchain analytics, on-chain metrics, historical data analysis, custom dashboards.


## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `dune-get-query-result` |
| Category | Blockchain Data |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | `dune`, `query`, `analytics`, `blockchain`, `data`, `read` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `queryId` | `number` | Yes | The Dune query ID to fetch results for. |
| `limit` | `number` | No | Maximum number of rows to return. Default: returns all rows. |
| `offset` | `number` | No | Number of rows to skip for pagination. |
| `sortBy` | `string` | No | SQL ORDER BY clause-style expression defining result sort order \(e.g., 'date desc', 'amount asc'\). |
| `filters` | `string` | No | SQL WHERE clause-style expression to filter result rows. Incompatible with sampleCount. |
| `columns` | `string` | No | Comma-separated list of specific column names to return. Omit to return all columns. |
| `sampleCount` | `number` | No | Return uniformized sample of specified row count from results. Incompatible with offset, limit, and filters. |
| `allowPartialResults` | `boolean` | No | Enable retrieval of query results that exceeded size limits with only partial data available. |
| `ignoreMaxDatapointsPerRequest` | `boolean` | No | Bypass default 250,000 datapoint limit safeguard. Use to prevent accidental credit overages. |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `executionId` | `string` | Yes | Unique identifier for this query execution. |
| `queryId` | `number` | Yes | The query ID that was executed. |
| `isExecutionFinished` | `boolean` | Yes | Whether the query execution has finished. |
| `state` | `string` | Yes | Current execution state. |
| `submittedAt` | `string` | Yes | ISO timestamp when the query was submitted. |
| `expiresAt` | `string` | Yes | ISO timestamp when the cached results expire. |
| `executionStartedAt` | `string` | Yes | ISO timestamp when execution started. |
| `executionEndedAt` | `string` | Yes | ISO timestamp when execution ended. |
| `cancelledAt` | `string` | No | ISO timestamp when execution was cancelled \(if applicable\). |
| `result` | `object` | No | Query results \(only present when state is COMPLETED\). |
| `error` | `object` | No | Error information \(only present when state is FAILED\). |
| `nextOffset` | `number` | No | Offset for fetching next page of results \(for pagination\). |
| `nextUri` | `string` | No | URI for fetching next page of results. |

## Examples

**Workflow node**

```json
{
  "type": "dune-get-query-result",
  "payload": {
    "queryId": 1
  },
  "children": []
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/dune-get-query-result/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "queryId": 1
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.