- generate access tokens and Embed tokens for development and testing,
- manage multiple instances and credentials as named profiles, and
- call every Gr4vy API operation — buyers, transactions, payment methods, checkout sessions, reports, and more.
The previous npm package
@gr4vy/cli is deprecated. The CLI is now distributed as a
native binary — install it with one of the options below instead of npm.Prerequisites
- An account and instance (your instance ID, for example
acme). - Credentials, either:
- a private key to sign API tokens — generate one in the Integrations section of
the dashboard and download it as a
.pemfile, or - your dashboard email and password, for user login.
- a private key to sign API tokens — generate one in the Integrations section of
the dashboard and download it as a
Installation
Configuration
The CLI stores connection settings as named profiles in~/.config/gr4vy/config.toml, so you can switch between instances and environments.
Private keys and login sessions are kept in your operating system keychain (with a
0600 file fallback on headless systems) — never in the config file.
Working with multiple instances
| Variable | Purpose |
|---|---|
GR4VY_ID | instance ID |
GR4VY_SERVER | sandbox or production |
GR4VY_MERCHANT_ACCOUNT_ID | default merchant account |
GR4VY_PRIVATE_KEY / GR4VY_PRIVATE_KEY_FILE | private key (raw PEM or base64), or a path to the key file |
GR4VY_PROFILE | profile to use |
GR4VY_TOKEN | a pre-generated bearer token (skips signing) |
Authentication
Each profile uses one of two methods:- Key (default) — your merchant private key signs a short-lived token for every request.
-
Login — exchange your dashboard email and password for a session that the CLI refreshes
automatically:
Generating tokens
--debug to any token command to also print the decoded JWT header and claims:
Calling the API
Every SDK operation is available asgr4vy <resource> <action>. Path parameters are
positional arguments; request bodies are passed with --data (inline JSON, @file.json,
or - for stdin); filters and query parameters are flags.
--help at any level:
Output formats
Use-o, --output to choose the format — it defaults to a table on a terminal and JSON
when piped:
--limit and --cursor; the response includes a next_cursor for
paging. --compact emits single-line JSON.
Shell completion
Completion is built in forbash, zsh, fish, and PowerShell. Load it in your current shell
to try it:
gr4vy completion <shell> --help for the exact steps for
your shell. Flags with fixed choices (such as token --scope) complete their values.