
The OpenAPI Specification (OAS) is a standard format used to describe REST APIs. It is widely used with tools like Swagger. OpenAPI is essential for Clean API documentation, Developer experience, Scalable API systems. It turns your API into a professional, easy-to-use product.
It helps you:
OpenAPI is a JSON or YAML-based specification that defines:
Example:
API → Defined in YAML/JSON → Used by tools → Documentation generatedBasic structure:
openapi: 3.0.0
info:
title: Postcode API
version: 1.0.0
paths:
/postcode:
get:
summary: Get postcode detailsinfo:
title: API Name
version: 1.0.0
description: API descriptionpaths:
/users:
get:
summary: Get usersparameters:
- name: id
in: query
required: true
schema:
type: stringresponses:
200:
description: Successcomponents:
schemas:
User:
type: objectopenapi: 3.0.0
info:
title: Sample API
version: 1.0.0
paths:
/data:
get:
summary: Get data
responses:
200:
description: Successful responseUse tools like:
They convert OpenAPI file into Interactive API documentation
With OpenAPI, you can generate a visual interface using Swagger UI.
openapi.yamlExample for API Key:
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: Authorization