Mock Rules
Mock rules let a single endpoint return different responses depending on the incoming request. Rules are evaluated in order — the first match wins.
Creating a Rule
Section titled “Creating a Rule”From the endpoint detail page, click Add Rule. Each rule has:
- Conditions — what to match on (headers, query params, body)
- Response — the status code and body to return when conditions match
Condition Types
Section titled “Condition Types”| Type | Example | Matches when… |
|---|---|---|
| Header | Authorization: Bearer token123 | Request header matches the value |
| Query Parameter | status=active | Query string parameter matches |
| Body (JSON path) | $.user.role = "admin" | JSON body field matches |
Evaluation Order
Section titled “Evaluation Order”Rules are checked top-to-bottom. The first rule whose conditions all match is used. If no rules match, the endpoint’s default response is returned.
Example
Section titled “Example”An endpoint at GET /api/users with two rules:
- If query param
status=activethen return200with active users JSON - If query param
status=inactivethen return200with inactive users JSON - Default: return
200with all users JSON