OpenAPI
Load an OpenAPI document from a local file, public asset, or URL and generate an API reference.
Loading documentation…
Add an OpenAPI document to generate an API reference from its operations. The official starters already load the Heyo Docs integration; you only need to add the schema to the documentation configuration.
The interactive Try it panel sends a POST
request to /heyo-docs-internal/openapi-request. It will not work
until the host application provides that endpoint. The generated API reference
remains static and works without it.
Place the schema where its generated endpoint sections should appear in the
sidebar. It accepts JSON or YAML and needs a top-level paths object.
The schema object contains only schema. Heyo Docs replaces it with endpoint
sections grouped by OpenAPI tag. You can place regular MDX pages before or
after it for an overview, authentication, or migration guide.
| Source | Example | Use when |
|---|---|---|
| Local file | "./openapi.json" or "./openapi.yaml" | The schema lives under content/. |
| Public asset | "/openapi.json" | The file is served from the app's public/ directory. |
| URL | "https://api.example.com/openapi.json" | The schema is publicly available during the build. |
Remote schemas are fetched during development and each production build, so use a stable or pinned URL. Private URLs that require credentials are not supported; commit the schema or provide a public build artifact instead.
The endpoint forwards only operations and servers declared by the generated OpenAPI model. It is not an open proxy, but it still forwards a reader's bearer token and request values to the declared API server. Protect and monitor the API itself as usual; the proxy is not a substitute for authentication, authorization, rate limiting, or audit logging.
Add this entry to the existing route array:
Then create app/routes/openapi-request.ts:
Create src/lib/openapi-request.ts:
Then create src/pages/heyo-docs-internal/openapi-request.ts:
Create app/lib/openapi-request.ts:
Then create app/heyo-docs-internal/openapi-request/route.ts:
The Astro route must run in a server or hybrid deployment rather than a fully
static-only output. In a custom DocsApp shell, point the client at the same
route:
Each API operation becomes a static reference page. Tags organize the sidebar; the operation method, path, parameters, request body, responses, and local schemas are displayed automatically. A schema change requires a new build and deployment. The browser receives a compact endpoint index while route-specific details are emitted as static assets, so a large schema is not eagerly loaded for every page.
The normal documentation pages remain prerendered whether or not Try it is
enabled. If interactive requests are unnecessary, omit
openApiRequestUrl and the endpoint route without changing the generated API
reference.