Authentication
Octrafic supports multiple authentication methods for testing secured APIs.
Security & Privacy
IMPORTANT: Your API keys, tokens, and passwords are NEVER sent to the AI backend.
How it works:
- You provide credentials locally via CLI flags or saved project config
- AI analyzes the API specification and conversation context
- AI instructs when authentication should be added to a request
- Your local CLI adds the actual credentials to the HTTP request
- Request is sent directly to your API endpoint
Privacy Guarantee:
- AI sees: Authentication type and header names
- AI does NOT see: Actual tokens, passwords, or keys
- Your credentials stay on your machine
Quick Start
No Authentication
bash
octrafic -u https://api.example.com -s spec.json --auth noneBearer Token
bash
octrafic -u https://api.example.com -s spec.json \
--auth bearer --token "your-token-here"API Key
bash
octrafic -u https://api.example.com -s spec.json \
--auth apikey --key X-API-Key --value "your-key-here"Basic Auth
bash
octrafic -u https://api.example.com -s spec.json \
--auth basic --user admin --pass secret123Saving Authentication
Save credentials with your project:
bash
octrafic -u https://api.com -s spec.json -n "My API" \
--auth apikey --key X-API-Key --value "secret123" \
--save-authWarning: Credentials are stored in plain text in ~/.octrafic/projects/{uuid}/project.json
Best practices:
- Use
--save-authonly for development/testing - DO NOT use for production credentials
- DO NOT commit
~/.octrafic/to version control
Next time:
bash
octrafic -n "My API"
# ✓ Using saved authentication (apikey)Managing Authentication
Override Saved Auth
bash
# Project has saved apikey, use different token temporarily
octrafic -n "My API" --auth bearer --token "different-token"Clear Saved Auth
bash
octrafic -n "My API" --clear-auth
# ✓ Authentication cleared from projectUpdate Saved Auth
bash
octrafic -u https://api.com -s spec.json -n "API" \
--auth bearer --token "new-token" --save-authPriority System
When multiple auth sources are available:
- CLI flags (highest priority)
- Saved project auth
- No auth (default)
Example:
bash
# Project has saved apikey auth
octrafic -n "API" --auth bearer --token "xyz" # Uses bearer (CLI override)
octrafic -n "API" # Uses saved apikeySafer Alternatives
Instead of --save-auth, use environment variables:
bash
# Export from environment
export API_KEY="secret123"
octrafic -n "API" --auth apikey --key X-API-Key --value "$API_KEY"
# Read from file
octrafic -n "API" --auth bearer --token "$(cat ~/.tokens/api-token)"
# Using password managers (e.g., 1Password CLI)
octrafic -n "API" --auth bearer --token "$(op read op://vault/item/token)"Related
- Project Management - Managing projects
- Getting Started - Quick start guide
