Beta

Turn an OpenAPI spec into a full set of drafts

Nahnu Code and API Block renders the blocks. Paired with WP Super Docs, it can also fill them in for you: attach a spec to a category and get one draft doc per endpoint, generated automatically.

Built and maintained together with WP Super Docs
openapi.yaml attached to a category
syncs to
WP Super Docs resolves references and callbacks
renders with
Nahnu blocks, one draft per endpoint
Endpoint
Parameters
Response Body
Status Codes
Auth
Servers
Two ways in

Automatic sync, or build your own integration

Most sites use WP Super Docs. If you are building a docs platform of your own, Nahnu's block API is open to call directly.

Recommended, beta

Use WP Super Docs

Point it at your spec's URL and let it keep your docs in sync as the spec changes. No code required.

  • One draft per operation, generated on sync
  • Your own edits are never overwritten
  • OpenAPI 3.x, JSON or YAML
Get WP Super Docs
For developers

Call the block API yourself

Building your own importer or docs platform? Generate correctly formed Nahnu blocks from your own PHP, with no dependency on WP Super Docs.

  • nahnu_code_block_build_block_markup()
  • Outputs real block markup via serialize_block()
  • Unspecified attributes fall back to block defaults
Read the integration guide
How it works

Three steps, then it stays in sync

01

Turn it on

In WP Super Docs, go to Settings, then Integrations, then OpenAPI, and enable it. If Nahnu is not active yet, you will see a direct link to install it. Syncing will not run until it is.

Settings / Integrations / OpenAPI
OpenAPI sync (beta)
Nahnu Code BlockActive
02

Attach a spec to a category

Open a Doc Category and paste your spec's URL into the OpenAPI spec URL field. JSON is tried first. YAML works too, with or without the PHP yaml extension.

Category: Billing API
OpenAPI spec URL
https://api.example.com/openapi.yaml
03

Sync

Click Sync now on that category, or Sync all categories from the integrations screen to refresh every spec at once. Results show inline as it runs.

Sync results
14 endpoints synced
3 drafts created, 11 updated
1 external reference skipped
Per endpoint

Only the blocks each operation actually needs

Every value comes straight from your spec, nothing is invented. An endpoint with no parameters simply does not get a Parameters block.

  • Endpoint, method, path, summary, deprecation notice if marked
  • Servers, if the spec defines base URLs
  • Auth, the scheme for that operation, if it requires one
  • Parameters, path, query, header, and request body
  • Response Body and Status Codes, from the spec's responses
  • A cURL example, ready to paste

Shared components resolve automatically with their real fields. References to an external file are logged and skipped rather than followed, since that would mean an outbound request per reference. Callbacks generate the same block types as their parent endpoint.

Generated draft: POST /v1/invoices
POST/v1/invoicesDraft
Auth block, bearer token Parameters block, 4 fields Response Body block, 200 and 402 Status Codes block, 4 codes Request/Response block, cURL example
Built to be re-run

Syncing again never throws away your work

Your edits are safe

Only the generated block group is replaced on re-sync. An intro paragraph, a note, extra examples: anything you added before, after, or in between is left exactly as you left it.

Removed endpoints go to Trash

If an operation drops out of your spec, its doc is trashed, not deleted. Restore it in a click if that was a mistake or the spec change gets reverted.

Drafts, always

Generated docs land as drafts. Nothing goes live until you review and publish it yourself, whether it is the first sync or the hundredth.

API reference

Generate blocks from your own PHP

Not using WP Super Docs? nahnu_code_block_build_block_markup() is the same function it calls. Build your own importer against it and land results as drafts for review.

Full API reference
your-importer.php
$blocks = Nahnu_Code_Block::instance();

$content  = $blocks->nahnu_code_block_build_block_markup( 'endpoint', [
    'method'  => 'POST',
    'path'    => '/v1/customers',
    'summary' => 'Create a customer.',
] );

$content .= $blocks->nahnu_code_block_build_block_markup( 'parameters', [
    'parameters' => [
        [ 'name' => 'email', 'type' => 'string', 'required' => true ],
    ],
] );

wp_insert_post( [
    'post_type'   => 'your_docs_post_type',
    'post_status' => 'draft', // review before it goes live
    'post_content' => $content,
] );

Ready to sync your first spec?

Nahnu Code and API Block is free either way, with or without WP Super Docs.

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