📚 MicroRapid CLI Commands Reference
📋 Complete Command Reference
Core Commands
| Command | Purpose | Example |
|---|
init | Create new project from OpenAPI spec | mrapids init my-api --from-url https://api.example.com/openapi.yaml |
validate | Validate OpenAPI specification | mrapids validate api-spec.json --strict |
explore | Deep search across API spec | mrapids explore payment |
env | Manage environments | mrapids env list |
list | Discover available operations | mrapids list --filter user --method POST |
auth | Manage authentication | mrapids auth detect --spec api.yaml |
show | View operation details | mrapids show repos/get |
run | Execute an API operation | mrapids run GetUser --param id=123 --env prod --profile api-key |
doctor | Diagnose configuration issues | mrapids doctor --fix |
diff | Compare API specifications | mrapids diff old.yaml new.yaml --breaking-only |
gen | Generate code/SDKs/fixtures | mrapids gen sdk --language typescript |
test | Run API tests | mrapids test --all --env staging --profile qa |
Collection Commands
| Command | Purpose | Example |
|---|
collection create | Create new collection | mrapids collection create my-tests |
collection run | Execute collection | mrapids collection run smoke-tests --env prod --profile api-key |
collection list | Show all collections | mrapids collection list |
collection show | Show collection details | mrapids collection show user-onboarding |
collection validate | Validate collection syntax | mrapids collection validate my-tests |
collection test | Run collection as tests | mrapids collection test smoke-tests --env staging |
Authentication Commands
| Command | Purpose | Example |
|---|
auth detect | Detect required authentication | mrapids auth detect --spec api.yaml |
auth connect | Configure authentication | mrapids auth connect api-key |
auth login | Login to OAuth provider | mrapids auth login github |
auth test | Test authentication | mrapids auth test --profile github-main |
auth validate | Validate auth configuration | mrapids auth validate --profile production |
auth refresh | Refresh OAuth tokens | mrapids auth refresh --profile oauth-prod |
Environment Commands
| Command | Purpose | Example |
|---|
env list | List all environments | mrapids env list |
env create | Create new environment | mrapids env create qa --base-url https://qa.api.com |
env use | Set default environment | mrapids env use staging |
env show | Show environment details | mrapids env show production |
🎯 Command Options Reference
init Command Options
mrapids init <project-name> [options]
| Option | Description | Example |
|---|
--from-url <url> | Initialize from URL | --from-url https://api.example.com/openapi.json |
--from-file <file> | Initialize from local file | --from-file ./openapi.yaml |
--template <type> | Project template (minimal, rest, graphql) | --template rest |
--force | Overwrite existing directory | --force |
--allow-insecure | Allow insecure HTTP connections | --allow-insecure |
list Command Options
mrapids list [options]
| Option | Description | Example |
|---|
--filter/-f <keyword> | Search operations by keyword | --filter user |
--method/-m <METHOD> | Filter by HTTP method | --method POST |
--limit <n> | Limit results | --limit 10 |
--format <type> | Output format (table, json, simple) | --format json |
run Command Options
mrapids run <operation> [options]
| Option | Description | Example |
|---|
--param <key=value> | Set parameter value | --param id=123 |
--env <environment> | Use specific environment | --env production |
--profile <profile> | Use auth profile | --profile github-main |
--file <file> | Request body from file | --file request.json |
-i | Interactive mode | -i |
--minimal | Minimal template (with -i) | -i --minimal |
--full | Full template (with -i) | -i --full |
--dry-run | Preview without executing | --dry-run |
--as-curl | Show as curl command | --as-curl |
--verbose | Detailed output | --verbose |
--save-to-collection | Save successful request | --save-to-collection |
--save-as <name> | Save with specific name | --save-as user-fetch |
--timeout <ms> | Request timeout | --timeout 5000 |
--retry <n> | Number of retries | --retry 3 |
--trace | Trace HTTP traffic | --trace |
--replay-last | Replay last query | --replay-last |
--query-file <file> | Use query file | --query-file query.json |
--help-query | Show query syntax help | --help-query |
--build-query | Interactive query builder | --build-query |
--format <type> | Output format | --format json |
--auth <string> | Direct auth (not recommended) | --auth "Bearer token" |
validate Command Options
mrapids validate <spec-file> [options]
| Option | Description | Example |
|---|
--strict | Treat warnings as errors | --strict |
--lint | Check for best practices | --lint |
--rules <file> | Custom linting rules | --rules api-rules.yaml |
--format <type> | Output format (text, json) | --format json |
doctor Command Options
mrapids doctor [options]
| Option | Description | Example |
|---|
--fix | Auto-fix issues | --fix |
--check <area> | Check specific area | --check auth |
--env <environment> | Check specific environment | --env production |
--quiet | Quiet mode | --quiet |
--format <type> | Output format (text, json) | --format json |
Check areas:
config - Configuration files
auth - Authentication setup
spec - OpenAPI specification
env - Environment variables
diff Command Options
mrapids diff <old-spec> <new-spec> [options]
| Option | Description | Example |
|---|
--breaking-only | Show only breaking changes | --breaking-only |
--fail-on-breaking | Exit with error on breaking changes | --fail-on-breaking |
--format <type> | Output format (text, json, markdown) | --format markdown |
--quiet | Suppress output | --quiet |
gen Command Options
mrapids gen <type> [options]
Generation Types:
| Type | Description | Example |
|---|
sdk | Generate SDK client | mrapids gen sdk --language typescript |
snippets | Generate code examples | mrapids gen snippets --format curl |
stubs | Generate server stubs | mrapids gen stubs --framework express |
fixtures | Generate test data | mrapids gen fixtures --count 100 |
Common Options:
| Option | Description | Example |
|---|
--language <lang> | Target language | --language python |
--output <dir> | Output directory | --output ./sdk |
--package-name <name> | Package name | --package-name @company/api |
--with-docs | Include documentation | --with-docs |
--with-tests | Include tests | --with-tests |
--with-examples | Include examples | --with-examples |
--framework <name> | Server framework | --framework fastapi |
--count <n> | Number of fixtures | --count 50 |
--seed <n> | Random seed | --seed 42 |
--format <type> | Output format | --format yaml |
collection Command Options
mrapids collection <subcommand> [options]
collection run Options:
| Option | Description | Example |
|---|
--env <environment> | Use environment | --env staging |
--profile <profile> | Use auth profile | --profile api-key |
--var <key=value> | Set variable | --var userId=123 |
--fail-fast | Stop on first failure | --fail-fast |
--report <format> | Report format (junit, json) | --report junit |
collection test Options:
| Option | Description | Example |
|---|
--env <environment> | Use environment | --env staging |
--profile <profile> | Use auth profile | --profile qa-creds |
--fail-fast | Stop on first failure | --fail-fast |
--report <format> | Test report format | --report junit |
📖 Complete Examples
Basic API Execution
# Simple GET request
mrapids run GetUser --param id=123
# With environment and authentication
mrapids run GetUser \
--param id=123 \
--env production \
--profile api-key-prod
# POST with file and save to collection
mrapids run CreateUser \
--file user-data.json \
--env staging \
--profile oauth-staging \
--save-to-collection
Working with GitHub API
# Initialize GitHub API project
mrapids init github-api \
--from-url https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json
# List repository operations
mrapids list --filter repo --method POST
# Get repository details
mrapids run repos/get \
--param owner=microsoft \
--param repo=vscode \
--env production \
--profile github-main
# Create repository with interactive mode
mrapids run repos/create-for-user -i
# Edit the generated template, then:
mrapids run repos/create-for-user \
--file create_repo_request.json \
--env production \
--profile github-main \
--save-to-collection
Authentication Setup
# Detect required authentication
mrapids auth detect --spec api.yaml
# Configure API key authentication
mrapids auth connect api-key
# Login to GitHub OAuth
mrapids auth login github
# Test authentication profile
mrapids auth test --profile github-main
# Validate production credentials
mrapids auth validate --profile production
Environment Management
# List all environments
mrapids env list
# Create QA environment
mrapids env create qa --base-url https://qa-api.example.com
# Switch default environment
mrapids env use staging
# Show environment details
mrapids env show production
Collection Management
# Create new collection
mrapids collection create smoke-tests
# Validate collection syntax
mrapids collection validate smoke-tests
# Run collection with variables
mrapids collection run user-onboarding \
--env staging \
--profile test-creds \
--var email="test@example.com" \
--var username="testuser"
# Run as tests with report
mrapids collection test regression-suite \
--env staging \
--profile qa-automation \
--report junit > test-results.xml
API Validation and Testing
# Validate OpenAPI spec
mrapids validate api-spec.yaml --strict --lint
# Check for breaking changes
mrapids diff v1.0/api.yaml v2.0/api.yaml --breaking-only
# Run all tests
mrapids test --all --env staging --profile qa
# Diagnose issues
mrapids doctor --env production --fix
Code Generation
# Generate TypeScript SDK
mrapids gen sdk \
--language typescript \
--output ./sdk/typescript \
--package-name "@company/api-client" \
--with-docs \
--with-tests
# Generate test fixtures
mrapids gen fixtures \
--count 100 \
--seed 42 \
--output ./test-data
# Generate curl examples
mrapids gen snippets \
--format curl \
--output ./docs/examples
Advanced Query Building
# Interactive query builder
mrapids run searchProducts --build-query
# Complex query with filters
mrapids run searchProducts \
--param q="category:electronics price:>100" \
--param sort="price:asc" \
--param page=1 \
--param limit=20 \
--env production \
--profile api-key
# Use query file
cat > query.json << EOF
{
"filter": "status = 'active' and created >= '2024-01-01'",
"sort": "created:desc",
"page": 1,
"limit": 50
}
EOF
mrapids run listItems --query-file query.json
Debugging and Development
# Preview request without sending
mrapids run DeleteUser \
--param id=123 \
--dry-run
# Show as curl command
mrapids run DeleteUser \
--param id=123 \
--as-curl
# Trace HTTP traffic
mrapids run GetUser \
--param id=123 \
--trace \
--verbose
# Replay last successful request
mrapids run GetUser --replay-last
🎓 Pro Tips
1. Use Environment-Specific Configs
# Development with verbose output
mrapids run GetUser --env dev --verbose
# Production with specific profile
mrapids run GetUser --env prod --profile prod-readonly
2. Chain Operations with Collections
# .mrapids/collections/user_flow.yaml
requests:
- name: Create User
operation: CreateUser
save_as: user
- name: Add Payment Method
operation: AddPaymentMethod
params:
user_id: "{{ user.id }}"
depends_on: ["Create User"]
3. Interactive Mode for Complex Requests
# Generate minimal template
mrapids run ComplexOperation -i --minimal
# Generate full template with all fields
mrapids run ComplexOperation -i --full
4. Always Validate Before Production
# Dry run first
mrapids run DeleteUser --param id=123 --dry-run
# Check as curl
mrapids run DeleteUser --param id=123 --as-curl
# Validate spec changes
mrapids diff old.yaml new.yaml --breaking-only
5. Set Up Proper Authentication Profiles
# Create profile for each environment
cat > .mrapids/auth/prod.toml << EOF
[profile]
name = "production"
type = "bearer"
[auth]
token_env = "PROD_API_TOKEN"
EOF
# Use environment-specific profiles
mrapids run GetUser --env production --profile prod
Universal API Specification Support
- ✅ Swagger 2.0 - Classic format, widely used
- ✅ OpenAPI 3.0 - Modern standard with rich features
- ✅ OpenAPI 3.1 - Latest version with JSON Schema compatibility
- ✅ JSON and YAML - Both file formats supported
- ✅ Local files and URLs - Load from disk or internet
🚀 Next Steps
Ready to start using MicroRapid?
Begin by initializing your first API project:
mrapids init your-api --from-url https://your-api.com/openapi.json
Need help? Check our Quick Start Guide or Documentation.