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.
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.
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
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
Three steps, then it stays in sync
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.
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.
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.
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.
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.
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.
$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.