API Pilot Logo
v1.0.0 Last updated: Feb 4, 2026, 10:39 AM

API Interceptor, Mocker and Tester Documentation

API Interceptor, Mocker and Tester Documentation

Intercept. Mock. Test. Master your API flows.

API Pilot presents the API Interceptor, Mocker and Tester extension โ€” a powerful browser tool that allows you to intercept, mock, and test API requests directly from your browser. This documentation covers how to use both the GUI editor and the JSON editor for advanced configurations.


Table of Contents

  1. Getting Started
  2. Guest Access & Limits
  3. Core Concepts
  4. Using the GUI Editor
  5. Using the JSON Editor
  6. API Tester
  7. Concurrency Tester
  8. Environments
  9. Rule JSON Schema Reference
  10. Static Mocking
  11. Dynamic Response Modification
  12. Examples
  13. Troubleshooting

Getting Started

  1. Install the API Pilot: Interceptor, Mocker & Tester extension from the Chrome Web Store or Firefox Add-ons.
  2. Click the extension icon to open the sidebar.
  3. Use the global toggle to enable/disable all interception rules.
  4. Click "Add Rule" to create your first interceptor rule.

Guest Access & Limits

You can use API Pilot without creating an account (Guest Access). However, to ensure fair usage and sustainability, Guest Access has specific limits:

FeatureGuest Limit
Interceptor RulesMax 3 active rules
API HistoryMax 20 recent requests (FIFO)
Saved RequestsMax 5 saved API calls
EnvironmentsMax 1 environment
Concurrency TestingEnabled (Standard limits apply)
cURL ImportEnabled

Upgrade to Pro to unlock unlimited rules, history, and environments.


Core Concepts

Rule Types (Actions)

Action TypeDescription
MOCKReturn a custom response instead of making the actual network request
REDIRECTRedirect the request to a different URL
MODIFY_HEADERSModify request or response headers

Mock Types

Mock TypeDescription
STATICReturn a fixed JSON/text response
DYNAMICIntercept the real response and conditionally modify specific fields

Route Matching

