Skip to main content

rapidoc (Python)

Serves a RapiDoc API reference from a FastAPI or Starlette app: an interactive page for your OpenAPI document, with a console to try requests.

pip install rapidoc
from fastapi import FastAPI
from rapidoc.fastapi import setup_rapidoc

app = FastAPI(docs_url=None, redoc_url=None)

setup_rapidoc(app)

Open /docs. The page reads the app's own /openapi.json, and nothing is loaded from another site: the package carries the RapiDoc bundle.

FastAPI serves Swagger UI at /docs unless you create the app with docs_url=None. To keep Swagger UI, give RapiDoc another path: setup_rapidoc(app, ui_path="/reference").

Options

Option Default
ui_path /docs URL path the reference page is served at, within the app. path is its old name, still read
spec_url the app's openapi_url URL of the OpenAPI document, which the browser fetches when the page opens. A path starting with / is a path of the app
spec The OpenAPI document itself (a dict or JSON text), written into the page so the browser makes no request for it. With both, spec is shown and spec_url is the download link
title the app's title + "API Reference" Page title
assets "bundled" "bundled": the app serves rapidoc-min.js. "cdn": the browser loads the same version from jsDelivr, checked against its SRI hash. {"script_url": ..., "integrity": ...}: a URL of your own
options Attributes of <rapi-doc>: {"render_style": "focused", "allow_try": False}. Names can be written with underscores, hyphens or in camelCase
head, css Markup and CSS added to the page as given
lang en Language of the page
nonce Content-Security-Policy nonce, or a function that takes the request and returns it
enabled True False adds nothing, for example outside development

These are the options of every RapiDoc integration, in Python naming.

Behind a proxy

When a proxy strips a path prefix, run the app with that prefix as its root_path (uvicorn app:app --root-path /api, or FastAPI(root_path="/api")). The page then uses the prefix for the bundle, the OpenAPI document and the OAuth return page, as FastAPI's own docs do.

Starlette

from rapidoc.starlette import setup_rapidoc is the same function, for any Starlette app. Starlette has no OpenAPI endpoint of its own, so pass spec_url or spec.

Notes

  • Each release ships one version of rapidoc: rapidoc.rapidoc_version().

  • The routes are left out of the app's OpenAPI document.

  • OAuth sign-in returns to {ui_path}/oauth-receiver.html, which the app serves on its own origin, also with assets="cdn".

  • examples/app.py is a complete app.

  • The package itself requires no framework; rapidoc.fastapi uses the Starlette that FastAPI installs. rapidoc.contract is the RapiDoc integration contract in plain Python, for building an integration for another framework.

Python 3.10 or later; Starlette 0.27 or later. MIT.

Upgrading to 0.2.1

0.2.1 ships rapidoc 14. Nothing changes in the options or in what the page shows: rapidoc 14 has no attribute changes (v13 to v14).

Upgrading to 0.2.0

0.2.0 ships rapidoc 13, which changed one set of attributes: filter-operations replaces match-paths, match-type and remove-endpoints-with-badge-label-as, and rapidoc 13 ignores those three. If your options set any of them, set filter_operations instead. Matching is exact, so a v12 match-paths prefix becomes a glob: {"filter_operations": "/pets/**"}. The v12 to v13 migration guide has the other terms (tag:, badge:, deprecated, ! to leave out).

Releasing (for maintainers)

Releases go to PyPI from GitHub Actions, through a trusted publisher. There is no token and nothing to upload by hand.

  1. Set the version. Raise version in pyproject.toml. PyPI refuses a version number that already exists.

  2. Choose the bundle. To ship a newer RapiDoc, put its npm version in RAPIDOC_VERSION. The wheel carries exactly that release of rapidoc-min.js. Leave the file alone for a release that only changes the Python code.

  3. Check locally (optional; the workflow runs the same steps):

    python scripts/sync_assets.py --npm
    python -m pytest
    
  4. Merge to master. The "Python package" workflow runs the tests on the oldest and newest supported Python.

  5. Publish. On GitHub, open Actions, choose Python package, click Run workflow, tick Publish the version in pyproject.toml to PyPI, and run it on master. It tests, builds, checks that the wheel contains the bundle, and uploads.

  6. Verify. pip install rapidoc==<version> in a clean environment, and check https://pypi.org/project/rapidoc/.

Which number to raise: a fix or a newer bundle is a patch (0.1.1); a new option or a new framework module is a minor (0.2.0). While the version is 0.x, a change that breaks existing code is also a minor, and is called out in the release notes.

The trusted publisher on PyPI is tied to the workflow file .github/workflows/publish-python.yml and the GitHub environment pypi. Renaming either stops publishing until the publisher is updated under the project's Publishing settings on PyPI.

Metadata

Release files for rapidoc 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rapidoc 0.2.1
File Size Uploaded Provenance Actions
rapidoc-0.2.1.tar.gz 194.2 kB With provenance Details for rapidoc-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rapidoc 0.2.1
File Interpreter ABI Platform Actions
rapidoc-0.2.1-py3-none-any.whl Python 3 none any Details for rapidoc-0.2.1-py3-none-any.whl

Total release size: 388.1 kB

Release files / rapidoc-0.2.1.tar.gz

Download URL rapidoc-0.2.1.tar.gz
Size 194.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7c689b64a28db3602c5b49d57b0b36b9cf8684c4a68b1a02dace1d5f5f5e35b0
BLAKE2b-256 checksum
How to use checksums
dbcfb42b47af88acd01602e44c120eb2c95c78017eeb428500433c86b91d4921
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / rapidoc-0.2.1-py3-none-any.whl

Download URL rapidoc-0.2.1-py3-none-any.whl
Size 193.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45202cfd3a9de6aec57fde0273c00f60ecf549f78117ca79ffe0b1c8d1b7929a
BLAKE2b-256 checksum
How to use checksums
76ba217eb7cad601764c6596b7f33ac54bbd6b1799a3ccb8249d77d505687766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for rapidoc 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rapidoc-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page