OpenAPI (formerly Swagger) is a language-agnostic, machine-readable specification standard for describing RESTful HTTP APIs. The specification allows both humans and computers to understand API capabilities without accessing source code or documentation through network inspection. OpenAPI descriptions can be written in YAML or JSON format, with YAML preferred for manual authoring due to readability and comment support. OpenAPI 3.1 achieved full JSON Schema Draft 2020-12 compatibility; OpenAPI 3.2 (released September 2025) added first-class streaming support, the QUERY HTTP method, hierarchical tags, and the $self document identity field. The OpenAPI Initiative also maintains two companion standards — the Overlay Specification (non-destructive spec patches) and the Arazzo Specification (API workflow sequences) — completing a three-spec ecosystem for API design, documentation, and orchestration.
What This Cheat Sheet Covers
This topic spans 26 focused tables and 249 indexed concepts, 120 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: OpenAPI Document Structure
These are the top-level fields that make up the skeleton of every OpenAPI document. Only openapi and info are strictly required, but in practice you'll always have paths (the endpoints) and components (the reusable building blocks the rest of the document points back to). The newer entries—webhooks and $self—reflect how the spec has grown to describe APIs that push events outward and live across multiple files.
| Field | Example | Description | |
|---|---|---|---|
openapi: 3.1.0 | • Required. Specifies the OpenAPI Specification version — 3.0.x, 3.1.x, or 3.2.x are current• version determines available features and JSON Schema compatibility. | ||
info: title: My API version: 1.0.0 | • Required. Metadata about the API including title, description, version, contact, license, and terms of service • title and version are mandatory. | ||
paths: /users: get: {...} | Required (or webhooks or components). Defines available API endpoints and HTTP operations with their parameters, request bodies, and responses. | ||
components: schemas: User: {...} | • Container for reusable objects — schemas, responses, parameters, examples, security schemes, and more • referenced via $ref. | ||
servers:- url: https://api.example.com/v1 | • Array of server objects defining base URLs where the API is available • supports variable substitution for environment-specific URLs. | ||
security:- apiKey: [] | • Global security requirements applied to all operations unless overridden at the operation level • references schemes in components/securitySchemes. | ||
webhooks: newUser: post: {...} | • OpenAPI 3.1+ feature for defining out-of-band requests the API sends to client-provided URLs when events occur • distinct from operation callbacks. | ||
tags:- name: Users description: User management | • Array of tag objects used to group operations in documentation • operations reference tags for logical organization. | ||
externalDocs: url: https://docs.example.com | Link to external documentation providing additional context or details about the API. | ||
$self: https://example.com/api/openapi.yaml | • OpenAPI 3.2+. Declares the document's canonical URI and base URI for resolving all relative $refs• makes multi-file API descriptions portable regardless of where files are hosted. |