Skip to main content

Mock Loki is now Stage! Read the announcement

Quickstart Guide

Start simulating scenarios on your site in under 5 minutes. You'll need a developer to complete the initial setup, then your whole team can create and share simulations.

1. Sign Up & Create a Project

Visit the dashboard and sign up for a free account. Create your first project.

2. Create an Environment

Inside your project, create an environment (e.g., "dev", "staging", "production").

3. Generate an API Key

Navigate to your environment and generate an API key. Store it securely—it won't be shown again.

API Key: lk_aBcDeFgHiJkLmNoPqRsTuVwXyZ123456

4. Register a Dependency

Add a dependency (e.g., your CMS API). Provide:

  • Name: "My CMS"
  • Slug: "cms"
  • Upstream Base URL: https://api.cms.com
  • Auth Strategy: passthrough (or inject/replace if needed)

5. Create a Scenario

Create a scenario called "Spring Promo" with slug "spring-promo".

6. Add Rules to Your Scenario

Add a rule to your scenario:

Rule: Reduce Prices by 20%

Match: GET /products/* with status 200

Action: JSON Override { "price": 0.8 }

7. Update Your Code

Change your API calls to use the gateway:

// Before
fetch('https://api.cms.com/products')
// After
fetch('https://gateway.usestage.dev/gw/YOUR_KEY/cms/products', {
  headers: {
    'X-Scenario': 'spring-promo'
  }
})

8. Test Your Scenario

Make a request with the scenario header. The response will have prices reduced by 20%.

You can also activate scenarios via query param: ?scenario=spring-promo

Next Steps

  • Explore JSON Patch for complex mutations
  • Test error injection for resilience testing
  • Add latency rules to simulate slow networks
  • Use the Test Request tool in the dashboard
  • Monitor gateway request logs in the admin app