Skip to main content
The Lago CLI is generated from the Lago OpenAPI spec. Every endpoint is a command, every API field is a flag. It works with Lago Cloud US, Lago Cloud EU, and self-hosted Lago.

Install

Homebrew on macOS and Linux installs the binary, the man page and the shell completions:
Anywhere Go 1.27 or later runs:
Release archives for macOS, Linux and Windows, with checksums signed by cosign, are on the releases page. lago version prints the CLI version and the API spec version it was built from. lago upgrade tells you whether a newer release exists and the command to install it.
If lago version prints a Docker Compose version, a shell alias named lago from a self-hosted Lago setup is shadowing the binary. Run unalias lago and remove the alias from your shell profile.

Configure

Get an API key from Developers > API keys in the Lago app, then:
init checks the key against the API before saving anything to ~/.config/lago/config.toml. Pass the base URL only: the CLI adds /api/v1. The dashboard URL (app.getlago.com) is refused, because it is not the API. lago whoami shows the profile and the exact host requests go to. lago doctor checks configuration, network, and authentication.

First commands

lago seed demo creates a full chain (metric, plan, customer, subscription, event, invoice preview) in one command.

How it works

Flags are API fields

A snake_case field is a --kebab-case flag. Nested fields carry their parent as a prefix. Objects and arrays take JSON. --input sends a whole request body.

Creates print identifiers

A create or update prints the identifier block. Add --output json for the full resource.

Responses are wrapped

The API wraps every response in its resource name. A --query starts with that wrapper. A query that matches nothing prints null and lists the available keys on stderr.

Destructive operations ask first

delete, void, finalize, terminate, and retry-payment prompt for the identifier. In a script, pass it with --confirm.

Live is the default mode

--mode test is a safety declaration, not a sandbox. Live mode prints [LIVE] and gates destructive operations. Credentials passed by flag or environment run live unless you set a mode.

Nothing is sent on --dry-run

The CLI prints the method, URL, redacted headers, and exact body. No connection is opened.

Scripting

Precedence is flags, then environment, then profile.

Exit codes

Money is exact: *_amount_cents are integers, units are decimal strings. The CLI sends no telemetry.

Command reference

One page per command group, with commands and their output side by side.

API reference

The schemas the CLI is generated from.