Skip to Content

CLI quickstart

The Gavana CLI is a JSON-first client for the same Canvas API this section documents. Every command maps onto an operation you can see in Resources — and gavana api lets you call any operation raw, including the handful with no dedicated command.

That makes it two useful things at once: a fast way to explore the API before you write code, and a way to script against it without writing a client at all.

Installing and logging in is covered on the Agents side of the help center: Install and log in to the Gavana CLI. Come back here once gavana auth status works. The CLI reference lists every command.

Confirm your setup

gavana auth status --pretty
{ "ok": true, "result": { "authenticated": true, "authType": "agent", "email": "you@example.com", "scopes": ["canvas:read", "canvas:write"], "agentLabel": "Quickstart", "profile": "default", "configured": true, "baseUrl": "https://app.gavana.ai", "token": "cba_123…abcd", "credentialStore": "macos-keychain", "credentialState": "available", "canvasCount": 4, "configPath": "/Users/you/.config/gavana/agent.json" } }

authenticated through agentLabel are GET /auth/status as the API returns it (a current server also sends server: its API version and the recommended CLI and MCP package versions); the rest is the CLI describing its own profile. Every other command prints the API response inside the same { "ok": true, "result": … } envelope, which is what makes the CLI a good exploration tool — what you see under result is what your own client will get.

If something is misconfigured, gavana doctor checks the profile, base URL, credential, and server API version in one shot.

Commands map to operations

CommandOperation
gavana auth statusGET /auth/status
gavana canvas listGET /canvases
gavana canvas createPOST /canvases
gavana canvas getGET /canvases/{canvasId}
gavana canvas applyPOST /canvases/{canvasId}/operations
gavana canvas renderGET /canvases/{canvasId}/render
gavana node getGET /canvases/{canvasId}/nodes/{nodeId}
gavana asset list · get · uploadGET /assets · GET /assets/{assetId} · POST /assets
gavana model list · getGET /models · GET /models/{modelKey}
gavana provider listGET /providers
gavana action list · get · runGET /actions · GET /actions/{actionKey} · POST /actions/{actionKey}/runs
gavana image generate · edit · variationsPOST /images/generate · /images/edit · /images/variations
gavana video generate · gavana video downloadPOST /videos/generate · GET /jobs/{jobId}/output
gavana recipe search · get · fork · runGET /recipes · GET /recipes/{recipeId} · POST /recipes/{recipeId}/fork · POST /recipes/{recipeId}/runs
gavana element list · get · history · create · updateGET /elements · GET /elements/{elementId} · GET /elements/{elementId}/versions · POST /elements · PATCH /elements/{elementId}
gavana element collection-list · collection-create · collection-rename · collection-deleteGET /element-collections · POST /element-collections · PATCH /element-collections/{collectionId} · DELETE /element-collections/{collectionId}
gavana work prepare · get · refresh · continue · executePOST /works · GET /works/{workId} · POST /works/{workId}/refresh · /continue · /execute
gavana run get · wait · cancelGET /runs/{runId} (polled by wait) · DELETE /runs/{runId}
gavana job get · wait · cancelGET /jobs/{jobId} (polled by wait) · DELETE /jobs/{jobId}

gavana element archive, restore, and collections are also PATCH /elements/{elementId}, each with its own operation value. Each generated resource page repeats this mapping per operation under CLI equivalent, so you can move in either direction.

The Runs page lists gavana run list as the CLI equivalent of GET /runs, but the CLI has no such command — it answers Unknown command: run list. Use gavana api GET /runs instead.

These operations have no dedicated command: GET /runs, POST /runs/recover, GET /runs/{runId}/snapshot, POST /images/import, POST /product-references/import, POST /canvases/{canvasId}/workflows, and GET /assets/preview. Use gavana api for all of them except two: preview URLs are handed to you inside asset and job responses, and the snapshot path takes a run:, job:, or work: handle, which gavana api cannot send because it refuses : in a path.

The same flow as the other quickstarts

List canvases

gavana canvas list --limit 10

Read one and keep its revision

gavana canvas get canvas:product-launch

The response contains canvas.revision (at .result.canvas.revision in the CLI’s envelope). Everything that writes needs it.

Validate a change without writing

gavana canvas apply always applies. For the dry run, go through the raw passthrough and set validateOnly yourself:

REV=$(gavana canvas get canvas:product-launch --jq '.canvas.revision' -r) gavana api POST /canvases/product-launch/operations --json "$(jq -n --arg rev "$REV" '{ validateOnly: true, baseRevision: $rev, operations: [ { type: "node.create", clientId: "client:cli-note", node: { type: "sticky", title: "CLI quickstart", position: { x: 0, y: 0 }, width: 240, height: 160, metadata: { content: "Written from the CLI quickstart." } } } ] }')"

You get back the dry-run result described in Revisions. Nothing is written and no idempotency key is consumed.

Apply it

