Skip to content

OpenAPI

OpenAPI is a vendor-neutral standard for describing HTTP APIs in a machine-readable document, so people and programs can learn what a service offers without reading its source code or watching its network traffic. Its full name is the OpenAPI Specification (OAS).

An OpenAPI description is a JSON or YAML document, sometimes split across several files, that records an API as data. It lists the server addresses, every path and HTTP method the service accepts, the parameters and request bodies each operation takes, and the responses it can return. Reusable pieces such as data models and authentication schemes live in a shared components section.

Data shapes are written as schemas. Since version 3.1, the Schema Object is a superset of JSON Schema draft 2020-12, the vocabulary for describing and validating JSON documents.

Because the description is machine-readable, one file can feed a whole toolchain:

  • Documentation: Renderers such as Swagger UI turn the file into interactive reference pages where each operation can be tried in a browser.
  • Code generation: Generators build client libraries and server stubs in many languages from the same description.
  • Testing: Validators check that real requests and responses match the declared schemas.
  • Mocking: A mock server answers requests from the declared examples before the real service exists.

The document is a published contract between a service and its clients. Teams either write it first and build the service to match, or generate it from the code. Python web frameworks such as FastAPI take the second route and derive it from route functions and type hints. Either way, the same document then drives every tool:

A design-first YAML file or FastAPI code produces one OpenAPI description, which feeds docs, client code, tests, and a mock server.
Two Ways In, One Description, Many Tools Out

OpenAPI began in 2010 as the Swagger specification, created by Tony Tam at Wordnik. SmartBear donated it to the Linux Foundation’s OpenAPI Initiative in 2015, and it took its current name in 2016. The Swagger name lives on in tools built around the standard.

Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 1

Tutorial

Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 1

Build a Flask REST API with Connexion and Swagger UI in this three-part series. Part one lays the foundation of your application.

intermediate api flask web-dev

For additional information on related topics, take a look at the following resources:

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Martin Breuss • Updated Nov. 15, 2026