vault query
Execute a VQL query against the connected Vault and display results as a table, JSON, or CSV.
vault query <QUERY>... [--format <FORMAT>] [--page <N>] [--all]Options
Section link for Options| Option | Type | Required | Description |
|---|---|---|---|
<QUERY> | string | Required | The VQL query to execute. Enclose it in quotes, or pass it as several words |
--format <FORMAT> | table | json | csv | Optional | Output format. Default: table |
--page <N> | integer | Optional | Fetch a specific page of results (1000 rows per page), numbered from 1. Default: 1. Mutually exclusive with --all |
--all | flag | Optional | Fetch and concatenate all pages of results. Mutually exclusive with --page |
This command also accepts the global options.
Examples
Section link for ExamplesBasic query
Section link for Basic queryvault query "SELECT id__v, name__v FROM documents__v"JSON output
Section link for JSON outputvault query "SELECT id__v, name__v FROM documents__v" --format jsonCSV output (for piping or import)
Section link for CSV output (for piping or import)vault query "SELECT id__v, name__v, status__v FROM documents__v" --format csv > documents.csvFetch all pages
Section link for Fetch all pagesvault query "SELECT id__v FROM documents__v" --allFetch a specific page
Section link for Fetch a specific pagevault query "SELECT id__v FROM documents__v" --page 2Pagination
Section link for PaginationBy default, vault query returns only the first page of results: up to 1000 rows. To get more, use one of two mutually exclusive options:
--page <N>: Fetch a specific page, numbered from 1.--all: Fetch every page.
If your query already contains PAGESIZE, PAGEOFFSET, LIMIT, or OFFSET, the CLI sends it to Vault unchanged and does not add its own paging.
When a query returns no rows, table output prints (no rows), json prints [], and csv prints nothing.
For VQL syntax, see the VQL reference.