What does a good API error response look like?
A good API error uses the right status code and a consistent, machine-readable body. RFC 9457 (Problem Details) standardises that body: a type URI, a short title, the status, a human-readable detail and an instance identifier, in application/problem+json. It tells the caller what went wrong and how to fix it without exposing stack traces, SQL or internal paths.
How to use Mock Error Payload Generator
- List the form or API field names.
- Choose the convention, number of payloads and subset mode.
- Generate and feed the payloads to your form error rendering tests.
Mock Error Payload Generator features
- Field-level error payloads in Laravel, Django REST, ASP.NET, JSON:API, Google, AWS, Stripe, RFC 9457, JSend, simple and GraphQL conventions
- Bulk generation: all fields, one field at a time or random subsets
- Codes and messages inferred from field names
- Field error catalogue table for quick review
- Seedable for stable snapshot tests
Mock Error Payload Generator example
Django REST payloads, one field at a time
Input:
Fields: email, password
Convention: Django REST, mode: one field at a timeOutput:
[
{ "case": 1, "invalidFields": ["email"], "status": 422, "body": { "email": ["Email must be a valid email address."] } },
{ "case": 2, "invalidFields": ["password"], "status": 422, "body": { "password": ["Password must be at least 10 characters."] } }
]Frequently asked questions about Mock Error Payload Generator
What is a field-level error payload?
The response a form receives when several inputs fail validation: a map of field names to messages (Laravel, Django REST), an errors dictionary with a traceId (ASP.NET), pointer-based errors (JSON:API), fieldViolations (Google) and more.
What does bulk mode do?
It produces many payloads at once — every field invalid, one field at a time, or random subsets — so you can snapshot-test how your UI renders each combination.
Are codes and messages realistic?
They are inferred from the field names (email → invalid_format, password → too_short, terms → must_be_true, userId → not_found) with neutral, human-readable messages you can adapt.
References
- RFC 9457: Problem Details for HTTP APIsThe application/problem+json error format (type, title, status, detail, instance) for machine-readable API errors.
- OWASP Cheat Sheet Series: Error HandlingError responses that help the caller without leaking stack traces, versions or internal paths.
- RFC 9110: HTTP SemanticsThe meaning of HTTP methods, header fields, status codes and content negotiation, independent of the wire version.