Docs

Auth

2 min readUpdated September 19, 2026

Auth shows a single authentication header example for one of four common schemes: bearer token, API key header, basic auth, or OAuth 2.0. It’s usually placed near the top of a reference page, alongside Servers, so a reader knows how to authenticate before they get to individual endpoints.

Adding the block#

  1. In the block editor, open the block inserter and search for Auth.
  2. Add it to the page, usually near the top of an API reference page, alongside Servers.
  3. Pick a scheme and fill in the placeholder value and description.

Settings#

SettingWhat it does
SchemeBearer token, API key header, Basic auth, or OAuth 2.0. Determines the header line shown.
Header nameOnly shown for API key header. The header to send the key in, e.g. X-API-Key. Defaults to X-API-Key if left blank.
Placeholder valueThe example value shown in the header, e.g. YOUR_API_KEY.
DescriptionExplanation shown below the header example.

The header line itself is generated from these settings, not typed directly: bearer token and OAuth 2.0 both render as Authorization: Bearer <placeholder>, API key header renders as <header name>: <placeholder>, and basic auth renders as Authorization: Basic <placeholder>.

Example#

Scheme set to Bearer token, Placeholder value set to YOUR_API_KEY, with a short description.

Authorization: Bearer YOUR_API_KEY

Send your API key as a bearer token on every request.

The block#

In the editor, this is the Auth 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. Every setting here is a plain value, not a JSON array, so it can go in a quoted attribute as usual:

[nahnu_code_block block="auth" scheme="bearer" placeholder="YOUR_API_KEY" description="Send your API key as a bearer token on every request."]

The block attribute picks which block to render (auth here); everything else maps to that block’s own setting by name.

How it renders#

The header line Authorization: Bearer YOUR_API_KEY, with the description shown underneath.

Tips#

  • Use a placeholder value that’s obviously fake, like YOUR_API_KEY, never a real key or token.
  • If your API supports more than one scheme, add a separate Auth block for each rather than trying to describe both in one description.
  • Place this block, along with Servers, before the first Endpoint on the page, so both are established before a reader hits any request examples.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only