Skip to content

CLI Reference

import { Tabs, TabItem } from ‘@astrojs/starlight/components’;

The 9n9s Command-Line Interface (9n9s-cli) allows you to interact with the 9n9s platform from your terminal.

OptionDescription
--api-key <key>Specify the API key directly. Overrides stored credentials.
--project <id>Specify the project ID to scope a command to.
--helpShow help for a command.
--versionShow the CLI version.

Authenticate the CLI with your 9n9s account.

Terminal window
9n9s-cli login

Prompts for an API Key, which is then stored locally for subsequent commands.

Manage monitors.

Terminal window
9n9s-cli monitors list [options]

Options:

  • --project <id>: Filter by project ID.
```bash 9n9s-cli monitors delete ```

Manage Heartbeat Monitors.

Terminal window
9n9s-cli heartbeat create [options]

Options:

  • --name <string> (required)
  • --schedule <string> (required)
  • --grace <duration> (required)
  • --project <id> (required)
  • --tags <list>
  • --timezone <tz>
```bash 9n9s-cli heartbeat update [options] ``` Accepts the same options as `create`. ```bash 9n9s-cli heartbeat pulse [options] [-- ] ``` **Options:** - `--start`: Send a `/start` pulse. - `--fail`: Send a `/fail` pulse. - `--exit-code `: Send a pulse with the given exit code. - `--message `: Send a message payload with the pulse. - `--payload `: Send a JSON payload with the pulse.

When a <command> is provided after --, the CLI will send a /start pulse, execute the command, and then send a final pulse with the command’s exit code.

Manage Uptime Monitors.

Terminal window
9n9s-cli uptime create [options]

Options:

  • --name <string> (required)
  • --protocol <HTTP/TCP> (required)
  • --target <url/host:port> (required)
  • --frequency <duration> (required)
  • --project <id> (required)
  • --tags <list>
  • --assertions <json_string>: A JSON string defining the assertions.
Terminal window
9n9s-cli uptime update <monitor_id> [options]

Accepts the same options as create.

Manage Configuration as Code.

Terminal window
9n9s-cli cac diff --file <path>

Compares the local definition file with the remote state and shows a diff of the planned changes.

Terminal window
9n9s-cli cac apply --file <path>

Applies the definitions from the local file to the remote state, creating, updating, and deleting resources as needed.