octo health: check the API and your key

Run octo health to confirm the Askocto API is reachable and your API key works, and use its exit code in scripts and CI.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

octo health is the quickest way to find out whether the CLI can reach the API and whether your key is accepted. Run it after installing the CLI, when a command fails for no clear reason, or at the start of a CI job before the real work begins.

Run the check

octo health

Sample output:

API        ok   https://api.askocto.co
Auth       ok   workspace key oc_live_a1b2
Latency    182 ms

The command calls the health endpoint first and then makes one authenticated request with your key. The latency figure above is only an example from one machine.

What each line means

Line Meaning
API The API answered at the configured baseUrl.
Auth The key is valid. The line shows the key prefix and the workspace it belongs to.
Latency Round trip time of the health request from your machine.

Exit codes

Code Meaning
0 Everything is ok.
1 The API answered, but the key was missing or rejected.
2 The API could not be reached.

Add --json for output a script can read.

octo health --json
{
  "api": { "status": "ok", "baseUrl": "https://api.askocto.co" },
  "auth": { "status": "ok", "keyPrefix": "oc_live_a1b2" },
  "latencyMs": 182
}

Use it in CI

export OCTO_API_KEY="oc_test_your_key_here"
octo health || exit 1

A failed check stops the job before any command changes data.

Troubleshooting

  • API fails. Check your network, proxy settings and the baseUrl value in octo config.
  • Auth fails. Run octo auth status to see which key the CLI uses. An old OCTO_API_KEY in your shell can override the saved key.
  • Slow responses. Run the command again and compare. A single slow reading is not a sign of a problem.

Tip: Use a key that starts with oc_test_ in CI so a script mistake cannot touch production data.

Something unclear or missing? Tell us and we will fix the page.