Skip to main content
Documentation

Read Virent analytics and check installs from a terminal.

Last reviewed 2026-10-27

The Virent CLI wraps the public API for scripts, CI jobs and AI coding agents. Every command prints JSON.

Install#

SH
npx @virent.app/cli --help

Or install it globally for the virent command:

SH
npm install --global @virent.app/cli

It needs Node.js 20 or later and has no dependencies.

Read analytics#

Reading analytics needs a private API key (vnt_sk_) from Settings → Connection on a plan that includes the read API. See Keys and secrets.

SH
export VIRENT_API_KEY=vnt_sk_…virent analytics overview --website <website-id>virent analytics pages --website <website-id> --from 2026-10-01 --to 2026-10-27virent analytics timeseries --website <website-id> --interval hour --from 2026-10-26
ReportWhat it returns
overviewHuman analytics totals: pageviews, events, sessions, bounces and visitors
timeseriesPageviews and sessions per hour or day
trafficTotals, time series and goal conversions in one call
pagesPageviews per page path
referrersSessions per referrer and traffic source, including AI referrers
visitorsVisitors by browser, device, operating system and country

The range defaults to the last 7 days. --timezone takes an IANA time zone and defaults to UTC. Each report is one operation in the OpenAPI specification.

Check an install#

Validate a publishable key (vha_pk_) against a page on your site:

SH
virent install check --key vha_pk_… --url https://www.example.com/

The CLI sends one pageview to browser ingest with dryRun=1 from that page's origin. Virent checks the key, the allowed origin and host, the plan and the rate limits, and stores nothing. A validated event means the browser script with that key will be accepted on that site.

Other commands#

CommandWhat it does
virent openapiPrints the OpenAPI 3.1 description of the public API
virent --versionPrints the CLI version
virent --helpLists commands and options

Errors go to stderr with exit code 1. They include the API's error message and, when rate limited, the Retry-After seconds. --base-url (or VIRENT_API_URL) points the CLI at another Virent origin.

Use with AI agents#

Coding agents can run the CLI directly. Give the agent the key through VIRENT_API_KEY in its environment, never in a chat message, and ask it to run virent --help first.