DocsResponse modes
02 / 05

Response modes

Different ways mock APIs can respond to your requests.

Mock APIs support different response modes to simulate various real-world API behaviors:

Template mode

Returns static responses with dynamic variable substitution. Useful for simple endpoints.

json
// Template: { "id": "{{params.id}}", "timestamp": "{{timestamp}}" }
// Request: GET /users/123
// Response: { "id": "123", "timestamp": "2024-01-15T10:30:00Z" }

Fixture mode

Looks up and returns predefined data objects. Perfect for entity lookups like users, products, orders.

json
// Request: GET /users/USR-001
// Response: Returns the fixture with id "USR-001"
{
  "id": "USR-001",
  "name": "John Doe",
  "email": "john@example.com",
  "role": "admin"
}

Collection mode

Returns paginated lists with support for filtering, sorting, and cursor-based pagination.

json
// Request: GET /users?limit=2&cursor=abc
// Response:
{
  "data": [
    { "id": "USR-002", "name": "Jane Doe" },
    { "id": "USR-003", "name": "Bob Smith" }
  ],
  "pagination": {
    "next_cursor": "def",
    "has_more": true
  }
}

Conditional mode

Evaluates rules to determine the response based on request properties. Useful for testing error handling.

json
// Rule: If status query param is "active", return active users only
// Request: GET /users?status=active
// Response: Only returns users with status "active"