gavana canvas apply canvas:product-launch \ --idempotency-key 'cli-quickstart-note-001' \ --json '{ "operations": [ … ] }'

The CLI reads the canvas and fills in baseRevision for you when you do not pass --base-revision. That convenience is exactly what you must implement yourself in a raw client — see Revisions.

Two behaviours worth knowing before you script this:

  • A batch containing node.delete or connection.delete refuses to run without --yes. That gate exists in the CLI, not in the API — a raw client gets no such protection, which is why the dry run above matters.
  • If you omit --idempotency-key, the CLI generates a fresh UUID per invocation. That is fine interactively and wrong in a retry loop; pass a stable key whenever a command might be run twice.
  • A batch that would add new overlap between nodes you created, or push a node outside its Section, is refused with 422 and nothing is written. Fix the layout, or set "force": true in the JSON to apply it anyway.

gavana api: the raw passthrough

gavana api sends an arbitrary request to the Canvas API using your stored credential and base URL. Paths are restricted to /api/canvas-agent/v1, so you write the path relative to that prefix.

# GET is the default when the first argument is a path gavana api /auth/status # An explicit method gavana api GET /canvases --field limit=10 # --field repeats; on a GET the fields become query parameters gavana api GET /models --field capability=image.generate --field provider=openai # On a non-GET the fields become a flat JSON body gavana api POST /canvases --field title='Concepts' --field idempotencyKey='concepts-canvas-001' # For anything nested, pass JSON gavana api POST /canvases/product-launch/operations --json '{ "baseRevision": "2026-08-04T09:12:44.318726Z", "idempotencyKey": "raw-passthrough-001", "operations": [ { "type": "node.move", "nodeId": "node:8f2a91c4", "position": { "x": 400, "y": 0 } } ] }' # DELETE gavana api DELETE /runs/2c9a1f3e # Runs still in flight, newest first gavana api GET /runs --field status=active

This is the fastest way to try an operation you are about to implement. It is also the only CLI route to operations with no dedicated command:

# Import a public HTTPS image as a durable canvas node gavana api POST /images/import --json '{ "canvasId": "canvas:product-launch", "imageUrl": "https://example.com/reference.png", "title": "Reference", "idempotencyKey": "import-reference-001" }'

gavana api does no validation, fills in no baseRevision, and adds no idempotencyKey. You are responsible for both, exactly as you would be in your own client. It will also happily call a paid operation — treat POST /images/generate, /images/edit, /images/variations, POST /videos/generate, POST /recipes/{recipeId}/runs, and POST /works/{workId}/execute as spending real money.

Flags that mirror API fields

These appear on the commands that write, and each maps to a body field you would send yourself:

FlagBody fieldNotes
--base-revision VALUEbaseRevisionEnforce a revision you read earlier. Omit and the CLI reads the canvas first.
--idempotency-key VALUEidempotencyKeyMake retries deterministic. Omitted on some commands means a fresh UUID per invocation — which is not what you want in a retry loop.
--webhook-url URLwebhook.urlOne signed callback when the Run finishes
--webhook-secret-env VARwebhook.secretReads the secret from an environment variable. Defaults to GAVANA_WEBHOOK_SECRET. Requires --webhook-url.
--yes—CLI-side confirmation gate for destructive batches and cancellations. No API equivalent.

--webhook-secret-env is a small but good design detail worth copying: the secret never appears in argv, so it never reaches shell history or ps.

Scripting against it

Every command prints JSON to stdout. For simple paths the built-in --jq selector needs no extra tool; for anything more, pipe into jq and start at .result:

# Every accessible canvas handle gavana canvas list --limit 25 --jq '.canvases[].handle' -r # Image models, sorted by estimated runtime gavana model list --capability image.generate | jq -r '.result.models | sort_by(.estimatedSeconds)[] | "\(.handle)\t\(.modelId)\t~\(.estimatedSeconds)s"' # The revision of a canvas, ready to feed into a raw call gavana canvas get canvas:product-launch --jq '.canvas.revision' -r # Walk every page of assets CURSOR='' while :; do PAGE=$(gavana asset list --limit 200 ${CURSOR:+--cursor "$CURSOR"}) printf '%s' "$PAGE" | jq -r '.result.assets[].handle' CURSOR=$(printf '%s' "$PAGE" | jq -r 'if .result.page.hasMore then .result.page.nextCursor else empty end') [ -n "$CURSOR" ] || break done

Errors go to stderr as a single JSON object, and the exit code is non-zero:

{ "ok": false, "error": { "code": "forbidden", "message": "This agent token is missing required permissions: canvas:write." } }

So set -e plus a stderr capture is enough for a robust script — you do not need to parse stdout to detect failure.

When to stop using the CLI

The CLI is a great client until you need something it deliberately does not do: custom retry policy, a webhook receiver, long-lived connection pooling, or running inside a service. At that point port your gavana api calls into a real client — the TypeScript quickstart is about eighty lines and has no dependencies.

Next

Last updated on