OpenAPI specification

Updated November 24, 2026

An OpenAPI specification is a JSON or YAML document that describes an HTTP API in a standard format, including its endpoints, parameters, request and response schemas and authentication. The format is the OpenAPI Specification, formerly Swagger, and tools read it to generate documentation, client code and tests without access to the API's source code.

In short: An OpenAPI specification is a standard JSON or YAML description of an HTTP API that lists its paths, inputs, outputs and authentication so people and tools can call it without reading source code.

How an OpenAPI specification works

An OpenAPI specification is one file, or a set of linked files, that answers the questions a developer has before calling an API. It gives the base URL, the endpoints that exist, what each one accepts, what comes back and how a request authenticates. The OpenAPI Specification sets the format for those answers 1.

The top-level fields. A document opens with the version of the format it follows, an info block with the title and API version, and a list of servers with base URLs 1. The paths object lists the available paths and operations 1.

Operations. Each path holds one or more HTTP methods, such as GET or POST. An operation has an identifier, a summary, a description, its parameters, a request body and the responses it can return, keyed by status code.

Schemas. Request and response bodies are described with the Schema Object, which follows JSON Schema draft 2020-12 in recent versions of the format 1. Shared schemas live in a components section and are referenced from operations, so one definition of a person record can serve many endpoints.

Security schemes. The components section also declares how clients authenticate, such as an API key in a header, a bearer token or OAuth flows 1. An API key scheme names the header the key goes in.

Extensions. Vendors can add their own data at defined points with fields that always begin with x- 1. Vendors use them for data the standard does not cover, such as pricing.

What tools do with it. Documentation tools render it as a reference site, code generators turn it into clients and servers in many languages, and testing tools use it to build requests 1. Because the format is not tied to the language the API is written in, the same file serves every consumer 2.

Versions. The format has moved from Swagger 1.0 in 2011 to the 3.x line 1. As of November 2026, the latest published version is 3.2.1, dated 10 September 2026 1. Tools differ in which versions they support, so the openapi field at the top of a file is worth checking first.

Why an OpenAPI specification matters for a data API

For a data API, the specification is the contract a buyer can test before writing code. It shows what each endpoint needs as input, which matters when two endpoints that sound alike take different identifiers.

Inputs before spend. A person enrichment endpoint that only accepts a profile URL fails on a list of emails. Reading the request schema first saves the credits a wrong call would burn. In RichAPI's specification, enrich_profile requires a url field holding a LinkedIn profile URL 3.

Cost in the contract. RichAPI states the credit cost of each operation in an x-pricing extension 3. The enrich_profile entry shows credits_per_call of 1, with an optional component that adds 1 credit when include_social_metrics is true 3. A script can read those values and estimate a job's credit use before it runs, alongside the account's API credits balance.

Clients without an SDK. RichAPI's developers page says the spec generates a client in any language and that a Postman collection with the same endpoints is in the app after sign-up 4. The base URL in the spec is https://api.richapi.ai/api/v1 3.

Agents and tools. An agent framework needs a name, a description and a JSON Schema for each tool it can call. An OpenAPI operation already holds those parts, which is why teams convert specs into tool calling definitions. RichAPI also runs an MCP server for agents, and MCP signs in with OAuth.

Change tracking. Keeping a copy of the spec in version control and diffing it on a schedule shows when an endpoint, a field or a price changed.

Example of reading an OpenAPI specification before the first call

A developer wants to know whether a list of LinkedIn profile URLs can be enriched, what it will cost and how to authenticate, before signing up for anything. The answers are in the public spec.

Fetch the document. The spec is a public JSON file at app.richapi.ai/api/openapi 3. The first fields say it follows OpenAPI 3.1.0 and that the server URL is https://api.richapi.ai/api/v1 3.

Find the operation. Under paths, the developer opens /enrich_profile. Its operationId is enrich_profile, and the request body requires url, a LinkedIn profile URL 3. Optional flags include include_social_metrics and useCache, which returns a cached result when one is available and defaults to true 3.

Read the price. The x-pricing block shows the cost.

json
"x-pricing": {
  "credits_per_call": 1,
  "min_credits_per_call": 1,
  "max_credits_per_call": 2
}

The maximum of 2 applies when the social metrics component is requested and available 3.

Check auth. The components section declares one security scheme, an apiKey sent in the x-api-key header 3.

Generate a client. The developer runs a code generator on the file and gets a client, as the RichAPI developers page describes 4. The first real call goes out with the key in the header, and the response shape matches the spec.

Plan the batch. The list has a few thousand profile URLs. The developer reads credits_per_call from the spec, multiplies it by the list size and compares the total with the account balance before the run 3. Social metrics are left off, because the CRM has no field for them.

Watch for change. The developer saves the spec file in the repository next to the client. A weekly job fetches the live file and diffs it, so a new required field or a price change shows up in a pull request instead of a failed batch.

Read the reference →

Frequently asked questions

Is OpenAPI the same as Swagger?

OpenAPI is the current name of the format that started as the Swagger Specification. Swagger 2.0 was donated to the OpenAPI Initiative on December 31, 2015, and later versions carry the OpenAPI name 1. Swagger is still the name of a set of tools.

Is an OpenAPI specification written in JSON or YAML?

Either one. The OpenAPI Initiative says API specifications are typically written in YAML or JSON 2. The two forms hold the same structure, and most tools accept both. JSON suits code that fetches the spec at runtime, and YAML suits hand editing.

What can you generate from an OpenAPI specification?

Reference documentation, client libraries and server stubs in many languages, and test suites 1. Teams also convert operations into tool definitions for agents, since each operation already has a name, a description and a schema for its inputs.

Where is the RichAPI OpenAPI specification?

It is a public JSON document at app.richapi.ai/api/openapi, in OpenAPI 3.1.0 format 3. It lists each operation with its request schema, the x-api-key security scheme and an x-pricing extension with the credit cost of the call 3.

The bottom line

An OpenAPI specification is a standard JSON or YAML description of an HTTP API that people and tools can read without the source code 1. For a data API it shows inputs, outputs, auth and, when the vendor includes it, price per call. RichAPI publishes an OpenAPI 3.1.0 file with an x-pricing extension on its operations, so a team can check fit and cost before the first request 3.

Sources

  1. OpenAPI Specification v3.2.1, OpenAPI Initiative
  2. What is OpenAPI?, OpenAPI Initiative
  3. RichAPI OpenAPI specification, RichAPI
  4. Developers, RichAPI

More terms