|
| 1 | +# Dune CLI |
| 2 | + |
| 3 | +A command-line interface for interacting with the Dune Analytics API. |
| 4 | + |
| 5 | +## Authentication |
| 6 | + |
| 7 | +```bash |
| 8 | +# Save your API key to ~/.config/dune/config.yaml |
| 9 | +dune auth --api-key <key> |
| 10 | + |
| 11 | +# Or run interactively (prompts for key) |
| 12 | +dune auth |
| 13 | + |
| 14 | +# Or set via environment variable |
| 15 | +export DUNE_API_KEY=<key> |
| 16 | +``` |
| 17 | + |
| 18 | +The `--api-key` flag is available on all commands to override the stored key. |
| 19 | + |
| 20 | +## Commands |
| 21 | + |
| 22 | +### `dune query` |
| 23 | + |
| 24 | +Manage and execute Dune queries. |
| 25 | + |
| 26 | +| Command | Description | |
| 27 | +|---------|-------------| |
| 28 | +| `query create --name <name> --sql <sql> [--description] [--private] [--temp]` | Create a new saved query | |
| 29 | +| `query get <query-id>` | Get a saved query's details and SQL | |
| 30 | +| `query update <query-id> [--name] [--sql] [--description] [--private] [--tags]` | Update an existing query | |
| 31 | +| `query archive <query-id>` | Archive a saved query | |
| 32 | +| `query run <query-id> [--param key=value] [--performance medium\|large] [--limit] [--timeout] [--no-wait]` | Execute a saved query and display results | |
| 33 | +| `query run-sql --sql <sql> [--param key=value] [--performance medium\|large] [--limit] [--timeout] [--no-wait]` | Execute raw SQL directly | |
| 34 | + |
| 35 | +### `dune execution` |
| 36 | + |
| 37 | +Manage query executions. |
| 38 | + |
| 39 | +| Command | Description | |
| 40 | +|---------|-------------| |
| 41 | +| `execution results <execution-id> [--limit] [--offset] [--timeout] [--no-wait]` | Fetch results of a query execution | |
| 42 | + |
| 43 | +### `dune dataset` |
| 44 | + |
| 45 | +Search the Dune dataset catalog. |
| 46 | + |
| 47 | +| Command | Description | |
| 48 | +|---------|-------------| |
| 49 | +| `dataset search [--query] [--categories] [--blockchains] [--schemas] [--dataset-types] [--owner-scope] [--include-private] [--include-schema] [--include-metadata] [--limit] [--offset]` | Search for datasets | |
| 50 | +| `dataset search-by-contract --contract-address <address> [--blockchains] [--include-schema] [--limit] [--offset]` | Search for decoded tables by contract address | |
| 51 | + |
| 52 | +Categories: `canonical`, `decoded`, `spell`, `community` |
| 53 | + |
| 54 | +### `dune docs` |
| 55 | + |
| 56 | +Search and browse Dune documentation. No authentication required. |
| 57 | + |
| 58 | +| Command | Description | |
| 59 | +|---------|-------------| |
| 60 | +| `docs search --query <text> [--api-reference-only] [--code-only]` | Search the Dune documentation | |
| 61 | + |
| 62 | +### `dune usage` |
| 63 | + |
| 64 | +Show credit and resource usage for your account. |
| 65 | + |
| 66 | +```bash |
| 67 | +dune usage [--start-date YYYY-MM-DD] [--end-date YYYY-MM-DD] |
| 68 | +``` |
| 69 | + |
| 70 | +## Output Format |
| 71 | + |
| 72 | +All commands (except `auth`) support `-o, --output <format>` with `text` (default) or `json`. |
0 commit comments