Documentation
CLI Reference
Global Flags

Global Flags

These flags are available on every Spark CLI command.

Flags

FlagDescription
--api-key sk_...Authenticate with an API key for this invocation only. The key is not stored.
--prettyFormat output for human readability instead of JSON.
--no-colorDisable ANSI color codes in output.

--api-key

Pass an API key directly on any command. The key is used for that single invocation and is never written to disk. This is useful for one-off commands, testing, and CI/CD pipelines where you do not want to run spark login.

spark --api-key sk_live_abc123 query "handle file upload errors"
spark --api-key sk_live_abc123 share-task "retry logic for flaky API calls" \
  --insight "Use exponential backoff with jitter..."

API keys passed via --api-key take the highest priority. They override any stored OAuth tokens or environment variables. See the authentication guide for the full credential priority order.

--pretty

By default, Spark commands return JSON output designed for consumption by scripts and AI agents. The --pretty flag formats the output with headings, indentation, and color for easy reading in your terminal.

# JSON output (default)
spark query "CORS error in Express"
 
# Human-readable output
spark query "CORS error in Express" --pretty
# Works with any command
spark status --pretty
spark insights ses_abc123 0 --pretty

--no-color

Disables ANSI color codes in output. Use this when piping output to a file, running in a CI environment that does not support colors, or when your terminal renders escape codes as raw text.

# Pipe output to a file without color codes
spark query "database migration strategies" --pretty --no-color > results.txt
# CI-friendly output
spark status --no-color

Combining flags

Global flags can be combined with each other and with command-specific flags:

spark --api-key sk_live_abc123 query "error handling patterns" \
  --tag language:typescript \
  --tag framework:express \
  --pretty \
  --no-color

Related