Mock API Error Generator
Generates a sample JSON error-response payload — code, message and status together — for testing how your client handles a failed API call, not just a successful one.
What it builds, and how many ways
Each result is assembled to this shape: [error code] + [error message] + [status] — one of 2 sentence patterns this generator uses.
- error code: 7 options
- error message: 7 options
- status: 7 options
Taken together those banks can be assembled 686 different ways, repeating after about 33.
Some results it can produce:
- { "error": { "code": "VALIDATION_FAILED", "message": "The request payload failed validation.", "status": 400 } }
- { "success": false, "error": "The resource already exists.", "code": "NOT_FOUND", "statusCode": 422 }
- { "error": { "code": "RATE_LIMITED", "message": "Authentication credentials were missing or invalid.", "status": 401 } }
- { "success": false, "error": "The requested resource could not be found.", "code": "RATE_LIMITED", "statusCode": 429 }
A fixed sample so this page stays the same between visits. Your own results are assembled at random, each slot filled independently and each press independent of the last, so the same result can come up twice — past the repeat figure above, seeing one twice is more likely than not.
How to use this tool
- Press generate for an error payload.
- Copy it, or generate again for another one.
Common use cases
- Testing error-handling UI
- Mock-server fixture data
- API-client error-path tests
Practical tips
- Test the error path your users will actually hit — a timeout and a 500 fail very differently in a client.
- Check your code distinguishes a 4xx from a 5xx. Retrying a 400 forever is a common and expensive bug.
Each part of the result is chosen independently with your browser's cryptographic random number generator, so every option in a bank is equally likely. How Generate Random works.
Related generators
- Mock API Response GeneratorA sample successful JSON API response, distinct from the site's error-shaped mock response tool.
- HTTP Status Code GeneratorA real HTTP status code with its standard meaning.
- API Failure Scenario GeneratorNine distinct ways an API call fails, each saying where in the request it broke, whether a retry is safe, and what the client should do.