OpenAPI is a specification for describing REST APIs using a standard format (JSON or YAML). It documents endpoints, request parameters, response schemas, authentication, and more, enabling automatic code generation, documentation, and testing.
OpenAPI (formerly Swagger) started as a specification by SmartBear in 2011 and became the OpenAPI Specification under the Linux Foundation in 2016. An OpenAPI document describes every aspect of an API: available endpoints, HTTP methods, parameters, request bodies, response schemas, authentication methods, and error codes.
You write an openapi.yaml (or JSON) file that defines your API. Tools like Swagger UI generate interactive documentation from the file. Code generators (openapi-generator) create client SDKs and server stubs in 40+ languages. Validators check that your API implementation matches the specification.
Swagger was the original name. In 2016, the specification was donated to the Linux Foundation and renamed OpenAPI. SmartBear's Swagger tools (Swagger UI, Swagger Editor) remain the most popular OpenAPI tooling.
Yes, OpenAPI is specifically for REST APIs. GraphQL uses a different introspection-based schema. gRPC uses protobuf definitions.