Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.anyway.sh/llms.txt

Use this file to discover all available pages before exploring further.

@anyway-sh/cli on npm

View package on npm

Installation

npm install -g @anyway-sh/cli

Quick Start

# Authenticate (opens browser)
anyway login

# Create a product with payment link
anyway products create --name "My Product" --price 29.99

# Get JSON output (for agent/automation use)
anyway products create --name "My Product" --price 29.99 --format json

Authentication

The CLI uses three auth modes, depending on the command:
  • Merchant auth (anyway login) — JWT-based; required by most commands (products, orders, wallets, dashboard, developer, traces, and the merchant-side agent-wallet operations like create / list / reset).
  • Agent key (ANYWAY_AGENT_WALLET_KEY env var or a local record from wallets agents import) — P-256 keypair-based; used by the agent-runtime commands under wallets agents (whoami / history / policies / pay / sign), by superapi call, and by import itself. These do NOT need anyway login.
  • Local — file-only operations on ~/.anyway/agents/*, used by default and forget.

Merchant login

anyway login              # Open browser to authenticate
anyway logout             # Clear stored credentials
anyway whoami             # Show current session info
First-time login opens a browser window to complete authentication. Credentials are stored at ~/.anyway/credentials.json and auto-refreshed. For environments without a browser, the login page will display a token you can paste back into the terminal.

Agent runtime auth (for AI agents)

If you’re running the CLI as an AI agent that already owns an Agent Wallet, set the key bundle from the dashboard’s reveal dialog as an env var — no anyway login needed:
export ANYWAY_AGENT_WALLET_KEY="eyJwcml2YXRl..."
Or persist the same bundle locally and let the CLI use it as the default signing identity:
anyway wallets agents import --token <bundle>
Then these commands work directly against the agent-runtime endpoints (/v1/agent-wallet/*):
anyway wallets agents whoami                          # Confirm agent identity + wallet
anyway wallets agents policies                        # Read spending limits
anyway wallets agents history                         # Recent activity
anyway superapi call "<SuperAPI x402 URL>" -y          # Pay and call with the Agent Wallet Key
anyway wallets agents pay --to <0x...> --amount 1.50  # Sign a USDC payment authorization
anyway wallets agents sign --typed-data-file <path>   # Sign arbitrary EIP-712 typed data
Add --format json for machine-parseable output. See wallets agents below for the full surface (including merchant-only operations like create).

Commands

products

anyway products list
anyway products list --status active --page 1 --size 20
anyway products get <productId>
anyway products create --name <name> --price <amount> [--currency usd] [--description <desc>]
anyway products create --name <name> --price <amount> --type recurring --interval month
anyway products update <productId> --name <name> [--description <desc>]
anyway products archive <productId>
anyway products publish <productId>
anyway products payment-links <productId>
Creating a product automatically creates a payment link. The payment link URL is returned in the output.

orders

anyway orders list
anyway orders list --status paid --page 1 --size 20
anyway orders list --product <productId> --from 2024-01-01 --to 2024-12-31

wallets

anyway wallets balance
anyway wallets transactions
anyway wallets transactions --limit 50

wallets agents

Manage Agent Wallets and operate as an agent runtime. Eleven subcommands across three independent auth paths — pick the column that matches what you have.
CommandDescriptionAuth
create [--name <n>] [--non-interactive]Create a new agent wallet (browser callback flow — opens dashboard for Privy signing, then saves the verified key locally when interactive)merchant
list [--local] [--offline] [--format=table|json]Without --local: org-wide merchant view of every agent wallet. With --local: only the agent records you’ve imported locally; each row is refreshed by hitting the agent-runtime endpoint with that agent’s key. Add --offline to skip the network and show file state only.merchant (default) / agent key (--local) / local (--local --offline)
reset <agentId> [--non-interactive]Rotate this agent’s signing key in place (browser callback flow; same agentId, refreshed key)merchant
import --token <bundle> (alias: adopt)Verify an Agent Wallet Key bundle and save/replace the local record in ~/.anyway/agents/agent key
whoami [<agentId>]Server’s view of this agent (id, name, wallet id, wallet address, public key)agent key
history [<agentId>] [--limit N]Activity log for the agent (default 50, max 200)agent key
policies [<agentId>]Spending policies attached to the agent’s walletagent key
pay --to <0x> --amount <usdc>Sign a USDC payment authorization for x402 PAYMENT-SIGNATUREagent key
sign --typed-data-file <path>Sign arbitrary EIP-712 typed dataagent key
default <agentId> (alias: use)Set the default local agent recordlocal
forget <agentId> [--yes]Delete the local agent recordlocal
Auth modes:
  • merchant — needs anyway login. These commands manage the wallet itself (create / list (default) / reset) and require browser interaction for create / reset (they cannot be completed by an AI agent alone — share the printed URL with the wallet owner). list --local does not need merchant auth — see below.
  • agent key — needs ANYWAY_AGENT_WALLET_KEY env var or a record imported via import. import verifies the bundle through GET /v1/agent-wallet, saves it locally, and replaces a stale local key after dashboard reset. Use this in agent runtimes (Claude / Codex / CI). Does NOT need anyway login.
  • local — touches only ~/.anyway/agents/*. No network, no auth.

superapi

anyway superapi call "https://marketplace-prod.anyway.sh/v1/api/x402/twit-sh/tweets/search?words=bitcoin&count=5"
anyway superapi call "<SuperAPI x402 URL>" --body '{"query":"..."}'
superapi call is the wrapped x402 purchase path for agent runtimes. It sends the initial request, decodes the PAYMENT-REQUIRED challenge, shows the quote, signs with the selected Agent Wallet after confirmation, retries with PAYMENT-SIGNATURE, and prints the API result. Use --yes or -y to skip the prompt in CI/agent runtimes. It uses agent-key auth and does not need anyway login. Agent Wallet is the default payment source; --pay-with agent-wallet is accepted for compatibility but is not required. Each command’s --help prints its full flag list, examples, and auth requirement — e.g. anyway wallets agents pay --help shows the lower-level --format json output used as inputs when manually assembling an x402 PAYMENT-SIGNATURE envelope. For the end-to-end CLI purchase path, see SuperAPI → By Anyway CLI.

dashboard

anyway dashboard templates
anyway dashboard query <templateId>
anyway dashboard query <templateId> --days 30

traces

anyway traces status
anyway traces list
anyway traces list --limit 50

developer

anyway developer keys list
anyway developer keys list --type sdk_key
anyway developer keys create --name <name>
anyway developer keys delete <keyId>

chat

anyway chat                          # Interactive chat with AI agent
anyway chat "what's my revenue?"     # Single-shot query
anyway chat --session <sessionId>    # Continue an existing session

Global Options

OptionValuesDefaultDescription
--formattable, json, csvtableOutput format

Scripting & Automation

All commands support --format json for machine-readable output and return non-zero exit codes on failure. This applies to both merchant-mode and agent-mode commands.
# Create product and capture output
result=$(anyway products create --name "API Product" --price 49.99 --format json)
payment_link=$(echo $result | jq -r '.paymentLink.paymentLinkUrl')

# List orders as CSV
anyway orders list --format csv > orders.csv