CLI Reference

pikeway whoami

Check which account and key the CLI is using, and that the key still works.

Synopsis

bash
pikeway whoami [--json] [--key pk-...]

Description

Calls GET /v1/auth/whoami with the key that would be used for any other command (--key, then PIKEWAY_API_KEY, then the active saved key) and prints the account plus the key's name and masked preview. The account is shown as the email, or the wallet address, Twitter handle or user id when there is no email.

It's the quickest way to confirm a key is valid before a script spends money.

Options

None besides the global --json and --key.

Examples

bash
pikeway whoami

# check a key before saving it
pikeway whoami --key pk-...

# fail a CI job early when the key is bad (exit 3)
pikeway whoami -j > /dev/null || exit 1

# remaining key budget
pikeway whoami --json | jq '.key.budget'

Output

text
[email protected]  key agent pk-AbCd****xYz9
  scopes: call, api:birdeye
  expires: 2026-11-26
  budget: $1.2500 of $5 used

The first line is the account, the key's name as set in the console (not the local label) and its preview. Then its permissions (full access when none are set), and the expiry and spending cap when the key has them.

--json

json
{
  "userId": "cm2x8k1qz0000abcd1234efgh",
  "email": "[email protected]",
  "walletAddress": null,
  "twitterHandle": null,
  "key": {
    "id": "cm2x9p4rt0001abcd5678ijkl",
    "name": "agent",
    "preview": "pk-AbCd****xYz9",
    "scopes": ["call", "api:birdeye"],
    "fullAccess": false,
    "expiresAt": "2026-11-26T00:00:00Z",
    "budget": { "limit": 5, "used": 1.25, "currency": "USD" }
  }
}

key.budget is present only when the key has a spend limit. key.scopes is empty and fullAccess is true for a key without permissions; expiresAt is null when it never expires.

Errors and exit codes

ExitMessageWhen
3no API key: run `pikeway keys add --label main --key pk-...`, set PIKEWAY_API_KEY, or pass --keyNo --key, no PIKEWAY_API_KEY and no saved active key. Checked before any request is sent.
3invalid or revoked API key — add a key with `pikeway keys add --label main --key pk-...` (or use --x402)The gateway answered 401 (unknown, revoked or expired key). A 403 also exits with 3.
1cannot reach <gateway>: ECONNREFUSEDThe gateway could not be reached (DNS, network, wrong PIKEWAY_API_BASE_URL). The code after the colon comes from Node.
Also accepts the global flags -j, --json and -k, --key. See Global flags and Exit codes.