REST Lens
← Back to Documentation

Getting Started with REST Lens

Learn how to validate OpenAPI specifications against REST API best practices

REST Lens helps you validate OpenAPI specifications against REST API best practices using automated static analysis.

Quick Start

1. Create an Account

  1. Visit restlens.com
  2. Click "Sign Up" or "Get Started"
  3. Choose your authentication method:
    • Email + Password
    • GitHub OAuth
    • Google OAuth
  4. Verify your email (if using email authentication)

2. Create an Organization

Organizations group related projects together and allow team collaboration.

  1. After signing in, click "Create Organization"
  2. Enter an organization name (e.g., "Acme Corp")
  3. Choose a unique slug (e.g., "acme-corp")
    • This will be part of your project URLs
    • Can only contain lowercase letters, numbers, and hyphens
  4. Click "Create Organization"

Note: You can create multiple organizations or join existing ones via invitations.

3. Create Your First Project

Projects contain your OpenAPI specifications and evaluation results.

  1. Navigate to your organization page
  2. Click "New Project"
  3. Fill in the project details:
    • Name: Human-readable name (e.g., "Payment API")
    • Slug: URL-friendly identifier (e.g., "payment-api")
    • Description (optional): Brief description of your API
  4. Click "Create Project"

4. Upload an OpenAPI Specification

Via Web Interface

  1. Go to your project page
  2. Click "Upload" or drag and drop your file
  3. Select your OpenAPI specification file:
    • Supported formats: JSON (.json) or YAML (.yaml, .yml)
    • Maximum size: 50MB
  4. (Optional) Add a version tag (e.g., "v1.0.0" or a git commit hash)
  5. The specification will be automatically evaluated

Via Command Line

curl -X POST \
  https://restlens.com/api/projects/[org]/[project]/specifications \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/x-yaml" \
  --data-binary @openapi.yaml

See the API Integration Guide for more details.

5. Review Results

After uploading, REST Lens automatically evaluates your specification:

  1. Overview: See total violations and overall health score
  2. Violations by Path: Browse violations organized by API endpoint
  3. Violations by Rule: See which rules are being violated most
  4. Severity Breakdown: View errors, warnings, and info messages

Understanding Results

  • Error 🔴: Significant design issues that should be fixed
  • Warning ⚠️: Best practices that improve quality
  • Info ℹ️: Suggestions and recommendations

Each violation includes:

  • Rule name and ID (click for detailed explanation)
  • Specific location in your specification
  • Why it matters
  • How to fix it

6. Configure Rules (Optional)

Customize which rules apply to your project:

  1. Go to your project page
  2. Click "Rules" in the navigation
  3. For each rule, you can:
    • Enable/Disable: Turn rules on or off
    • Change Severity: Set to Error, Warning, or Info
    • Configure Options: Some rules have configurable parameters
    • Ignore Violations: Suppress specific false positives

Organization-Level Rules

Administrators can set default rules for all projects in an organization:

  1. Go to your organization page
  2. Click "Rules"
  3. Configure default settings
  4. Lock settings to enforce them across all projects

Common Workflows

Continuous Validation in CI/CD

Integrate REST Lens into your CI/CD pipeline to validate specs on every commit:

# GitHub Actions example
- name: Validate API Spec
  run: |
    curl -X POST \
      https://restlens.com/api/projects/my-org/my-project/specifications \
      -H "Authorization: Bearer ${{ secrets.RESTLENS_API_TOKEN }}" \
      -H "Content-Type: application/x-yaml" \
      --data-binary @openapi.yaml

See the full API Integration Guide for GitHub Actions, GitLab CI, and Jenkins examples.

Tracking Changes Over Time

  1. Use version tags when uploading specs:
    -H "X-Spec-Tag: ${GIT_COMMIT_SHA}"
    
  2. View specification history in your project
  3. Compare versions to see improvements or regressions
  4. Track violation trends over time

Team Collaboration

Invite Team Members

  1. Go to your organization settings
  2. Click "Members" → "Invite Member"
  3. Enter their email and select a role:
    • Owner: Full access to all organization settings
    • Admin: Manage projects and members
    • Member: View and edit projects
  4. They'll receive an email invitation

Share Results

  • Project URLs are shareable with team members
  • Use tags to identify specific versions
  • Add comments and ignore violations with context

Best Practices

Specification Management

  1. Version your specs: Use git to track OpenAPI specification changes
  2. Tag releases: Apply meaningful tags (e.g., semantic versions, git SHAs)
  3. Automate uploads: Integrate with CI/CD for continuous validation
  4. Review regularly: Check results after each change

Rule Configuration

  1. Start with defaults: Use the default rule set initially
  2. Customize gradually: Adjust rules based on your team's needs
  3. Document exceptions: Add context when ignoring violations
  4. Share standards: Use organization-level rules for consistency

API Design

  1. Fix errors first: Address all error-level violations
  2. Consider warnings: Review warnings and fix when reasonable
  3. Learn from violations: Click rule links to understand best practices
  4. Iterate: Improve your API design incrementally

Next Steps

  • Explore Rules: Browse the complete rule documentation to understand each best practice
  • Set Up CI/CD: Follow the API Integration Guide to automate validation
  • Customize Configuration: Adjust rules and severity levels for your project
  • Invite Your Team: Add team members to collaborate on API design

Troubleshooting

Upload Failed

Problem: Specification upload fails with an error

Common Solutions:

  • Check file is valid JSON/YAML: yamllint openapi.yaml
  • Verify file size is under 50MB
  • Ensure file contains valid OpenAPI 3.x specification
  • Check you have write permissions for the project

No Violations Shown

Problem: Upload succeeds but no violations appear

Possible Causes:

  • Specification is actually compliant (great job!)
  • All rules are disabled for the project
  • Evaluation is still in progress (refresh the page)

Cannot Create Project

Problem: Unable to create a new project

Common Solutions:

  • Verify you're a member of the organization
  • Check the slug doesn't already exist
  • Ensure slug uses only lowercase letters, numbers, and hyphens

API Token Not Working

Problem: CI/CD integration fails with 401 Unauthorized

Solutions:

  • Verify token includes rl_ prefix
  • Check token hasn't expired or been revoked
  • Ensure token was created for the correct project
  • Confirm Authorization: Bearer format is correct

See the API Integration Guide for more troubleshooting tips.

Helpful Resources

Need Help?