Status Codes
Status Codes renders a table of the HTTP status codes an endpoint (or a whole API) can return, each with its meaning, a description of when it happens, and an optional example response body. It’s a good fit for a shared reference table, rather than repeating the same error codes under every endpoint.
Adding the block#
- In the block editor, open the block inserter and search for Status Codes.
- Add it to the page, either under a single Endpoint or on its own reference page.
- Give the table a title, e.g.
HTTP Status Codes. - Click + Add status code for each code you want to document.
Settings#
| Setting | What it does |
|---|---|
| Table title | Heading shown above the table, e.g. HTTP Status Codes. |
Per row:
| Setting | What it does |
|---|---|
| Status code | e.g. 200, 404, 500. |
| Meaning | The status text, e.g. Not Found. |
| Description | When and why this code is returned. |
| Example response body (optional) | A sample response for this status code. |
Example#
One row: Status code 404, Meaning Not Found, Description No resource exists at this path.
| Code | Meaning | Description |
|---|---|---|
| 200 | OK | The request succeeded. |
| 400 | Bad Request | The request was malformed. |
| 401 | Unauthorized | Missing or invalid credentials. |
The block#
In the editor, this is one status-code row filled in as above, no shortcode needed.
The shortcode#
The same block, added as a shortcode instead, for a widget, classic-editor content, or a page builder that only accepts shortcodes. Since statuses is a JSON array, it can never go in a quoted attribute (a JSON array always contains a ], and the shortcode parser stops at the first literal ] it finds, quoted or not). It goes between the opening and closing tags instead:
[nahnu_code_block block="status-codes" title="HTTP Status Codes"]
[{"code":"404","meaning":"Not Found","description":"No resource exists at this path."}]
[/nahnu_code_block]
Putting the JSON between the tags, rather than in a quoted attribute, is what keeps the shortcode from cutting off partway through.
How it renders#
A table titled “HTTP Status Codes” with one row: 404, Not Found, and the description text.
Tips#
- Build one shared Status Codes table for the whole API when the codes are consistent across endpoints, and link or repeat it where needed instead of retyping it.
- Cover the common error codes (
400,401,403,404,429,500) even if your API rarely returns them. Readers check this table when something has already gone wrong. - Keep the description specific to your API. “Not Found” is the status text; the description should say what “not found” means for that endpoint.