> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useaxra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Login, forward webhooks locally, and trigger test events from the command line

## Installation

```bash theme={null}
npm install -g @useaxra/cli
```

## Commands

### Login

Save your API key for future commands:

```bash theme={null}
axra login --api-key sk_test_...
```

Credentials are stored in `~/.config/axra/credentials.json` with `0600` permissions.

You can also use environment variables:

```bash theme={null}
export AXRA_API_KEY=sk_test_...
export AXRA_API_BASE=https://api.useaxra.com  # optional
```

### Listen (webhook forwarding)

Forward webhook events to your local development server:

```bash theme={null}
axra listen --forward-to http://localhost:3000/webhooks
```

This opens a WebSocket connection to the Axra API and forwards every webhook event to your local URL with the `Axra-Signature` header intact — so you can test signature verification locally.

### Trigger (test events)

Send a test webhook event to your active `axra listen` session:

```bash theme={null}
axra trigger payment.completed
```

Available test events:

| Event                               | Description                    |
| ----------------------------------- | ------------------------------ |
| `payment.completed`                 | Successful payment             |
| `payment.failed`                    | Failed payment (card declined) |
| `treasury.payout.completed`         | Payout completed               |
| `treasury.payout.failed`            | Payout failed                  |
| `treasury.wallet.deposit.completed` | Wallet deposit received        |
| `treasury.user.created`             | New end-user created           |

## Full workflow

```bash theme={null}
# Terminal 1: start webhook listener
axra listen --forward-to http://localhost:3000/webhooks

# Terminal 2: trigger a test event
axra trigger payment.completed

# Your local server receives the event with valid signature
```

<Tip>
  Use `axra listen` during development instead of exposing your local server with ngrok. It's faster and doesn't require port forwarding.
</Tip>
