Skip to main content

openapi-core

Package version Continuous Integration Tests coverage Python versions Package format Development status

About

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.

Key features

  • Validation and unmarshalling of request and response data (including webhooks)
  • Integration with popular libraries (Requests, Werkzeug) and frameworks (Django, Falcon, Flask, Starlette)
  • Customization with media type deserializers and format unmarshallers
  • Security data providers (API keys, Cookie, Basic, and Bearer HTTP authentications)

Documentation

Check documentation to see more details about the features. All documentation is in the "docs" directory and online at openapi-core.readthedocs.io

Integrations compatibility matrix

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

Installation

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 steps

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.

Related projects

  • openapi-spec-validator : A Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0, OpenAPI 3.1, and OpenAPI 3.2 specification. The validator aims to check for full compliance with the Specification.
  • openapi-schema-validator : A Python library that validates schema against the OpenAPI Schema Specification v3.0, v3.1, and v3.2.
  • bottle-openapi-3 : OpenAPI 3.0 Support for the Bottle Web Framework
  • pyramid_openapi3 : Pyramid addon for OpenAPI3 validation of requests and responses.
  • tornado-openapi3 : Tornado OpenAPI 3 request and response validation library.

License

The project is under the terms of the BSD 3-Clause License.

Release files for openapi-core 0.23.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 openapi-core 0.23.1
File Size Uploaded
openapi_core-0.23.1.tar.gz 124.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openapi-core 0.23.1
File Interpreter ABI Platform
openapi_core-0.23.1-py3-none-any.whl Python 3 none any Details

Total release size: 239.6 kB

Release files / openapi_core-0.23.1.tar.gz

Download URL openapi_core-0.23.1.tar.gz
Size 124.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8021c9cf5fbb356ea5694c233fbfba0dc7ec595dfbdc1d2b295ac13f3de4fdad
BLAKE2b-256 checksum
How to use checksums
4707ad02621876c983308abe7bc9604b4d0141fde97fb49fb252ed9af5ad0090
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 2, 2026.

Transparency log

Release files / openapi_core-0.23.1-py3-none-any.whl

Download URL openapi_core-0.23.1-py3-none-any.whl
Size 115.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40eda0b6e4c2aa0d0e4fb864e1f461b68bb59c5c41fe154c03fda49bf41d2dc9
BLAKE2b-256 checksum
How to use checksums
dca17c6ef56641a2c326a211ca7709197b2b9bd91fe02931460faa51d4a8bda1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.23.1 This release

2 release files

0.23.0

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.5

2 release files

0.19.3

2 release files

0.19.2

2 release files

0.19.1

2 release files

0.19.0

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.16.5

2 release files

0.16.4

2 release files

0.16.3

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.15.0

2 release files

0.14.2

3 release files

0.13.7

3 release files

0.13.4

3 release files

0.13.3

3 release files

0.13.2

3 release files

0.13.1

3 release files

0.13.0

3 release files

0.12.0

3 release files

0.11.0

3 release files

0.10.0

3 release files

0.9.0

3 release files

0.8.0

3 release files

0.7.1

3 release files

0.7.0

3 release files

0.6.0

3 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.1

1 release file

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