REST Lens
← Back to Documentation

CLI

Evaluate API specifications from your terminal

The REST Lens CLI allows you to evaluate OpenAPI specifications from your terminal.

Installation

# Run directly with npx
npx @restlens/cli@latest <command>

# Or install globally
npm install -g @restlens/cli

Authentication

restlens auth

This opens your browser for OAuth login. Credentials are stored in ~/.restlens/auth.json.

Commands

Evaluate a Specification

Upload a spec, wait for evaluation, and display violations:

restlens eval ./openapi.yaml -p my-org/my-project

Options:

  • -p, --project <org/name> - Project in org/name format (required)
  • --tag <tag> - Version tag (e.g., v1.0.0)
  • --timeout <seconds> - Max wait time for evaluation (default: 60)

Upload Only

Upload a spec without waiting for results:

restlens upload ./openapi.yaml -p my-org/my-project

View Violations

Get violations for the latest specification:

restlens violations -p my-org/my-project

Options:

  • --severity <level> - Filter by severity (error, warning, info)
  • --limit <n> - Max violations to show (default: 50)

List Projects

restlens projects

Check Status

restlens status

Logout

restlens logout

Multi-Server Support

For non-production servers, set the RESTLENS_URL environment variable:

export RESTLENS_URL=https://staging.restlens.com
restlens auth
restlens eval ./openapi.yaml -p my-org/my-project

Examples

# Basic evaluation
restlens eval ./api/openapi.yaml -p acme/payments-api

# With version tag
restlens eval ./openapi.yaml -p acme/api --tag v2.1.0

# View only errors
restlens violations -p acme/api --severity error

CI/CD

For automated pipelines, use API tokens instead of the CLI.