Scripting

Every command supports --json for structured output. Prompts write to stderr, so stdout stays clean for piping.

JSON Output & Piping

terminal — scripting

# Pipe to jq

$ chainalert detections list --status=active --json | jq '.data[].name'

"USDC Whale Monitor"

"Treasury Drain Alert"

# Use in scripts

$ DETECTION_ID=$(chainalert detections list --json | jq -r '.data[0].id')

$ chainalert detections get "$DETECTION_ID" --json

Configuration

Config is stored at ~/.chainalert/config.json.

KeyPurpose
api-urlOverride the API base URL (default: https://api.chainalert.dev)
openai-keyBring-your-own OpenAI API key for AI chat mode
terminal — config

$ chainalert config set api-url http://localhost:4000

$ chainalert config get api-url

http://localhost:4000