Guides
CLI Reference

CLI Reference

Complete reference for every nat command.

Global flags

These flags are available on all commands:

FlagShortDescription
--help-hShow help text
--version-vPrint NAT version and exit
--verboseEnable verbose/debug output
--config-cPath to config file (default: ~/.nat/config.yaml)
--no-colorDisable ANSI color output
--jsonOutput command results as JSON

nat scan

Run a security scan against a target API.

nat scan [flags]

Required flags

FlagDescription
--url <url>Base URL of the target API

Discovery flags

FlagDescriptionDefault
--spec <path|url>OpenAPI 3.x / Swagger 2.x specAuto-discover
--depth <n>Crawl depth for endpoint discovery3
--include <pattern>Only test paths matching glob patternAll paths
--exclude <pattern>Skip paths matching glob patternNone
--graphqlEnable GraphQL introspection and testingAuto-detect

Authentication flags

FlagDescription
--auth-type <type>bearer, header, basic, oauth2, none
--token <token>Bearer token value
--header <K:V>Custom header (repeatable)
--oauth2-token-urlOAuth2 token endpoint URL
--oauth2-client-idOAuth2 client ID
--oauth2-client-secretOAuth2 client secret
--oauth2-scopeOAuth2 scopes (space-separated)

Execution flags

FlagDescriptionDefault
--concurrency <n>Parallel request count5
--timeout <s>Per-request timeout (seconds)30
--rate-limit <n>Max requests per secondUnlimited
--max-requests <n>Hard cap on total requestsUnlimited
--dry-runDiscover endpoints only, no testsfalse

Output flags

FlagDescriptionDefault
--output <path>Report output file path./nat-report.html
--format <fmt>html, json, sarif, markdownhtml
--severity <level>Minimum severity to include in reportinfo
--fail-on <level>Exit with non-zero code if findings ≥ levelNone
--openOpen report in browser after scanfalse

Examples

# Basic scan
nat scan --url https://api.example.com
 
# Scan with OpenAPI spec, authenticated
nat scan \
  --url https://api.example.com \
  --spec ./openapi.yaml \
  --auth-type bearer \
  --token "$TOKEN"
 
# CI mode — fail build on high+ findings, SARIF output
nat scan \
  --url https://staging.example.com \
  --spec ./openapi.yaml \
  --format sarif \
  --output results.sarif \
  --fail-on high

nat demo

Run a complete demo scan against NAT's built-in example API.

nat demo [flags]
FlagDescription
--no-browserDon't open the report in a browser
--output <path>Save demo report to a specific path

nat server

Manage the NAT local server (self-hosted mode).

nat server start

nat server start [flags]
FlagDescriptionDefault
--port <n>Listen port8080
--host <addr>Bind address127.0.0.1
--data-dir <path>Data and report storage directory~/.nat/data
--daemonRun as background daemonfalse

nat server stop

nat server stop

Stop a running background daemon.

nat server status

nat server status

Show server status, port, and uptime.


nat report

View or export scan reports.

nat report [flags]
FlagDescriptionDefault
--scan-id <id>Specific scan to report onLatest
--format <fmt>html, json, sarif, markdownhtml
--output <path>Output file path./nat-report.<fmt>
--openOpen HTML report in browserfalse
--listList all available scan reportsfalse

nat auth

Manage NAT cloud authentication (SaaS plan).

nat auth login

nat auth login --key <api-key>

nat auth logout

nat auth logout

nat auth status

nat auth status

nat config

Manage NAT configuration.

nat config show

nat config show

Print current configuration.

nat config set

nat config set <key> <value>

Set a configuration value. Example:

nat config set scan.concurrency 10
nat config set scan.timeout 60

nat config reset

nat config reset

Reset all configuration to defaults.


Configuration file

NAT reads configuration from ~/.nat/config.yaml by default. Override with --config <path>.

# ~/.nat/config.yaml
scan:
  concurrency: 5
  timeout: 30
  depth: 3
  default_format: html
 
server:
  port: 8080
  host: 127.0.0.1
  data_dir: ~/.nat/data
 
auth:
  api_key: ""     # Set via `nat auth login` or NAT_API_KEY env var

Environment variables

All configuration keys can be set via environment variables using the NAT_ prefix and _ separator:

VariableEquivalent config key
NAT_API_KEYauth.api_key
NAT_SCAN_CONCURRENCYscan.concurrency
NAT_SCAN_TIMEOUTscan.timeout
NAT_SERVER_PORTserver.port
NAT_SERVER_HOSTserver.host
NAT_DATA_DIRserver.data_dir
NAT_LOG_LEVELlog.level

Environment variables take precedence over the config file.

Exit codes

CodeMeaning
0Success — scan completed, no findings at or above --fail-on level
1Findings found at or above --fail-on severity level
2Scan error (target unreachable, auth failure, etc.)
3Configuration or usage error