Describe an HTTP API in an OpenAPI document

8 steps · about 1 h 6 min · Beginner

  1. Start with what an OpenAPI description is for (guide, OpenAPI Initiative, 6 min)

    Explains how one file drives docs, client code and tests.

  2. Lay out the top-level structure of an OpenAPI file (guide, OpenAPI Initiative, 8 min)

    Shows the required fields and how the document is organised.

  3. Describe API endpoints with paths and operations (guide, OpenAPI Initiative, 10 min)

    Covers how each URL and HTTP method is written down.

  4. Document path, query and header parameters (guide, OpenAPI Initiative, 8 min)

    Makes inputs explicit so clients stop guessing.

  5. Define request and response bodies with schemas (guide, OpenAPI Initiative, 10 min)

    Shows how payload shapes and media types are described.

  6. Reuse schemas and responses with components and $ref (guide, OpenAPI Initiative, 8 min)

    Keeps a growing description small and consistent.

  7. Lint the description against style rules with Spectral (reference, Stoplight, 10 min)

    Catches missing fields and inconsistent naming automatically.

  8. Validate the file in CI with Redocly CLI lint (reference, Redocly, 6 min)

    Adds a pass/fail check so the description stays valid.