# A brief introduction to OpenAPI

DevFeed: [A brief introduction to OpenAPI](<https://devfeed.tech/articles/a-brief-introduction-to-openapi-19081.md>)

Original publisher: [Read original article](<https://httptoolkit.com/blog/introduction-to-openapi/>)

Author: HTTP Toolkit; Phil Sturgeon

Published: 2023-11-28T09:30:00Z

Content type: article

Language: en

Sources: [HTTP Toolkit](<https://devfeed.tech/sources/http-toolkit.md>)

Topics: [OpenAPI Specification](<https://devfeed.tech/topics/openapi.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>), [REST API](<https://devfeed.tech/topics/rest-api.md>), [SDK](<https://devfeed.tech/topics/sdk.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [mock api](<https://devfeed.tech/topics/mock-api.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [apis](<https://devfeed.tech/tags/apis.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [format](<https://devfeed.tech/tags/format.md>), [generate](<https://devfeed.tech/tags/generate.md>), [http](<https://devfeed.tech/tags/http.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [json](<https://devfeed.tech/tags/json.md>), [json-schema](<https://devfeed.tech/tags/json-schema.md>), [metadata](<https://devfeed.tech/tags/metadata.md>), [openapi](<https://devfeed.tech/tags/openapi.md>), [reference](<https://devfeed.tech/tags/reference.md>), [request](<https://devfeed.tech/tags/request.md>), [specifications](<https://devfeed.tech/tags/specifications.md>), [standards](<https://devfeed.tech/tags/standards.md>), [swagger](<https://devfeed.tech/tags/swagger.md>), [tools](<https://devfeed.tech/tags/tools.md>), [type](<https://devfeed.tech/tags/type.md>), [type-system](<https://devfeed.tech/tags/type-system.md>), [type-systems](<https://devfeed.tech/tags/type-systems.md>), [validation](<https://devfeed.tech/tags/validation.md>)

## AI overview

OpenAPI is a machine-readable description format for HTTP APIs, specifying metadata, endpoints, request and response formats, authentication, and validation details. Based on JSON Schema, it gives REST-style APIs a type system. Teams commonly use OpenAPI specifications to generate reference documentation; the excerpt also describes validation, contract testing, client- and server-side validation, SDKs, server stubs, and mock servers as uses across the API lifecycle. Redoc can generate documentation sites from a spec, while HTTP Toolkit uses published specs to validate request parameters and show metadata with requests and responses. The supplied text is an excerpt and ends during the HTTP Toolkit example.

## Source excerpt

It's hard to work on APIs without hearing about OpenAPI. OpenAPI is an API description format, which is essentially metadata that describes an HTTP API: where it lives, how it works, what data is available, and how it's authenticated. Additional keywords can be used to provide all sorts of validation information, adding a type system to what would otherwise just be arbitrary JSON flying around the internet. OpenAPI has been around for donkeys years, previously known as Swagger but renamed to OpenAPI in 2016. It's powered by JSON Schema, which is also pretty popular in certain circles, but it's only in the last few years that OpenAPI has solidified its place as the description format for HTTP APIs, pushing aside others like RAML and API Blueprint. Elder developers will remember working with WSDLs and XML Schema, and gRPC and GraphQL folks might be thinking "hang on this sounds a bit familiar", and absolutely. Type systems for APIs are pretty common, but here's an excellent one you can use for your REST/RESTish API. Here's an example to give you an idea: openapi: 3.1.3 info: title: Your Awesome API version: '1.0.3' description: More information and introduction. paths: /things: post: summary: Create a thing requestBody: content: application/json: schema: type: object properties: name: type: string examples: - Tim responses: '201': description: "Created" content: application/json: schema: type: object properties: id: type: string format: uuid name: type: string examples: - Tim created_at: type: string format: date-time example: 2020-01-01T00:00:00Z This describes an API in a machine-readable format, including overall metadata, endpoint paths, request formats, and the details of possible responses you might receive. What can OpenAPI do? OpenAPI specifications provide a machine-readable base on top of which lots of neat API tools can be used and even generated. One of the most common uses by many API teams to to generate API reference documentation, which helps end-users