Route TypeDescriptionExample
WILDCARDUse * as a wildcard/api/users/* matches /api/users/123
EXACTMatch the exact path/api/users/me
REGEXUse regular expressions^/api/v[0-9]+/users

Using the GUI Editor

The GUI editor provides a user-friendly interface for creating and editing rules.

Basic Configuration

  1. Name: A descriptive name for your rule (e.g., "Mock User Profile API")
  2. Active Status: Toggle to enable/disable the rule
  3. Hosts: Add one or more domains (e.g., api.example.com, localhost:3000)
    • Click "Current Host" to auto-add the current tab's domain
  4. Method: HTTP method to match (ANY, GET, POST, PUT, DELETE, PATCH, OPTIONS)
  5. Resource Type: Type of resource (xmlhttprequest, fetch, script, etc.)
  6. Route Match: Select Wildcard, Exact Match, or Regular Expression
  7. Route Pattern: The URL path pattern to match

Mock Response Configuration

When using the Mock Response action:

  1. Modify Response Body: If unchecked, the original response passes through (useful for latency only)
  2. Mocking Type: Choose Static JSON or Dynamic Rule
  3. Status Code: HTTP status code to return (200, 404, 500, etc.)
  4. Delay (ms): Simulate network latency
  5. Response Headers: Add custom headers to the response
  6. Response Body: The JSON content to return

Using the JSON Editor

For power users, the JSON Editor provides full control over rule configuration. Switch to the "JSON Source" tab in the rule editor to access it.

Benefits of JSON Editor

  • Copy/paste rules between environments
  • Bulk edit complex configurations
  • Access all schema options not exposed in GUI
  • Version control your rules

API Tester

The API Tester allows you to make HTTP requests directly from the extension, similar to Postman or Insomnia.

Key Features

  • Quick Actions: GET, POST, PUT, DELETE, etc.
  • cURL Import: Paste a cURL command to instantly populate the tester.
  • History: Access your recent request history (Limit: 20 for Guests).
  • Saved Requests: Save frequently used requests for quick access (Limit: 5 for Guests).

Usage

  1. Open the "Tester" tab.
  2. Enter the URL and select the method.
  3. Add Headers, Params, or Body as needed.
  4. Click "Send".
  5. View the Response (Status, Time, Size, Body, Headers).

Concurrency Tester

The Concurrency Tester allows you to load test API endpoints by sending multiple requests simultaneously.

Usage

  1. Open the "Concurrency" tab (or switch mode in Tester).
  2. Configure the request (URL, Method, Body).
  3. Set Concurrent Requests: Number of parallel requests to send (e.g., 10, 50).
  4. Click "Start Test".
  5. Analyze results:
    • Success/Fail Rates
    • Average Duration
    • Min/Max Duration
    • Detailed Logs

Environments

Environments allow you to manage sets of variables (e.g., {{api_url}}, {{token}}) that can be used across the extension.

Managing Environments

  1. Go to Settings > Environments.
  2. Create a new Environment (Guest Limit: 1).
  3. Add variables (Key-Value pairs).
  4. Select the active environment from the dropdown in the Tester or Rule Editor.

Using Variables

Use the double curly brace syntax {{variable_name}} in:

  • URLs
  • Headers (Key and Value)
  • Body (JSON/Text)

Example: URL: {{api_url}}/users Header: Authorization: Bearer {{auth_token}}


Rule JSON Schema Reference

Complete Rule Structure

{
  "id": "uuid-string",
  "dnrId": 1,
  "name": "My API Mock Rule",
  "active": true,
  "hosts": ["api.example.com", "localhost:3000"],
  "method": "GET",
  "resourceType": "xmlhttprequest",
  "routeType": "WILDCARD",
  "route": "/api/users/*",
  "actionType": "MOCK",
  "actionPayload": {
    // Payload varies by actionType
  }
}

Field Reference

FieldTypeRequiredDescription
idstring (UUID)YesUnique identifier (auto-generated)
dnrIdnumberNoInternal ID for browser's declarativeNetRequest API
namestringYesHuman-readable rule name
activebooleanYesWhether the rule is enabled
hostsstringYesArray of domains to match (min: 1)
methodenumYesANY, GET, POST, PUT, DELETE, PATCH, OPTIONS
resourceTypeenumYesxmlhttprequest, fetch, script, stylesheet, image, media, websocket, other
routeTypeenumYesWILDCARD, EXACT, REGEX
routestringYesURL path pattern to match
actionTypeenumYesMOCK, REDIRECT, MODIFY_HEADERS
actionPayloadobjectYesConfiguration specific to the action type

Mock Payload Schema

{
  "statusCode": 200,
  "delay": 0,
  "contentType": "application/json",
  "mockType": "STATIC",
  "modifyResponse": true,
  "body": "{ \"message\": \"Hello\" }",
  "responseHeaders": [
    {
      "id": "uuid",
      "key": "X-Custom-Header",
      "value": "custom-value",
      "enabled": true
    }
  ]
}
FieldTypeDefaultDescription
statusCodenumber200HTTP response status code
delaynumber0Response delay in milliseconds
contentTypestringapplication/jsonContent-Type header value
mockTypeenumSTATICSTATIC or DYNAMIC
modifyResponsebooleantrueIf false, passes through original response (only applies delay)
bodystring | array"{}"Static: JSON string. Dynamic: Array of rule items
responseHeadersarray[]Custom response headers

Redirect Payload Schema

{
  "destination": "https://new-api.example.com/endpoint",
  "isRegexSubstitution": false
}
FieldTypeDefaultDescription
destinationstring (URL)RequiredTarget URL to redirect to
isRegexSubstitutionbooleanfalseUse regex capture groups in destination

Static Mocking

Static mocking returns a fixed response for every matching request.

Example: Static Mock Rule

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Mock User Profile",
  "active": true,
  "hosts": ["api.myapp.com"],
  "method": "GET",
  "resourceType": "xmlhttprequest",
  "routeType": "WILDCARD",
  "route": "/api/users/*",
  "actionType": "MOCK",
  "actionPayload": {
    "statusCode": 200,
    "delay": 500,
    "contentType": "application/json",
    "mockType": "STATIC",
    "modifyResponse": true,
    "body": "{\"id\": 1, \"name\": \"John Doe\", \"email\": \"john@example.com\", \"role\": \"admin\"}",
    "responseHeaders": []
  }
}

Dynamic Response Modification

Dynamic mocking intercepts the real API response and modifies it based on conditions. This is powerful for testing edge cases without changing backend code.

Dynamic Rule Structure

When mockType is DYNAMIC, the body field contains an array of rule items:

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [
        // Conditions to check
      ],
      "modifications": [
        // Changes to apply if conditions match
      ]
    }
  ]
}

Condition Schema

Each condition checks a specific field in the response:

{
  "field": "path.to.field",
  "operator": "$eq",
  "value": "expected_value"
}

Available Operators

OperatorDescriptionExample Value
$eqEqual to"admin"
$neNot equal to"guest"
$gtGreater than100
$ltLess than50
$gteGreater than or equal18
$lteLess than or equal65
$containsArray contains value"premium"
$regexMatches regular expression"^user_.*"
$orLogical OR (uses children)See nested example
$andLogical AND (uses children)See nested example

Modification Schema

Each modification defines what to change:

{
  "field": "path.to.field",
  "action": "SET",
  "value": "new_value"
}

Modification Actions

ActionDescription
SETSet or update a field value
DELETERemove a field from the response

Field Path Notation

Access nested fields using dot notation:

  • name โ†’ { "name": "value" }
  • user.profile.email โ†’ { "user": { "profile": { "email": "value" } } }
  • items.0.id โ†’ First item in array (index-based access)

Examples

Example 1: Force Premium User

Override the user's subscription status to "premium":

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [],
      "modifications": [
        { "field": "subscription.plan", "action": "SET", "value": "premium" },
        {
          "field": "subscription.expiresAt",
          "action": "SET",
          "value": "2030-12-31"
        }
      ]
    }
  ]
}

Example 2: Conditional Modification

Only modify if the user is not already an admin:

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [{ "field": "user.role", "operator": "$ne", "value": "admin" }],
      "modifications": [
        { "field": "user.role", "action": "SET", "value": "admin" },
        {
          "field": "user.permissions",
          "action": "SET",
          "value": ["read", "write", "delete", "admin"]
        }
      ]
    }
  ]
}

Example 3: Multiple Conditions (AND)

Modify only if user is active AND has more than 100 points:

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [
        { "field": "user.status", "operator": "$eq", "value": "active" },
        { "field": "user.points", "operator": "$gt", "value": 100 }
      ],
      "modifications": [
        { "field": "user.badge", "action": "SET", "value": "gold" }
      ]
    }
  ]
}

Note: Multiple items in the query array are implicitly AND-ed together.

Example 4: OR Conditions

Modify if user is either "admin" OR "moderator":

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [
        {
          "operator": "$or",
          "children": [
            { "field": "role", "operator": "$eq", "value": "admin" },
            { "field": "role", "operator": "$eq", "value": "moderator" }
          ]
        }
      ],
      "modifications": [
        { "field": "canModerate", "action": "SET", "value": true }
      ]
    }
  ]
}

Example 5: Nested AND within OR

Complex condition: (status = "active" AND type = "premium") OR (isVIP = true)

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [
        {
          "operator": "$or",
          "children": [
            {
              "operator": "$and",
              "children": [
                { "field": "status", "operator": "$eq", "value": "active" },
                { "field": "type", "operator": "$eq", "value": "premium" }
              ]
            },
            { "field": "isVIP", "operator": "$eq", "value": true }
          ]
        }
      ],
      "modifications": [
        { "field": "accessLevel", "action": "SET", "value": "full" }
      ]
    }
  ]
}

Example 6: Delete Fields

Remove sensitive data from response:

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [],
      "modifications": [
        { "field": "user.password", "action": "DELETE" },
        { "field": "user.ssn", "action": "DELETE" },
        { "field": "user.creditCard", "action": "DELETE" }
      ]
    }
  ]
}

Example 7: Array Contains Check

Check if user has a specific role in their roles array:

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [
        {
          "field": "user.roles",
          "operator": "$contains",
          "value": "beta_tester"
        }
      ],
      "modifications": [
        { "field": "features.experimental", "action": "SET", "value": true }
      ]
    }
  ]
}

Example 8: Regex Matching

Check if email matches a pattern:

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [
        {
          "field": "user.email",
          "operator": "$regex",
          "value": "@company\\.com$"
        }
      ],
      "modifications": [
        { "field": "user.isEmployee", "action": "SET", "value": true }
      ]
    }
  ]
}

Example 9: Multiple Rule Items

Apply different modifications based on different conditions:

{
  "mockType": "DYNAMIC",
  "body": [
    {
      "query": [{ "field": "plan", "operator": "$eq", "value": "free" }],
      "modifications": [{ "field": "plan", "action": "SET", "value": "pro" }]
    },
    {
      "query": [{ "field": "trialDaysLeft", "operator": "$lte", "value": 0 }],
      "modifications": [
        { "field": "trialDaysLeft", "action": "SET", "value": 30 },
        { "field": "trialExpired", "action": "SET", "value": false }
      ]
    }
  ]
}

Example 10: Simulate Error Response

Force an error status with static mock:

{
  "actionType": "MOCK",
  "actionPayload": {
    "statusCode": 500,
    "delay": 0,
    "mockType": "STATIC",
    "modifyResponse": true,
    "body": "{\"error\": \"Internal Server Error\", \"message\": \"Database connection failed\"}"
  }
}

Example 11: Simulate Slow Response

Test loading states with delay only (no body modification):

{
  "actionType": "MOCK",
  "actionPayload": {
    "statusCode": 200,
    "delay": 5000,
    "mockType": "STATIC",
    "modifyResponse": false
  }
}

Example 12: Redirect to Local Development

Redirect production API calls to local server:

{
  "actionType": "REDIRECT",
  "actionPayload": {
    "destination": "http://localhost:3001/api/v1/users",
    "isRegexSubstitution": false
  }
}

Troubleshooting

Rule Not Matching

  1. Check hosts: Ensure the domain is in the hosts array
  2. Check route pattern: Test your pattern matches the URL
  3. Check method: Ensure the HTTP method matches
  4. Check resource type: For fetch/XHR requests, use xmlhttprequest or fetch

Dynamic Rules Not Working

  1. Verify JSON syntax: Ensure body is valid JSON array
  2. Check field paths: Use exact property names with dot notation
  3. Verify operator: Ensure the operator matches the value type

Extension Not Intercepting

  1. Global toggle: Ensure the global interceptor is enabled
  2. Rule active: Ensure the specific rule is active
  3. Refresh page: Some rules require a page refresh to take effect
  4. Check console: Look for "API Pilot" logs in browser console

Quick Reference Card

Operators

OperatorDescription
$eq, $neEqual / Not Equal
$gt, $ltGreater / Less Than
$gte, $lteGreater / Less Than or Equal
$containsArray contains value
$regexRegex match
$or, $andLogical operators (use children)

Modification Actions

ActionDescription
SETSet or update field value
DELETERemove field from response

Field Path Examples

PathDescription
user.name{ user: { name: "X" } }
items.0.idFirst item's id
data.results.countNested object access

API Pilot: Interceptor, Mocker & Tester - Your gateway to API testing excellence.