Authentication - Pretorin CLI Documentation
Description: Documentation for the Pretorin CLI - compliance tools for developers and AI agents.

## Keyboard shortcuts

Press `←` or `→` to navigate between chapters

Press `S` or `/` to search in the book

Press `?` to show this help

Press `Esc` to hide this help

# Authentication

## Getting an API Key

Get your API key from platform.pretorin.com.

> Beta Note: Framework and control browsing works for all authenticated users. Platform write features (evidence, narratives, monitoring) require a beta code. Systems can only be created on the platform, not through the CLI or MCP. Sign up for early access.

## Login

    pretorin login

You’ll be prompted to enter your API key. Credentials are stored in `~/.pretorin/config.json`.

If you’re already authenticated, `pretorin login` validates your existing key against the API and skips the prompt.

## Verify Authentication

    $ pretorin whoami
    [°~°] Checking your session...
    ╭──────────────────────────────── Your Session ────────────────────────────────╮
    │ Status: Authenticated                                                        │
    │ API Key: 4MAS****...9v7o                                                     │
    │ API URL: https://platform.pretorin.com/api/v1                                │
    │ Frameworks Available: 8                                                      │
    ╰──────────────────────────────────────────────────────────────────────────────╯

## Logout

Clear stored credentials:

    pretorin logout

## API Key via Environment Variable

You can set your API key via environment variable instead of `pretorin login`. The environment variable takes precedence over stored config:

    export PRETORIN_API_KEY=pretorin_your_key_here

This is useful for CI/CD pipelines and containerized environments.