Skip to main content

Routes & Responses

Routes define the endpoints your mock simulation responds to. Each route can have multiple responses with configurable selection logic.

Creating a Route​

  1. Open a simulation and click Add Route
  2. Configure the route:
    • Method - GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
    • Path - URL pattern (e.g., /users/:id)
    • Description (optional) - What this endpoint does
  3. Add at least one response
  4. Click Save

Path Patterns​

PatternExampleMatches
Static/usersExact path only
Parameter/users/:id/users/123, /users/abc
Wildcard/files/*/files/a/b/c.txt
Mixed/orgs/:orgId/users/:userId/orgs/1/users/2

Configuring Responses​

Each response includes:

Status Code​

Any valid HTTP status code (200, 201, 400, 404, 500, etc.).

Headers​

Custom response headers as key-value pairs. Common examples:

  • Content-Type: application/json
  • X-Request-Id: {{$randomUUID}}
  • Cache-Control: no-cache

Body​

The response payload. Supports:

  • JSON - Structured data (most common)
  • XML - SOAP or XML-based APIs
  • HTML - Web page responses
  • Plain text - Simple string responses
  • Binary - File downloads

Dynamic Values​

Use template variables in response bodies and headers:

VariableDescriptionExample Output
{{$randomUUID}}Random UUID v4a1b2c3d4-...
{{$timestamp}}Current Unix timestamp1707849600
{{$isoTimestamp}}ISO 8601 datetime2026-02-15T...
{{$randomInt}}Random integer 0-1000427
{{request.path.id}}Path parameter value123
{{request.query.page}}Query parameter value2
{{request.body.name}}Request body fieldAlice

Response Delay​

Add simulated latency (in milliseconds) to test timeout handling and loading states.

Response Selection Logic​

When a route has multiple responses, selection is controlled by:

Rules-Based Selection​

Match on request properties:

IF header "Authorization" is missing  -> Return 401
IF query "page" > 10 -> Return 404
IF body "amount" > 10000 -> Return 400
DEFAULT -> Return 200

Sequential Mode​

Responses are returned in order, cycling back to the first after the last. Useful for testing retry logic.

Weighted Random​

Assign weights to responses for probabilistic selection:

  • 200 OK (weight: 80)
  • 500 Error (weight: 15)
  • 408 Timeout (weight: 5)

Bulk Operations​

  • Import routes from OpenAPI, Postman, HAR, or cURL
  • Export routes as OpenAPI spec or Postman collection
  • Duplicate a route within the same simulation
  • Move routes between simulations

Next Steps​

  • Environments - Save and share route configurations
  • I Features - Auto-generate responses with AI
  • roxy & Record/Replay - Capture real traffic as routes