APIMAN
APIMAN integrates OpenAPI documentation and schema-based request validation into Python web applications without requiring a framework rewrite.
Features
- Integrations for Starlette, Flask, Django, Bottle, Tornado, and Falcon
- OpenAPI 2.0, OpenAPI 3.0.x, and OpenAPI 3.1.x specification validation
- Built-in Swagger UI and ReDoc endpoints
- Specifications from docstrings, YAML strings, dictionaries, YAML files, or JSON files
- Validation for query, header, cookie, path, JSON, XML, and form request data
- Synchronous and asynchronous validation APIs
Installation
pip install -U apiman
Install the web framework you use separately, for example:
pip install starlette uvicorn
Quick start
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import JSONResponse
from apiman.starlette import Apiman
app = Starlette()
apiman = Apiman()
apiman.init_app(app)
@app.route("/hello", methods=["GET"])
async def hello(request: Request):
"""
summary: Say hello
parameters:
- name: name
in: query
required: true
schema:
type: string
responses:
"200":
description: Successful response
"""
apiman.validate_request(request)
return JSONResponse({"message": f"Hello, {request.query_params['name']}!"})
Run the application and open:
- Swagger UI:
http://localhost:8000/apiman/swagger/ - ReDoc:
http://localhost:8000/apiman/redoc/ - OpenAPI document:
http://localhost:8000/apiman/specification/
Documentation
The full guide covers framework setup, specification sources, reusable schemas, request validation, and project maintenance:
The documentation can also be built locally:
make docs
Development
APIMAN supports Python 3.9 through 3.12. This project uses uv and Ruff:
make install # create/sync .venv
make lint # Ruff + mypy
make test # lint + tests + coverage
make test-all # Python 3.9-3.12 via Nox
make docs # strict MkDocs build
make build # sdist and wheel
make format rewrites Python files and is intentionally separate from the read-only quality checks.
Compatibility Notes
APIMAN validates assembled specifications with bundled OpenAPI 2.0, 3.0.x, and 3.1.x schemas. Header parameter names are matched case-insensitively; query, cookie, and path parameter names remain case-sensitive.
Request validation supports JSON, XML, form, query, header, cookie, and path inputs. Repeated query and form values are accepted for array schemas. Repeated values for scalar schemas remain invalid.
Use apiman.reset() to clear collected route/schema caches and apiman.reload(...) to clear caches and collect routes again through the active framework adapter.
The built-in Swagger UI and ReDoc templates use pinned jsDelivr CDN versions, not @latest. Serving those endpoints requires browser access to jsDelivr unless you customize the templates to serve local assets.
License
APIMAN is licensed under the BSD 3-Clause License.
Metadata
Release files for apiman 0.5.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| apiman-0.5.5.tar.gz | 34.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apiman-0.5.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 68.7 kB
Release files / apiman-0.5.5.tar.gz
| Download URL | apiman-0.5.5.tar.gz |
|---|---|
| Size | 34.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df620db7ff73fc862bfcf2f67236dd46426a6536757b147a6679af459078f498
|
|
BLAKE2b-256 checksum How to use checksums |
ed4d321af0e01033023c16ae8759458653197b1eac542e39fa20b2c37c668d8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 15, 2026.
Transparency logRelease files / apiman-0.5.5-py3-none-any.whl
| Download URL | apiman-0.5.5-py3-none-any.whl |
|---|---|
| Size | 34.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f95f85bad296926ed5cd0c90042c3b0c03efd65b5dffae1e09895f0fca55f90d
|
|
BLAKE2b-256 checksum How to use checksums |
19821e68cca7fd2656612f766f37b3a04d2f69c4737e67cce8e756023a018762
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 15, 2026.
Transparency log