Skip to content
Documentation

Nibleaf API and OpenAPI reference

Find the self-hosted server specification, understand browser-session authentication, and separate Nibleaf APIs from published customer API references.

  • 6 min read
  • Updated

The Nibleaf server exposes an OpenAPI-backed interactive reference at /docs on API port 4311. In the development stack, open http://localhost:4311/docs. In production, the API normally remains internal and the app proxies browser requests under /api so session cookies stay first party.

The running server specification is authoritative for its route paths, methods, schemas, and response codes. Do not build an integration from a screenshot or a specification generated by a different image tag.

For an already-running API on the local machine, download its machine-readable specification without exposing its port to the internet:

bash
curl -fsS http://127.0.0.1:4311/openapi.json -o nibleaf-openapi.json

Use /health to record the serving revision. The current source hard-codes OpenAPI info.version to 0.1.1; it is not a trustworthy release identifier. The app proxy covers /api, not the API server’s root /docs or /openapi.json. Use an operator tunnel for those internal paths.

Dashboard routes use the authenticated browser session and organization/project authorization. The app's same-origin /api proxy is part of that design. Do not publish port 4311 to the internet merely to make an internal integration easier.

Public site routes expose only reader-facing published content, search, metadata, and explicitly public workflows. They do not grant dashboard privileges. Operator and worker credentials are separate from reader and workspace access.

The authenticated HTTP MCP endpoint is a separate, explicit integration contract. It is disabled by default, accepts personal project-bound API keys or OAuth connections with mcp:connect and exact scopes, re-checks the person's current role on every request, and does not turn undocumented dashboard routes into a supported public write API. Its read adapters cover bounded content, search, usage, entitlement, add-on, theme, integration, and operational summaries. Its only writes are page drafts and a preview-then-confirm publish; reindex, usage export, deletion, provider credentials, and other mutations remain unavailable. See Connect MCP clients securely.

  • Use the OpenAPI document served by the target environment.
  • Test with a least-privilege non-production workspace.
  • Treat session cookies, bearer values, invitation tokens, and internal secrets as credentials; never embed them in documentation examples.
  • Handle documented error responses and rate limits rather than retrying every failure indefinitely.
  • Revalidate the specification and affected workflows before an upgrade.
  • For MCP, rotate project-bound keys rather than reusing a browser session or a legacy wildcard key.

Nibleaf is pre-1.0, so undocumented internal routes are not a compatibility contract. Propose stable integration needs through a public issue without including private environment details.

The Nibleaf platform API and a documentation project's own API reference are different products. To publish a project reference, open Settings → API Reference, choose its navigation label and path, then use one supported source:

  • upload or paste one JSON or YAML document up to 5 MB;
  • fetch a public HTTP(S) URL without embedded credentials; or
  • read a repository-relative file from a connected public GitHub or GitLab repository.

Nibleaf validates OpenAPI 3.x before saving. It resolves and bundles public external $ref files into the stored document. Relative references work for URL and repository sources; uploaded or pasted documents can reference absolute public HTTP(S) URLs. The combined document is limited to 5 MB and 20 external files. Every fetch is time- and size-bounded and rejects private-network destinations, credentials, unsafe redirects, and DNS rebinding.

Publish after saving or refreshing the specification. The validated document is frozen into that immutable deployment, so an older deployment or rollback retains its own specification revision.

The published reference uses Scalar. Try-it requests go directly from the reader's browser to the described API; Nibleaf does not proxy requests, inject credentials, persist authentication, or log request secrets. The API must allow the published documentation origin in its CORS policy. Test one harmless request with temporary credentials and clear them before sharing a browser or recording evidence.

These are Hono API paths, prefixed by /api/public/sites. :id identifies the site; reader authentication and publication scope still apply. Search, answers, and chat do not accept an organization or arbitrary page-grant scope from clients. New chat routes are current-source features; check the deployed image.

Method and suffixResponse and limits
GET /:idPublished site shell; optional lang and version.
GET /:id/pagePage content; path defaults to the root, with optional lang and version.
GET /:id/markdowntext/markdown; private or non-indexable content is not exposed through this public format.
GET /:id/searchResults; q up to 200 characters, optional limit 1–50, lang, version, sessionId and consentState.
POST /:id/answerChecked non-streaming answer; q 2–500 trimmed characters, optional lang and version.
POST /:id/chatAG-UI server-sent events; UUID conversationId, question 2–500 trimmed characters, optional bounded history and page context.
POST /:id/chat/eventsContent-free interactions; 1–20 events per request, 60 requests per IP per minute.
PUT /:id/chat/feedbackEditable rating; UUID conversation/turn IDs and the answer's signed token, rating up, down or null; optional comment up to 1000 characters. 30 requests per IP per minute.
POST /:id/eventsValidated public analytics events.
GET /:id/openapi.jsonThis site's published customer API document.
GET /:id/llms.txt, GET /:id/llms-full.txtPublished machine-readable documentation.
GET /:id/sitemap.xml, GET /:id/robots.txtPublished discovery files.
GET /:id/changelog, GET /:id/changelog/rss.xmlPublished release history and RSS.

Chat history accepts at most 12 user/assistant messages, each 1–4000 trimmed characters; server history settings can narrow it further. consent defaults to unknown. The server verifies whether not_required is allowed for the site. The shared public limiter defaults to 300 requests per IP per minute; low-cost sitemap/robots, domain resolution and metadata paths have a separate 10× budget. Answer and chat each also have their own 10/minute default. Daily quotas and token budgets are separate; see search and AI operations.

Normal JSON handlers return {data: ...}. Schema validation uses HTTP 422 with {error: {code, message, details}} and code=validation:failed. Chat errors after a stream starts arrive as stream events; inspect the checked final/error event rather than treating HTTP 200 as an answered question. MCP uses its own protocol envelopes.

PathMeaning
API GET /health on port 4311Core startup/drain status and serving revision; HTTP 200 only when ready. Includes independent analytics health.
Worker GET /health on port 4312Queue and required-email readiness, revision, and separate analytics health; degraded readiness is HTTP 503.
App GET /api/app/healthA revision probe returning ok: true; it is not the API's core readiness check.

Keep operator health checks internal. A healthy schema does not prove that analytics events arrive or email is delivered.

The CLI inspects and fetches public sites; it does not accept credentials, create drafts, publish, migrate, or back up a server. From an installed source checkout with Node.js 22.22.2 or newer and pnpm 10.34.9:

bash
node --import tsx packages/cli/src/cli.ts --help
node --import tsx packages/cli/src/cli.ts inspect https://docs.example.com --json
node --import tsx packages/cli/src/cli.ts fetch https://docs.example.com/getting-started

Replace the example origin and page path with your published site and a real public page. inspect checks the root, llms.txt, sitemap, OpenAPI, Markdown negotiation, Vary: Accept, and a missing-page response. It exits 0 on success, 1 on a failed check or fetch, and 2 on invalid command usage. fetch prints the Markdown response. Building the CLI produces packages/cli/dist/cli.mjs; use the source path above when it is not built. Do not assume the package is available from npm merely because a source package exists.

inspect currently requires all six checks to pass, including a successful OpenAPI document. A documentation-only site without an API reference therefore gets exit code 1 even if its reader works. Treat the named checks as separate evidence; it is not a general production-readiness verdict.

Was this page helpful?