Skip to main content

Overview

The latitude CLI is a single, self-contained binary that exposes your Latitude organization on the command line. Like the MCP server, its commands are generated directly from the Latitude API, so the command surface automatically stays in sync with the platform. For the live list of commands and their input/output schemas, check the API reference. It’s built for two audiences:
  • Humans, a fast, scriptable way to inspect and manage projects, traces, datasets, members, keys, and more without leaving the terminal.
  • Agents, a zero-dependency way for an agent (Claude Code, Cursor, Codex, …) to act on Latitude without wiring up an MCP connection, using --format json for machine-readable output and --schema for machine-readable help.
Prefer a network connection? The MCP server exposes the same capabilities over OAuth.

Installation

The CLI ships as a pre-built binary on our GitHub Releases — grab the latest cli-vX.Y.Z release. Download the archive for your platform, extract it, and put the latitude binary somewhere on your PATH.
On MacOS the first run may be blocked by Gatekeeper. Allow it with xattr -d com.apple.quarantine /usr/local/bin/latitude, or via System Settings → Privacy & Security.
Then verify it works and, optionally, set up shell completion and the man page.

Authentication

The CLI authenticates with an organization-scoped API key. Create one in the Latitude UI under Settings → Keys → API Keys. There are two ways to give the key to the CLI:
The CLI also reads a .env file from the current directory, or from the nearest parent directory that has one. The LATITUDE_API_KEY you keep there for tracing authenticates the CLI too. Variables exported in your shell win over .env. Settings that change where requests go or how TLS is checked (LATITUDE_BASE_URL, the proxy and CA bundle variables, LATITUDE_INSECURE) are ignored when they come from .env, so export those from your shell instead.

Profiles

A profile is a named setup for the CLI with its own API key, stored in the keyring. With profiles you can keep several keys side by side and choose one per command, per shell, or as your default, instead of re-exporting LATITUDE_API_KEY every time you switch.

Production and sandbox

The most common use is switching between your project’s live data and its sandbox. Both use the same project slugs. The API key alone decides which one a command reads: a live key from Settings → Keys → API Keys, or a lat_sandbox_ key from Sandbox configuration inside the sandbox. Give each key its own profile:
Commands now run against production by default. Add -p sandbox (or --profile sandbox) to run one against the sandbox. The project slug is the same in both, so set it once:
To change the default instead of passing -p each time:

Managing profiles

Profiles live in a profiles.toml file in the CLI’s config directory: ~/Library/Application Support/latitude/ on MacOS, ~/.config/latitude/ on Linux, and %APPDATA%\latitude\ on Windows. The file never holds a key. Each key stays in the keyring under latitude:ApiKeyAuth#<profile>. A profile can also carry a default project, which helps when your profiles point at different projects:
A profile’s project wins over LATITUDE_PROJECT_SLUG and --global-project-slug. Passing --project-slug on a command still overrides it.

Which key a command uses

The CLI uses the first of these that’s set:
  1. The profile passed with -p / --profile.
  2. LATITUDE_API_KEY, from your shell or a .env file.
  3. The profile named by LATITUDE_PROFILE, or else the default set with latitude profiles use.
  4. The key stored by latitude auth login with no profile selected.
A selected profile only ever sends its own key. If it has none stored, the command fails to authenticate instead of falling back to another key.
LATITUDE_API_KEY beats both the default profile and LATITUDE_PROFILE. If it’s set in your shell or in .env (for example, because your app’s tracing reads it from there), commands keep using it after latitude profiles use. Pass -p to override it. latitude profiles current reports credential_overridden_by_env when this happens, and latitude auth status shows the profile’s key as shadowed. Profiles only affect the CLI, so your app keeps reading LATITUDE_API_KEY as before.

Usage

The general shape is latitude <resource> <command> [flags], where each resource mirrors an area of the Latitude API:
Resources include projects, traces, datasets, and more — run latitude --help for the full list. Common examples:
Most resources are project-scoped and take --project-slug. Set the project once for a session with LATITUDE_PROJECT_SLUG (or the global --global-project-slug flag) and you can drop it from individual commands — --project-slug still wins wherever you pass it:
A profile can carry its own default project as well. A few global flags worth knowing (run latitude --help for the full list):
  • --profile <name> / -p — run the command under a named profile.
  • --query <JMESPath> — project/filter the response before it’s formatted, e.g. --query "items[].slug". When an API operation has its own query parameter (like the free-text search on traces list), that parameter is exposed as --query-param instead.
  • --dry-run — validate the request locally without sending it to the API.
  • --quiet / -q — suppress success output (errors still print to stderr).
  • --human — force table output even when stdout is piped.
  • --schema — print a machine-readable JSON description of a command’s inputs and outputs, the agent-facing counterpart to --help.
  • --debug — dump the raw HTTP request and response to stderr.
API commands also take a few request options:
  • --params <JSON> — pass parameters as a JSON object. These override the individual flags.
  • --json <JSON|-> — on commands that send a request body, pass the whole body as JSON. Use - to read it from stdin.
  • --retries <N> / --no-retry — change how many times a failed request is retried, or turn retries off.

Output formats

Every command accepts --format to control how results are rendered. This makes the CLI equally good for humans reading a terminal and for scripts or agents parsing output.
You can also set a default format for a session with the LATITUDE_OUTPUT environment variable (e.g. export LATITUDE_OUTPUT=json); the --format flag always overrides it. --human is shorthand for --format table, for when you pipe output but still want the table.

Environment variables

The standard HTTPS_PROXY / HTTP_PROXY / NO_PROXY / SSL_CERT_FILE variables are honored as well. Any of these can also go in a .env file, except LATITUDE_BASE_URL and the proxy, CA bundle, and TLS variables, which the CLI only reads from your shell (see Authentication).

Shell completion

Generate a completion script for your shell — bash, zsh, fish, powershell, or elvish — and load it to get tab-completion for every resource, command, and flag:

Man page

The CLI can emit its own manual page in roff format, so man latitude works like any native tool:

For Agents

The CLI pairs naturally with agents: --format json/jsonl for structured output, --schema for machine-readable help, and latitude generate-skills to teach an agent the command surface — everything it needs to drive Latitude locally with no MCP connection. Have agents pass -p on every command when you use profiles, so each call names its environment and can’t be redirected by a LATITUDE_API_KEY in the environment. Prefer the MCP server when you’d rather connect the agent over the network with OAuth.