Openapi-core is a Python library that adds client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 and OpenAPI v3.2 specification.
Python
369
1,800 commits
updated Aug 27, 2026
Openapi-core is a Python library that provides client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 and OpenAPI v3.2 specifications.
Check documentation to see more details about the features. All documentation is in the "docs" directory and online at openapi-core.readthedocs.io
Supported Integrations and it's versions:
| Integration | Version(s) | Level |
|---|---|---|
| AIOHTTP | versions 3.8+ and 3.11+ tracks | Low-level request and response classes |
| Django | versions 4, 5, and 6 | Middleware, decorator and low level |
| Falcon | version 4 | Middleware and low-level classes |
| FastAPI | versions 0.11x, 0.12x, and 0.13x | Middleware (low-level via Starlette integration) |
| Flask | versions 2 and 3 | View decorator, class-based view, and low-level classes |
| Requests | default dependency set | Low-level request, webhook request, and response classes |
| Starlette | versions 0.4x, 0.5x, and 1.x | Middleware and low-level classes |
| Werkzeug | default dependency set | Low-level request and response classes |
Recommended way (via pip):
pip install openapi-core
Alternatively you can download the code and install from the repository:
pip install -e git+https://github.com/python-openapi/openapi-core.git#egg=openapi_core
First, create your OpenAPI object.
from openapi_core import OpenAPI
openapi = OpenAPI.from_file_path('openapi.json')
Now you can use it to validate and unmarshal against requests and/or responses.
# raises an error if the request is invalid
result = openapi.unmarshal_request(request)
Retrieve validated and unmarshalled request data.
# get parameters
path_params = result.parameters.path
query_params = result.parameters.query
cookies_params = result.parameters.cookies
headers_params = result.parameters.headers
# get body
body = result.body
# get security data
security = result.security
The request object should implement the OpenAPI Request protocol. Check Integrations to find officially supported implementations.
For more details read about the Unmarshalling process.
If you just want to validate your request/response data without unmarshalling, read about Validation instead.
The project is under the terms of the BSD 3-Clause License.
179 followers · starred Dec 2021
1,154 followers · starred Mar 2023
159 followers · starred Apr 2020
470 followers · starred Feb 2022
Openapi-core is a Python library that adds client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 and OpenAPI v3.2 specification.
Python
369
1,800 commits
updated Aug 27, 2026
Openapi-core is a Python library that provides client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 and OpenAPI v3.2 specifications.
Check documentation to see more details about the features. All documentation is in the "docs" directory and online at openapi-core.readthedocs.io
Supported Integrations and it's versions:
| Integration | Version(s) | Level |
|---|---|---|
| AIOHTTP | versions 3.8+ and 3.11+ tracks | Low-level request and response classes |
| Django | versions 4, 5, and 6 | Middleware, decorator and low level |
| Falcon | version 4 | Middleware and low-level classes |
| FastAPI | versions 0.11x, 0.12x, and 0.13x | Middleware (low-level via Starlette integration) |
| Flask | versions 2 and 3 | View decorator, class-based view, and low-level classes |
| Requests | default dependency set | Low-level request, webhook request, and response classes |
| Starlette | versions 0.4x, 0.5x, and 1.x | Middleware and low-level classes |
| Werkzeug | default dependency set | Low-level request and response classes |
Recommended way (via pip):
pip install openapi-core
Alternatively you can download the code and install from the repository:
pip install -e git+https://github.com/python-openapi/openapi-core.git#egg=openapi_core
First, create your OpenAPI object.
from openapi_core import OpenAPI
openapi = OpenAPI.from_file_path('openapi.json')
Now you can use it to validate and unmarshal against requests and/or responses.
# raises an error if the request is invalid
result = openapi.unmarshal_request(request)
Retrieve validated and unmarshalled request data.
# get parameters
path_params = result.parameters.path
query_params = result.parameters.query
cookies_params = result.parameters.cookies
headers_params = result.parameters.headers
# get body
body = result.body
# get security data
security = result.security
The request object should implement the OpenAPI Request protocol. Check Integrations to find officially supported implementations.
For more details read about the Unmarshalling process.
If you just want to validate your request/response data without unmarshalling, read about Validation instead.
The project is under the terms of the BSD 3-Clause License.
179 followers · starred Dec 2021
1,154 followers · starred Mar 2023
159 followers · starred Apr 2020
470 followers · starred Feb 2022