The Relay CLI is a local development and management tool for interacting with your Relay instance. It supports API authentication, endpoint management, event ingestion, and real-time event forwarding to local webhook handlers.
Build the CLI from the repository root:
go build -o relay-cli.exe ./cmd/relay-cliRun the CLI:
.\relay-cli.exe --helpAuthenticate the CLI using your Relay API key:
relay-cli login --api-key <your-api-key>By default, the CLI connects to:
http://localhost:8080
The configuration is stored at:
~/.relay/config.json
On Unix-like systems, the configuration file is created with restrictive permissions (0600).
Retrieve the endpoints configured for your Relay instance:
relay-cli endpoints listRegister a new webhook endpoint:
relay-cli endpoints create `
--name orders `
--url https://example.com/hook `
--secret whsec_...Retrieve delivery health for an endpoint:
relay-cli endpoints health ep_exampleExample output:
success rate (1h): 95%
attempts (1h): 100
successes (1h): 95
failures (1h): 5
consecutive failures: 0
last success: 2026-11-17T09:30:00Z
last failure: 2026-11-17T09:00:00Z
The success rate is a percentage from 0 to 100. The rate and attempt counts cover
the past hour; consecutive failures and the latest timestamps reflect delivery
history. Timestamps use RFC 3339 format and appear as - when no corresponding
delivery exists. Use relay-cli endpoints health --help for command help.
Send events to Relay using the CLI:
relay-cli events send `
--source my-app `
--type user.created `
--data '{"user_id":"u_1"}'Specify a unique event identifier using --unique-id:
relay-cli events send `
--source my-app `
--type user.created `
--unique-id evt-001 `
--data '{"user_id":"u_1"}'If --unique-id is omitted, the CLI automatically generates one.
The listen command provides a local webhook forwarding workflow, similar to stripe listen.
Forward incoming Relay events to your local application:
relay-cli listen --forward-to http://localhost:3000/webhookIf your endpoint requires signature verification, provide its webhook secret:
relay-cli listen `
--forward-to http://localhost:3000/webhook `
--secret whsec_...To forward only selected sources and event types, use client-side filters:
relay-cli listen `
--forward-to http://localhost:3000/webhook `
--filter-source "my-app,other-app" `
--filter-type "user.created,user.updated"Values match exactly and are case-sensitive. An event may match any value within one flag, but must match both flags when both are set. Whitespace around values and empty comma-separated entries are ignored; an empty filter accepts all values. Non-matching events are neither forwarded nor printed. Filtering happens locally after events are fetched and does not change the server-side event list.
Each forwarded request includes the following headers:
| Header | Description |
|---|---|
X-Relay-Event-ID |
Unique identifier of the event |
X-Relay-Timestamp |
Unix timestamp in seconds |
X-Relay-Signature |
HMAC-SHA256 signature, hex-encoded |
When --secret is provided, Relay signs forwarded requests using HMAC-SHA256.
The signature is calculated over:
timestamp.payload
The resulting hexadecimal signature is sent through X-Relay-Signature.
Your local application can use this signature to verify the authenticity and integrity of forwarded requests.
Press Ctrl+C to stop listening.
A typical local development session involves running Relay, starting a webhook receiver, and forwarding events.
1. Start your local Relay instance
go run ./cmd/relay2. Start a local webhook receiver
Run your application on port 3000 with a handler configured for /webhook.
3. Authenticate the CLI
relay-cli login --api-key test-key-1234. List configured endpoints
relay-cli endpoints list5. Send a test event
relay-cli events send `
--source my-app `
--type user.created `
--data '{"user_id":"u_1"}'6. Forward events to your local application
relay-cli listen --forward-to http://localhost:3000/webhook| Command | Description |
|---|---|
relay-cli --help |
Display available commands |
relay-cli login |
Authenticate using an API key |
relay-cli endpoints list |
List registered endpoints |
relay-cli endpoints health <id> |
Show endpoint delivery health |
relay-cli endpoints create |
Register a webhook endpoint |
relay-cli events send |
Publish an event |
relay-cli listen |
Forward incoming events to a local application |
Build all Relay packages:
go build ./...Build the standalone CLI binary:
go build -o bin/relay-cli.exe ./cmd/relay-cliRun the CLI:
.\bin\relay-cli.exe --helpRun the project linter:
golangci-lint run --config=.golangci.yml ./...The CLI should compile successfully and pass the configured lint checks before submitting changes.
Part of the Relay project.
Relay CLI supports shell completion for PowerShell, Bash, Zsh, and Fish.
Add this to your PowerShell profile ($PROFILE):
relay-cli completion powershell | Out-String | Invoke-Expressionsource <(relay-cli completion bash)To persist:
relay-cli completion bash > /etc/bash_completion.d/relay-clirelay-cli completion zsh > "${fpath[1]}/_relay-cli"relay-cli completion fish > ~/.config/fish/completions/relay-cli.fishAfter installation, restart your shell and use Tab completion.