Dune CLI
The Dune CLI lets you query, explore, and manage blockchain data without leaving your terminal. All commands support both human-readable and JSON output, making them equally useful for interactive work and agent-driven workflows.Install
- Homebrew
- Install script
- Nix
On macOS and Linux:Then run
dune auth to configure your API key, and npx skills add duneanalytics/skills to add the Dune Agent Skill.You need a Dune API key with the Read/Write scope. Create one on dune.com under Connect > API keys. Connect > MCP & CLI shows the install commands. With a Read key, the commands that call Dune MCP fail with
403, including read commands such as dune query get. See Dune CLI and Dune MCP.Authenticate
The CLI uses the first API key it finds: the--api-key flag, then the DUNE_API_KEY environment variable, then the key that dune auth saved in ~/.config/dune/config.yaml.
Run your first query

Usage
Rundune --help for all commands. Add -o json to any command for output that scripts and agents can parse:
--config, --parameters, and the --sql flag of query create, also accept @path to read a file or @- to read standard input. Run dune <command> --help for all flags and examples of a command.
The commands below are in Dune CLI v0.1.24. Run dune --version to see your version. To update, run brew upgrade dune-cli, or run the install script again.
When a command fails because of your plan, for example because the account used its credits, hit a rate limit, or has an unpaid invoice, the CLI prints the error and then links to the page that fixes it: dune.com/pricing to upgrade, or your plan settings to change the extra credits limit or the payment details.
Commands
The MCP tool column names the Dune MCP tool that does the same thing, so you can move a workflow between the CLI and the MCP. See Dune CLI and Dune MCP for the differences.Queries and executions
dune execution list and dune execution cancel need a team API key. A run is shared when other users submit the same SQL on the same engine while it is running, and cancelling it stops it for them too, so dune execution cancel asks before it cancels. Add --yes to skip the question, for example in a script.
dune query alert sets the query’s schedule, so every scheduled run uses credits at the tier that you set. Most paid plans do not allow small for schedules, so use medium unless your plan allows small. A query has one alert per channel, and a new alert replaces the alert on that channel. A webhook URL is a secret: pass it as @path or @- to keep it out of your shell history. Run dune query alert --help for the cron expressions that Dune supports. To stop the alert, stop the schedule with dune schedule delete --query-id <id>.
query run, query run-sql, and query create-and-run accept --performance small|medium|large, --limit, and --timeout. Omit --performance to let Dune select the tier for your plan. Most paid plans do not allow small for API runs, so if you set it, use medium unless your plan allows small. With --no-wait, query run and query run-sql return the execution ID immediately, so you can get the rows later with dune execution results.
dune execution results can shape the results on the server, so your agent downloads only the rows and columns it needs:
--filter takes a WHERE-like expression and --sort-by takes an ORDER BY fragment. --sample returns about that many random rows and you cannot use it with --limit or --offset.
Datasets
Visualizations
dune visualization has the alias dune viz.
The MCP tool
renderVisualization shows a chart inside an AI chat client and has no CLI command. Use the chart and image links from dune viz get instead.
--counter-label of dune viz update sets the caption shown with a counter’s number. An empty value removes it.
--chart-type is column, line, area, scatter, pie, counter, or table. The chart config refers to the query’s result columns by name, and the names must match exactly, so look at the columns first with dune execution results. Run dune viz create --help for the config format of each chart type.
Dashboards
dune dashboard has the alias dune dash.
Get a widget’s ID and type (
visualization, text, or param) from dune dashboard get <dashboard-id> -o json. The dashboard grid has 6 columns.
dune dashboard image uses each query’s latest completed results and does not run any query. A private dashboard’s own share links do not change. A team whose privacy setting is Private only gets no image, because that setting disables share links. Dune does not render the image when a chart shows enterprise datasets that are not available to AI tools, or a query that never completed; the command then fails and lists those charts. It also fails when the image is too large to return; open the dashboard on dune.com instead.
Folders
Schedules and materialized views
Cron expressions have 5 parts and use UTC. Every scheduled run uses credits at the tier that you set. Most paid plans do not allow
small for schedules, so use medium unless your plan allows small. Run dune schedule set --help for the cron expressions that Dune supports.
Contract decoding
Docs, usage, and account
Dune CLI and Dune MCP
You can do what every Dune MCP tool does with the CLI, except two tools:renderVisualizationshows a chart inside an AI chat client. In a terminal, use the chart and image links fromdune viz get.submit_feedbacksends Dune feedback about the MCP tools themselves. To report a problem with the CLI, open an issue in the duneanalytics/cli repository.
dune query run-sql runs DuneSQL without saving a query, and dune auth, dune whoami, dune config, and dune completion set up the CLI.
The CLI signs in with an API key, not with your Dune account. It calls the Dune REST API, and calls the Dune MCP with the same API key for the commands that the REST API does not support yet.
Dune MCP accepts only API keys with the Read/Write scope. With a Read key, these commands fail with 403 (Not authorized) when they connect to the MCP, even the ones that only read:
dune query search,dune query get,dune query results,dune query create,dune query create-and-run,dune query update, anddune query alertdune execution listanddune execution canceldune dataset search,dune dataset blockchains, anddune dataset sizedune viz get,dune viz createwith--chart-type, anddune viz updatewith--chart-typeor--counter-labeldune dashboard search,dune dashboard update-widget, anddune dashboard imagedune matview get
dune auth.
Roles and view-only accounts
The CLI works as the key’s owner, so the owner’s role and plan decide what it can do:- Team viewers. Only team admins and editors can create team API keys. A viewer’s personal API key works in the viewer’s personal account, not in the team.
- View-only accounts. A team with view-only Free access, for example after its trial ends, can read but not write. Commands that create, change, or archive content through the REST API fail with
403andYour account is read-only. Upgrade to create content or run queries.Commands that write through Dune MCP fail because the MCP does not offer its write tools to view-only accounts (see Roles and view-only accounts). Running queries also needs an active trial or a paid plan. You can still stop scheduled work withdune schedule deleteanddune matview delete. Upgrade the plan to write again.
Dune Skills
Agent Skills are an open standard for giving AI agents new capabilities. The Dune Skill teaches your agent how to use the Dune CLI to discover datasets, write DuneSQL, execute queries, handle errors, and manage costs — all from natural language prompts. Skills are supported by Claude Code, Cursor, OpenCode, OpenAI Codex, VS Code, Gemini CLI, Goose, and many more.Dune Skills GitHub Repository
Source code, skill definitions, and documentation for Dune Agent Skills. Includes the
dune skill for CLI-based blockchain data queries.Install
The CLI install script asks whether to install the skill. To install it separately, run:- Claude Code
- Cursor
- Manual
Skills are automatically installed to
~/.claude/skills/ and loaded when your conversation matches blockchain-related triggers.How it works
Once installed, the Dune Skill activates automatically when your conversation involves blockchain data, on-chain analytics, DuneSQL, token transfers, DEX trades, smart contract events, or wallet analysis. The agent then:- Discovers the right tables using
dune dataset search - Inspects column schemas to build correct SQL
- Writes DuneSQL with proper partition filters for cost efficiency
- Executes the query and parses results
- Generates and manages visualizations (charts, counters, tables)
- Creates and updates dashboards from query results
- Handles errors with built-in recovery strategies
Related Resources
Dune MCP
Connect Claude, Cursor, Codex, OpenCode, and other MCP clients to Dune’s official hosted MCP server.
Data API
Execute queries and manage Dune content programmatically over REST.
Agents on dune.com
How AI agents work with Dune data.