Endpoint
Endpoint documents a single API route: its method, path, a short summary, and optional details like a version badge, auth requirement, or deprecation notice. It is the block most other API blocks (Parameters, Request/Response, Response Body) are meant to sit under on the page.
Adding the block#
- In the block editor, open the block inserter and search for Endpoint.
- Add it to the page.
- Fill in the method and path in the block settings, then add a summary.
- Add any Parameters, Request/Response, or Response Body blocks underneath it to document the rest of the route.
Settings#
| Setting | What it does |
|---|---|
| Method | GET, POST, PUT, PATCH, or DELETE. Shown as a colored badge. |
| Path | The route itself, e.g. /customers/{id}. |
| Summary | A short, one-line description shown under the method and path. |
| Description (optional) | A longer explanation, shown below the summary. |
| Version badge (optional) | A small label such as v2, shown next to the path. |
| Operation ID (optional) | Used as this endpoint’s deep-link anchor instead of the method and path, so links to it keep working even if the path is later renamed. |
| Mark as deprecated | Adds a deprecated notice to the block. Reveals a Deprecation note field to explain why or what to use instead. |
| Requires authentication | Adds an auth-required badge next to the path. |
| Related Endpoints | An optional list of other Endpoint blocks on the same page to link to, each with its own method, path, and optional label, e.g. for a “see also” list. |
Example#
An endpoint for creating a customer: Method set to POST, Path set to /customers, Summary set to Create a new customer, and Requires authentication on.
Create a new customer
The block#
In the editor, this is just the Endpoint block’s settings panel filled in as above, no code required.
The shortcode#
The same block, added as a shortcode instead, for a widget, classic-editor content, or a page builder that only accepts shortcodes:
[nahnu_code_block block="endpoint" method="POST" path="/customers" summary="Create a new customer" authRequired="true"]
The block attribute picks which block to render (endpoint here); every other attribute maps to that block’s own setting by name.
How it renders#
A POST badge, the path /customers, a lock icon with “Auth Required” next to it, and the summary line underneath.
Tips#
- Set an Operation ID if you plan to link to this endpoint from elsewhere. It keeps the anchor stable even if you later rename the path.
- Stack a Parameters, Request/Response, and Response Body block directly under an Endpoint block to build out a full route reference.
- Use Related Endpoints to cross-link a handful of endpoints readers commonly move between, like a create/read/update/delete set for the same resource.