API Error Response Generator

Pick a status code and error format (RFC 7807, JSON:API, generic) — generate a valid error payload, headers, and curl example. Includes a scenario-set for the full 4xx/5xx family.

Runs 100% client-side
Copy output
On this page5 sections

Semantically invalid — e.g. validation failure

Content-Type: application/problem+json

HOW TO USE

  1. 01Pick the HTTP status code and the error format (RFC 7807 Problem Details, JSON:API, or generic).
  2. 02Add the error detail/message and the endpoint path.
  3. 03Copy JSON for a single fixture, or Copy scenario set for the full 4xx/5xx family.

Try it

Status 422, RFC 7807, detail 'email field is required' → Copy JSON

WHEN TO USE

Use when writing tests that assert on API error responses — generate a valid error payload in the format your API uses (RFC 7807 Problem Details, JSON:API errors, or generic) so you have a concrete fixture to assert against. Also useful when designing API error contracts: generate the full 4xx/5xx family for a given endpoint and review it with the team before implementation.

WHAT BUGS THIS FINDS

  • Inconsistent error formats across endpoints

    Some endpoints return {error: string}, others return RFC 7807 — clients break when the parser encounters an unexpected shape.

  • Missing required Problem Details fields

    RFC 7807 requires 'type', 'title', and 'status' — omitting them causes schema validation failures in strict API clients.

  • Raw stack traces in error responses

    Error bodies that expose internal paths, class names, or stack traces leak implementation details to attackers.

QA USE CASES

01

Generate a 422 Unprocessable Entity fixture

Pick RFC 7807 + status 422 → get a Problem Details object to use as the expected response body in your test assertion.

02

Design error contract before implementation

Generate the full error scenario set (400/401/403/404/422/500) for an endpoint and share with the backend team as the agreed format.

03

Test error format consistency

Verify all your API endpoints return the same error shape by comparing real responses against the generator's canonical format.

04

Generate curl examples for bug reports

Include the generated curl -i command in a defect report to let the backend developer reproduce the expected vs actual error response.