Calculates on this device. File exports run online.
API Error Schema Generator
Write your API’s errors once, one a line, and get everything you need to document and test them: a JSON Schema, OpenAPI 3.1 responses, an example body for each error, TypeScript types and a Markdown table. You can also paste error bodies your API sends and see where they break the format. Everything is done in your browser.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to use it
- Write each error on its own line: status | code | title | detail, such as 404 | order-not-found | Order not found | No order has the number 12345.
- Choose the shape of the error body. RFC 9457 Problem Details is the IETF standard (it replaced RFC 7807).
- For Problem Details, give the address the problem types start with; each type is that address followed by the code.
- Press Make the schema. Copy or download the JSON Schema, the OpenAPI YAML, the examples, the TypeScript types or the Markdown table.
The four shapes
- RFC 9457 Problem Details (application/problem+json): type, status, title, detail, instance, and your own members. Validation problems get an errors list of detail and pointer.
- JSON:API errors: a document with an errors list; each error has status (as text), code, title, detail and source.pointer.
- Google API errors (AIP-193): error with code (the HTTP status), message, status (a canonical name such as NOT_FOUND) and details.
- Simple: error with code and message, for small APIs.
How the schema tells errors apart
- Each error is one branch of oneOf, with its type (or code) and status fixed, so a body with a known type but the wrong status fails.
- Every example body is checked against the schema before it is shown.
- The OpenAPI document has the schema under components.schemas and one response a status, with the examples of all errors of that status.
Checking error bodies
- Paste a body, or several as JSON Lines, and give the HTTP status of the response if you know it.
- You get each break of the shape (a missing member, a wrong type, a status in the body that differs from the response, a pointer that is not a JSON Pointer) and advice from the standard, such as using an absolute type URI.
- To check many or large files, use the box below: the server checks them with the Python jsonschema library.
Limits you should know
- The tool designs and checks the body of error responses; it does not call your API.
- Extra members are added as text; change their types in the schema if they hold numbers or objects.
- Google canonical names for a status follow the HTTP mapping of google/rpc/code.proto; when one status has several names (400 or 409), write the name you want as the code.
Privacy
Your errors and pasted bodies stay in your browser. Only when you use the box below are the files you choose and the schema shown above sent to the Toolvito server to check them. Download the result within one hour after the job finishes. Choose Delete files now to request earlier removal. The hourly cleanup normally removes files within one to two hours after completion.