Skip to content
IT glossary
BackendUpdated December 3, 2026

OpenAPI

This standard describes an HTTP API in a form that people and tools can read. It tells clients which requests they can make, what data to send, and what responses to expect.

What OpenAPI describes

If a web app needs to fetch a book from a backend, its developer needs more than a URL: Which HTTP method should the app use? What kind of ID goes in the path? What does a successful response contain? An OpenAPI document records those answers in a standard format. It serves as a contract between the API provider and its consumers, regardless of which languages they use.

How the document is organized

An OpenAPI document is written in YAML or JSON. Under paths, each path can have operations such as get or post. An operation can describe parameters, a request body, and responses by status code and media type. Schemas describe the shape of the data: for example, which properties an object must contain and what types they have. Put shared schemas in components.schemas and reference them with $ref instead of repeating them. The top-level openapi field selects the version of the specification; info.version is the version of the API description.

Example: fetching a book

openapi: 3.1.0
info:
  title: Library API
  version: '1.0'
paths:
  /books/{id}:
    get:
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Book found
          content:
            application/json:
              schema:
                type: object
                required: [title]
                properties:
                  title:
                    type: string
        '404':
          description: Book not found

A client can read this as: send GET /books/42 and expect a JSON object with a string title on success. If the book does not exist, expect 404. The example does not specify a response body for 404, so the client should not assume it has a particular JSON shape.

How teams use it

In a contract-first workflow, teams agree on the document before implementing the endpoints. Frontend and backend developers can then work in parallel against the same agreed interface. In a code-first workflow, tooling derives the description from the server's routes, types, or annotations. Either way, teams can use the document to render interactive docs, generate client libraries, or check API responses in tests.

A valid OpenAPI document is not proof that the API behaves as described. For example, a server might return a numeric title even though the schema says it is a string. Checking the file catches problems in the description; sending a request to the running service and checking its response catches that mismatch.

OpenAPI vs. Swagger

Swagger 2.0 is the predecessor of OpenAPI 3.x. The Swagger name also survives in tools such as Swagger UI, which renders an API description and lets users try requests in a browser. OpenAPI is the specification, not the UI, and it can describe internal APIs as well as public ones.

In interviews

A common question is what counts as a breaking change. Making an optional request parameter required can break existing clients even when the URL and method stay the same. Comparing contract versions in CI can flag that change before release; testing against the running API answers the separate question of whether the implementation matches the contract.