Documentation
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
--watchEnable live progress and inline findings displayfalse

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
--diff <scan-id>Compare results against a previous scan IDโ€”

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
 
# Live progress mode โ€” see findings as they are discovered
nat scan --url https://api.example.com --watch
 
# Regression delta โ€” compare against a previous scan
nat scan --url https://api.example.com --diff scan_abc123

nat init

Detect your project's framework and generate a .natrc configuration file.

nat init [flags]
FlagDescription
--ciGenerate a CI-optimised config with --fail-on high and SARIF output
--forceOverwrite an existing .natrc file
--template <name>Start from a named starter template

Examples

# Auto-detect framework and generate .natrc
nat init
 
# Generate a CI-ready config
nat init --ci
 
# Overwrite an existing config
nat init --force

The interactive flow detects your framework (e.g. Express, FastAPI) and any OpenAPI spec in the project, then writes a pre-filled .natrc to the current directory.

nat init --ci produces a config with --fail-on high and SARIF output enabled โ€” ready to drop into a GitHub Actions workflow.


nat status

Display a health dashboard showing the status of all NAT components.

nat status [flags]
FlagDescription
--jsonOutput status as machine-readable JSON
--watchContinuously refresh the dashboard (live mode)

Example output

NAT Status Dashboard
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Component        Status
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Engine           โœ… Connected
AI Provider      โœ… Connected
Database         โœ… Connected
CI Integration   โš ๏ธ  Degraded
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

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 setup

Interactive setup wizard that walks you through configuring NAT from scratch.

nat setup [flags]
FlagDescription
--non-interactiveSkip all prompts โ€” read configuration from environment variables
--demoLaunch nat demo after setup completes

See the Setup Wizard guide for a detailed walkthrough of all 7 phases.


nat upgrade

Check for updates and upgrade NAT to the latest version.

nat upgrade [flags]
FlagDescription
--checkOnly check if an update is available โ€” don't install
--migrateRun alembic upgrade head after upgrading (for self-hosted deployments)
--preAllow pre-release versions

See the Upgrade & Uninstall guide for details.


nat uninstall

Remove NAT configuration files, data, and shell completions.

nat uninstall [flags]
FlagShortDescription
--keep-configPreserve .natrc files
--yes-ySkip confirmation prompt
--purgeAlso run alembic downgrade base and remove Docker volumes

See the Upgrade & Uninstall guide for details.


nat doctor

Run pre-flight environment validation checks.

nat doctor [flags]
FlagDescription
--jsonOutput check results as a JSON array for CI/automation
--verboseShow detailed diagnostics and fix hints for each check

Runs 8 checks: Python version (โ‰ฅ 3.10), pip extras, critical env vars, .natrc config, database connectivity, Alembic migration state, LLM keys, and exporter reachability. See the Environment Doctor guide for details.


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 badge

Generate a compliance badge for your API security posture.

nat badge [flags]
FlagDescriptionDefault
--framework <name>Compliance framework: owasp, pci-dss, hipaa, soc2owasp
--format <fmt>Output format: svg, png, markdownsvg
--output <path>Output file path./badge.<fmt>
--scan-id <id>Base badge on a specific scan (defaults to latest)Latest

Examples

# Generate an OWASP SVG badge from the latest scan
nat badge --framework owasp --format svg --output badges/owasp.svg
 
# Generate a PCI-DSS markdown badge
nat badge --framework pci-dss --format markdown --output badges/pci-dss.md
 
# Base badge on a specific scan
nat badge --framework hipaa --scan-id scan_abc123 --format png --output badges/hipaa.png

nat ai

AI-powered assistant for test planning, finding explanation, and compliance reporting. Requires an AI provider to be configured (see AI Assistant docs).

nat ai <subcommand> [flags]

Global AI flags

FlagDescription
--provider <name>AI provider: openai, anthropic, ollama, azure
--model <name>Model name (e.g. gpt-4, claude-3-opus, llama3)
--chatStart an interactive REPL session

nat ai plan

Generate a test plan from an OpenAPI spec.

nat ai plan [flags]
FlagDescription
--spec <path>Path to OpenAPI/Swagger spec
--focus <area>Narrow the plan to a specific area (e.g. auth, payments)
--output <path>Save the plan to a file
nat ai plan --spec ./openapi.yaml --focus auth --output test-plan.md

nat ai generate-tests

Generate test cases for specific endpoints.

nat ai generate-tests [flags]
FlagDescription
--endpoint <path>API endpoint path (e.g. /users/{id})
--method <method>HTTP method (e.g. GET, POST)
--spec <path>Path to OpenAPI/Swagger spec
nat ai generate-tests --spec ./openapi.yaml --endpoint /users/{id} --method GET

nat ai explain

Explain scan findings in plain English with actionable remediation advice.

nat ai explain [flags]
FlagDescription
--scan-id <id>Scan to explain findings from (defaults to latest)
--finding-id <id>Explain a specific finding
--verboseInclude extended remediation details and code examples
nat ai explain --scan-id scan_abc123 --finding-id find_001 --verbose

nat ai configure

Interactive .natrc configuration advisor.

nat ai configure [flags]
FlagDescription
--analyzeAnalyze your existing .natrc and suggest improvements
# Start interactive advisor
nat ai configure
 
# Analyze and improve an existing config
nat ai configure --analyze

nat ai compliance-report

Generate a compliance report for a specific framework.

nat ai compliance-report [flags]
FlagDescriptionDefault
--framework <name>Compliance framework: owasp, pci-dss, hipaa, soc2Required
--scan-id <id>Source scan (defaults to latest)Latest
--format <fmt>Output format: pdf, html, markdownhtml
nat ai compliance-report --framework owasp --format pdf

