Mock API Responses — Custom Status Codes, Headers & Body
Turn any Requex endpoint into a programmable mock. Set the exact status code, headers, and JSON body your frontend needs — instantly, without writing a server.
Short answer: In Requex Settings → Response, set your status code (e.g. 201), add a Content-Type: application/json header, and paste your JSON body. Use {{body.field}} to echo back fields from the request. Your frontend calls the URL and gets exactly the response you configured.
Response Modes
| Mode | What you get |
|---|---|
normal | Returns exactly the status, headers, and body you configured. |
echo | Returns the request body as the response body (status and headers still from config). |
mirror | Returns the entire inbound request (method, headers, body, query) as a JSON object. |
empty | Returns the configured status with no response body. |
Template Variables
In normal mode, your response body can reference values from the inbound request using double-curly syntax:
| Variable | Resolves to |
|---|---|
| {{body.email}} | email field from the JSON request body |
| {{query.page}} | page query string parameter |
| {{headers.authorization}} | Authorization header value |
| {{method}} | HTTP method (GET, POST, etc.) |
Example — mock a user creation endpoint that echoes back the submitted email:
// Response config
Status: 201
Content-Type: application/json
{
"id": "usr_mock_001",
"email": "{{body.email}}",
"created": true
}Simulate Delays & Failures
Beyond static responses, Requex lets you simulate real-world network conditions:
- Fixed delayAdd a constant delay (e.g. 2000ms) to simulate a slow API.
- Random delaySet a min/max range — each request waits a random duration within it.
- Failure rateReturn a non-2xx status on X% of requests to test your retry logic.
- Max request sizeReject payloads over a byte limit to test your client's error handling.
Build your mock API in under a minute
No signup. No code. Configure response → share the URL with your team.
Open Requex →Related use cases
Start Testing Webhooks Now
Generate your unique URL and test webhooks instantly. Free, no signup.
Open Webhook Tester →