What is API documentation and what is Swagger/OpenAPI?
Answer
API documentation describes how to use an API — its endpoints, request/response formats, authentication, error codes, and examples. It is essential for developer adoption and reduces integration time. OpenAPI Specification (OAS), formerly known as Swagger, is the industry-standard format for defining REST APIs in a machine-readable YAML or JSON file. An OpenAPI document defines all endpoints, parameters, request bodies, response schemas, security schemes, and examples. Tools built on OpenAPI include: Swagger UI (interactive browser-based API explorer), Postman (import OpenAPI to generate a collection), code generators (client SDKs in any language), and mock servers. Maintaining an OpenAPI spec alongside code ensures documentation stays accurate and enables automated testing and contract validation.
Previous
What is the difference between RESTful and non-RESTful APIs?
Next
What is the Accept-Language header and how is it used?
More REST API Design Questions
View all →- Beginner What is REST and what are its six architectural constraints?
- Beginner What are the main HTTP methods used in REST APIs and what do they do?
- Beginner What is idempotency and which HTTP methods are idempotent?
- Beginner What are the most important HTTP status codes in REST APIs?
- Beginner What are REST resource naming conventions?