Skip to main content
Every command is designed to be safe to script. This page covers the rules all commands follow, so you can rely on them in automation.

The essentials

  1. Authenticate with SABAOTH_API_KEY, not sabaoth login. Store the key in your CI provider’s secret store. See Authentication.
  2. Pass --json and parse stdout.
  3. Pass --yes to postgres create, postgres delete and backup create. Without a terminal they refuse to run unconfirmed.
  4. Branch on the exit code, and on the error code when you need detail.

Output streams

This means sabaoth postgres list --json > services.json always produces a clean file, and confirmation prompts never end up in captured output.

JSON output

With --json, a successful command prints exactly one JSON document on stdout.
  • Keys are snake_case.
  • Within a major version, fields are only ever added, never renamed or removed. Ignore fields you don’t recognize so your scripts keep working as new ones appear.
  • Every list command puts its results in items.
  • JSON output isn’t altered for terminal safety. Values round-trip exactly as the API sent them.
sabaoth postgres logs --json is the exception: it prints newline-delimited JSON, one record per line. See JSON output for logs.

Warnings

In human mode, warnings print on stderr as Warning: .... In --json mode they’re added to the success document instead, so stderr stays clean:

Errors

A failed command prints exactly one error. In --json mode the error is a single line of JSON on stderr, and stdout stays empty:
In human mode the error goes to stderr as:
followed by a Request ID: line when there is one, and This failure may be temporary; retrying is safe. when retryable is true.

Exit codes

Exit codes are part of the CLI’s stable interface and won’t change within a major version.

Retrying safely

Only retry when retryable is true. That covers network failures (NETWORK_UNAVAILABLE), rate limiting (RATE_LIMITED) and temporary API outages (API_UNAVAILABLE). The CLI never retries a create, delete or backup request on its own. If one of them gets no response, it fails with UNKNOWN_MUTATION_OUTCOME and retryable: false, because the change may already have happened. Check before trying again, or you risk a second billable service or duplicate backup. See the “If the result is unknown” section on each command’s page.

Colors

Colors are turned off when stdout isn’t a terminal. To turn them off everywhere, set NO_COLOR to any value:

Examples

Get the IDs of all ready services

Wait for a new service to be ready

Handle a specific error

Back up before a migration

GitHub Actions

GitLab CI

If the CI key covers more than one organization, add --org <org-id> to every command, or the CLI fails with AMBIGUOUS_ORGANIZATION.