nat ai audit-trail

Generate a BGSTM (Bug Generation, Scan, Test, Mitigate) 6-phase audit trail document.

nat ai audit-trail [flags]
FlagDescriptionDefault
--scan-id <id>Source scan (defaults to latest)Latest
--format <fmt>Output format: pdf, html, markdownhtml
--output <path>Output file path./audit-trail.<fmt>
nat ai audit-trail --scan-id scan_abc123 --format pdf --output audit.pdf

nat ai insights

Get proactive insights and trend analysis from your scan history.

nat ai insights [flags]
FlagDescriptionDefault
--limit <n>Number of scans to analyse10
--severity <level>Filter insights by severity levelAll
nat ai insights --limit 20 --severity high

Interactive REPL

# Start a conversational AI assistant session
nat ai --chat
 
# Use a local Ollama model
nat ai --provider ollama --model llama3 --chat

See the AI Assistant docs for detailed guides on each subcommand.


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 (.natrc)

NAT automatically looks for a .natrc YAML configuration file to set default values for CLI flags. This lets you avoid repeating common options on every command.

Lookup order

  1. Project directory โ€” .natrc in the current working directory
  2. Home directory โ€” ~/.natrc in your home directory
  3. Explicit path โ€” --config /path/to/config.yaml overrides both

The first file found wins. CLI flags always override values loaded from .natrc.

Example .natrc

# .natrc โ€” NAT project-level configuration
# Place this file in your project root or home directory.
 
# Scan defaults
base_url: https://api.example.com
spec: ./openapi.yaml
timeout: 30
executors: 5
output: json
verbose: false
 
# Authentication
auth_token: "${NAT_AUTH_TOKEN}"
# api_key: "${NAT_API_KEY}"
# api_key_header: X-API-Key
 
# AI Assistant
ai:
  provider: openai
  model: gpt-4
  # provider: ollama
  # model: llama3
 
# Server defaults (for `nat server start`)
# host: 0.0.0.0
# port: 8080
# log_level: info

.natrc vs ~/.nat/config.yaml โ€” .natrc is a project-level config file that lives alongside your code. ~/.nat/config.yaml stores global NAT defaults (like your default API key). Project-level .natrc values take precedence over global defaults, and CLI flags override both.

For a complete example, see examples/.natrc.example (opens in a new tab) in the framework repository.


Global configuration file

NAT reads global 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
NAT_AI_PROVIDERai.provider
NAT_AI_MODELai.model
NAT_AI_API_KEYai.api_key

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

nat-admin

Manage tenants, API keys, and plans for a self-hosted NAT deployment.

nat-admin is a separate CLI entry point installed alongside nat-engine. It operates directly on the database and requires DATABASE_URL to be set.

export DATABASE_URL=postgresql://user:password@localhost:5432/nat
nat-admin <command> [flags]

Prerequisites

RequirementDetails
DATABASE_URLPostgreSQL connection string โ€” must be set in the environment
Database migrationsRun alembic upgrade head before first use

Subcommands

CommandDescription
nat-admin tenant createCreate a new tenant
nat-admin tenant listList all tenants (with optional filters)
nat-admin tenant show <tenant-id>Show details for a specific tenant
nat-admin tenant update <tenant-id>Update plan, quota, or security quota
nat-admin tenant deactivate <tenant-id>Deactivate a tenant
nat-admin tenant rotate-key <tenant-id>Rotate the API key for a tenant
nat-admin tenant usage <tenant-id>Show scan usage for a tenant

All subcommands accept --json for machine-readable output.

nat-admin tenant create

nat-admin tenant create --name "Acme Corp" --email admin@acme.com [--plan free]
FlagDescriptionDefault
--name <name>Tenant display nameRequired
--email <email>Admin email addressRequired
--plan <plan>Plan: free, pro, team, enterprisefree

nat-admin tenant list

nat-admin tenant list [--plan <plan>] [--limit <n>] [--all]
FlagDescriptionDefault
--plan <plan>Filter by plan: free, pro, team, enterpriseAll plans
--limit <n>Maximum results to return50
--allReturn all tenants (override --limit)false

nat-admin tenant show

nat-admin tenant show <tenant-id>

Shows tenant ID, name, email, plan, quota, API key prefix, and creation date.

nat-admin tenant update

nat-admin tenant update <tenant-id> --plan pro [--quota 500] [--security-quota 100]
FlagDescription
--plan <plan>New plan: free, pro, team, enterprise
--quota <n>Monthly scan quota
--security-quota <n>Monthly security scan quota

nat-admin tenant deactivate

nat-admin tenant deactivate <tenant-id>

Deactivates the tenant. Existing scan data is preserved. Reactivation requires a database update.

nat-admin tenant rotate-key

nat-admin tenant rotate-key <tenant-id>

Generates a new API key for the tenant. The old key is immediately invalidated.

nat-admin tenant usage

nat-admin tenant usage <tenant-id>

Prints the tenant's scan count and quota consumption for the current billing period.

Examples

# Create a new tenant on the pro plan
nat-admin tenant create --name "Acme Corp" --email admin@acme.com --plan pro
 
# List all enterprise tenants as JSON
nat-admin tenant list --plan enterprise --json
 
# Upgrade a tenant's plan and set a quota
nat-admin tenant update ten_abc123 --plan team --quota 1000
 
# Rotate an API key and capture the new value
nat-admin tenant rotate-key ten_abc123 --json
 
# Show current usage for a tenant
nat-admin tenant usage ten_abc123

Exit codes

CodeMeaning
0Success
1Error (tenant not found, database error, missing required flag, etc.)
Was this helpful?