Skip to main content
The gavai CLI is a thin wrapper around the public API. You can use it to fetch and patch page documents from a terminal, publish drafts from CI, invite teammates, and serve the Builder MCP server over stdio. By the end of this page you’ll have the binary installed, an authenticated session on disk, and a map of the commands available to you.

Install

bun add -g @gavai/gavai-cli
The gavai binary lands on $PATH. Verify with gavai --version.

Authenticate

gavai login
The CLI opens console.gavai.app in your default browser, runs OAuth 2.1 with PKCE, and writes tokens to ~/.config/gavai/credentials.json. Subsequent commands refresh the access token silently — you re-run gavai login only when the refresh token itself is revoked. Confirm the session:
gavai whoami

A typical workflow

Fetch a page, patch a headline, publish the draft:
gavai get page_01HXR8K2M4 > page.json
gavai patch page_01HXR8K2M4 --ops patches.json
gavai publish page_01HXR8K2M4
Three calls, three resource transitions: draft is read, draft is mutated, live is promoted. Every command in the CLI follows the same shape — workspace-scoped, JSON in, JSON out.

What the CLI is for

It is not a replacement for the Builder web app. Visual page composition still happens at console.gavai.app. Non-technical users should not be pointed at the CLI.

Credentials file

Tokens live at ~/.config/gavai/credentials.json. Treat it like an SSH key — back it up if you must, but don’t edit it by hand. Delete the file and re-run gavai login if it becomes stale or corrupted.
credentials.json
{
  "access_token": "gst_live_8KdYx2...",
  "refresh_token": "grt_live_qPm91J...",
  "expires_at": "2026-05-11T18:00:00Z",
  "active_workspace": "acme",
  "endpoint": "https://api.gavai.app"
}
access_token is the short-lived bearer (gst_*) the CLI sends on every API call. refresh_token renews it transparently. active_workspace is the slug that scopes commands like gavai get and gavai patch. endpoint is the API base URL — leave it alone unless gavAI support tells you otherwise.

Commands

Exit codes

Every command returns one of these. CI scripts can branch on them.

gavai login

Start here — authenticate the CLI with your gavAI account.