CLI

Authentication

The Status200 CLI supports multiple ways to authenticate with your Status200 instance. You can use named contexts, environment variables, or pass credentials directly as flags.

Login

Authenticate with your Status200 instance using an API key:

status200 login <api-key> <instance-url>

Arguments:

ArgumentDescription
<api-key>Your Status200 API key (e.g., sk-your-api-key)
<instance-url>Your Status200 instance URL (e.g., https://status200.ru)

Options:

OptionDescription
--context-name <name>Name for this context (default: "default")

Examples:

# Login with default context
status200 login sk-abc123 https://status200.ru

# Login with a named context
status200 login sk-abc123 https://status200.ru --context-name production

# Set up multiple environments
status200 login sk-prod-key https://status200.ru --context-name production
status200 login sk-staging-key https://staging.status200.ru --context-name staging

Contexts

Contexts allow you to save and switch between multiple Status200 environments (e.g., production, staging, development).

List Contexts

status200 context list

Displays all configured contexts. The current context is marked with *.

Switch Context

status200 context use <name>

Switch to a different named context for all subsequent commands.

# Switch to staging
status200 context use staging

# Switch to production
status200 context use production

View Current Context

status200 context current

Displays the currently active context, including the instance URL and a masked API key.

Delete a Context

status200 context delete <name>

Remove a named context. If the deleted context is the current one, the CLI automatically switches to the first remaining context.

Credential Resolution

Credentials are resolved in the following priority order:

  1. CLI flags (--api-key and --url)
  2. Environment variables (S200_API_KEY and S200_URL)
  3. Named context (via --context flag)
  4. Current context (from saved configuration)

You can mix sources -- for example, use an environment variable for the API key and a saved context for the URL.

Using CLI Flags

status200 --api-key sk-abc123 --url https://status200.ru incident list

Using Environment Variables

export S200_API_KEY=sk-abc123
export S200_URL=https://status200.ru

status200 incident list

Using a Specific Context

status200 --context production incident list

Verify Authentication

Check your current authentication status:

status200 whoami

This displays:

  • Instance URL
  • Masked API key
  • Current context name (only shown if a saved context is active)

If not authenticated, the command shows a helpful message suggesting you run status200 login.

Configuration File

Credentials are stored in ~/.status200/config.json with restricted permissions (0600).

{
  "currentContext": "production",
  "contexts": {
    "production": {
      "name": "production",
      "apiUrl": "https://status200.ru",
      "apiKey": "sk-..."
    },
    "staging": {
      "name": "staging",
      "apiUrl": "https://staging.status200.ru",
      "apiKey": "sk-..."
    }
  },
  "defaults": {
    "output": "table",
    "limit": 10
  }
}