Skip to main content

Mock Responses

Learn how to create intelligent mock responses that automatically respond to webhook requests with customizable status codes, bodies, and AI-generated content.

Mock panel

drawing

The sidebar provides a clear and organized list of all the configured mocks, allowing you to navigate through them effortlessly.

You can click on any mock in the sidebar to instantly load its configuration.
You can also collapse the panel if needed.

Overview

Mock responses allow you to configure automatic responses to incoming webhook requests. This is perfect for:

  • Frontend development - Mock backend APIs without running a server
  • Testing webhook consumers - Simulate various response scenarios
  • Integration testing - Test error handling and edge cases
  • API prototyping - Quickly prototype API behavior

Key Features

  • Pattern-based matching - Use wildcards to match multiple paths
  • Method filtering - Different responses for different HTTP methods
  • Custom status codes - Simulate success, errors, and edge cases
  • Custom headers - Add any response headers
  • AI-powered responses - Generate dynamic responses based on request data
  • Multiple mocks per bin - Create complex routing scenarios

Creating Mock Responses

Configuration

Click the mock icon in the bin header:

No Active Mock

Two Active Mocks

Mock Response Creation

Configuration Fields

1. Path Pattern

Define which URLs this mock should match

Supported Patterns:

Exact Match

/api/users

Matches: /api/users only

Wildcard at End

/api/users/*

Matches:

  • /api/users/123
  • /api/users/456/profile
  • /api/users/any/nested/path

Wildcard in Middle

/api/*/users

Matches:

  • /api/v1/users
  • /api/v2/users
  • /api/public/users

Multiple Wildcards

/api/*/users/*

Matches:

  • /api/v1/users/123
  • /api/v2/users/456/profile

Root Wildcard

/*

Matches: Any path

Examples

// Match all webhook paths
path: "/webhooks/*"

// Match versioned API
path: "/api/v*/users"

// Match any path
path: "/*"

// Match specific endpoint
path: "/api/payments/callback"

2. HTTP Methods

Select which HTTP methods trigger this mock:

Available Methods:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE
  • OPTIONS
  • HEAD

Multiple Selection:

  • Select multiple methods for the same mock
  • Create method-specific responses by duplicating mocks with different methods

Examples:

// RESTful resource
methods: ["GET", "POST", "PUT", "DELETE"]

// Read-only endpoint
methods: ["GET", "HEAD"]

// Write operations only
methods: ["POST", "PUT", "PATCH"]

// Webhook endpoint
methods: ["POST"]

3. Status Code

HTTP status code for the response:

Common Status Codes:

CodeMeaningUse Case
200OKSuccessful GET, PUT, PATCH
201CreatedSuccessful POST creating resource
202AcceptedAsync processing accepted
204No ContentSuccessful DELETE
400Bad RequestInvalid input testing
401UnauthorizedAuth testing
403ForbiddenPermission testing
404Not FoundMissing resource testing
422Unprocessable EntityValidation error testing
500Internal Server ErrorServer error testing
503Service UnavailableDowntime testing

Examples:

// Success scenarios
statusCode: 200 // OK
statusCode: 201 // Created
statusCode: 204 // No Content

// Client error scenarios
statusCode: 400 // Bad Request
statusCode: 404 // Not Found
statusCode: 422 // Validation Error

// Server error scenarios
statusCode: 500 // Internal Server Error
statusCode: 503 // Service Unavailable

4. Response Body

Optional response body content:

Supported Formats:

JSON

{
"success": true,
"message": "User created successfully",
"user": {
"id": 123,
"email": "user@example.com",
"createdAt": "2025-01-15T10:30:00Z"
}
}

XML

<?xml version="1.0" encoding="UTF-8"?>
<response>
<success>true</success>
<message>User created successfully</message>
<user>
<id>123</id>
<email>user@example.com</email>
</user>
</response>

Plain Text

Success: User created
ID: 123

Empty Body

Leave blank for no response body (useful for 204 No Content)

5. Response Headers

Optional custom response headers:

Format: One header per line, Key: Value

Examples:

Content-Type: application/json
X-Custom-Header: custom-value
Cache-Control: no-cache
X-Request-ID: abc-123

Common Headers:

Content-Type: application/json
Content-Type: application/xml
Content-Type: text/plain
Content-Type: text/html
Content-Type: application/pdf

Cache-Control: no-cache
Cache-Control: max-age=3600

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers: Content-Type, Authorization

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1642243200

6. AI-Powered Responses

Enable AI to generate dynamic responses based on incoming request data:

AI Prompt:

When AI is enabled, provide a prompt that describes how to generate the response:

Example Prompts:

"Analyze the incoming webhook data and respond with a JSON object containing:
- A confirmation message
- The received HTTP method
- The current timestamp
- An echo of any user data sent
Make the response friendly and professional."
"Generate a realistic API response for a user creation webhook. Include:
- A generated user ID (random number)
- The email from the request body
- A success message
- A timestamp
Format as JSON."
"Use the incoming webhook data and return response based on example response."
Mock ExampleResponse
JSON MockRequest Inspector

Changing the Content-Type header:

Mock ExampleResponse
JSON MockRequest Inspector

AI Context:

The AI receives:

  • Request method
  • Request path
  • Request headers
  • Request query parameters
  • Request body
  • Response body example
  • Response body headers
  • Your prompt

Benefits:

  • Dynamic responses based on input
  • Realistic test data
  • Context-aware responses
  • Complex business logic simulation