Skip to main content

JSON Output

Use the --json flag to get machine-readable JSON output from non-interactive commands. This is useful for scripting, CI/CD pipelines, and integrating with other tools.

Usage​

hooklistener --json <command>

The --json flag must appear before the command name.

Examples​

List organizations​

hooklistener --json org list
[
{
"id": "org_abc123",
"name": "My Organization",
"selected": true
}
]

List endpoints​

hooklistener --json endpoint list
[
{
"id": "ep_def456",
"name": "Stripe Webhooks",
"slug": "stripe-webhooks",
"status": "active",
"webhook_url": "https://app.hooklistener.com/w/stripe-webhooks"
}
]

Create an endpoint​

hooklistener --json endpoint create "Test Endpoint"
{
"id": "ep_ghi789",
"name": "Test Endpoint",
"slug": "test-endpoint",
"webhook_url": "https://app.hooklistener.com/w/test-endpoint"
}

Supported commands​

JSON output works with all non-interactive commands:

  • org list
  • endpoint create, endpoint list, endpoint show, endpoint delete
  • endpoint requests, endpoint request
  • endpoint forward-request, endpoint forwards, endpoint forward
  • static-tunnel list, static-tunnel create, static-tunnel delete

Interactive commands (listen, tunnel) use their own TUI and don't support JSON output.

Scripting example​

# Get the webhook URL for an endpoint
WEBHOOK_URL=$(hooklistener --json endpoint show ep_abc123 | jq -r '.webhook_url')
echo "Send webhooks to: $WEBHOOK_URL"

# Count endpoints
ENDPOINT_COUNT=$(hooklistener --json endpoint list | jq length)
echo "You have $ENDPOINT_COUNT endpoints"