Glossary
OpenAPI
An open standard for describing HTTP APIs in a machine-readable YAML or JSON document, covering endpoints, parameters, request bodies, responses and authentication.
OpenAPI is an open standard for describing HTTP APIs in a machine-readable document. An OpenAPI document, written in YAML or JSON, lists every endpoint an API offers, the HTTP methods each accepts, the parameters and request bodies it expects, the responses it can return and how clients authenticate. Because the description is structured rather than prose, tools can read it to generate reference documentation, client libraries, server stubs, mock servers and tests, and AI models can read it to work out how to call the API. The specification grew out of Swagger and is now maintained by the OpenAPI Initiative, a Linux Foundation project. Versions 3.0 and 3.1 are the ones most APIs publish today.
What an OpenAPI document contains
An OpenAPI document is a single tree of objects with a predictable layout. The openapi field states the version of the specification. The info object holds the API’s title, version and description. The servers list gives base URLs, such as a production and a sandbox host. The paths object is the heart of the document: each path, such as /v2/files, maps HTTP methods to operations, and each operation describes its parameters, request body, possible responses, a short summary and an operationId that tools use as a function name.
The components object holds reusable definitions, so a schema for a File or an Error can be written once and referenced from many operations. It also defines security schemes, for example an API key sent in a header, an OAuth flow or a bearer token, which operations then require. Tags group related operations so documentation tools can show them as sections, and examples attached to schemas and responses show realistic payloads.
OpenAPI and JSON Schema
Request bodies and responses in OpenAPI are described with schemas, and from version 3.1 those schemas are full JSON Schema. A schema says which fields an object has, their types, which are required, allowed values, formats such as date-time or uuid, and nested structures. That alignment matters because JSON Schema is also what model providers use to describe tool parameters and structured output, so the same definition can validate an HTTP request, generate a typed client and constrain what a model produces.
Earlier versions used a close but not identical dialect, which caused friction: a schema valid in OpenAPI 3.0 could fail in a JSON Schema validator and the other way round. Version 3.1 resolved most of this, which is one reason teams building for AI tooling prefer it.
What teams use OpenAPI for
The value of an OpenAPI document is that it becomes the single source many other artefacts are produced from. Write it once and keep it accurate, and the documentation, client libraries and tests stay in step with the API.
Use | What the OpenAPI document provides | Typical output |
|---|---|---|
Reference documentation | Operations, parameters, schemas, examples | Interactive API reference pages |
SDK generation | Operation IDs, request and response types | Typed client libraries per language |
Request validation | Schemas for bodies, query and path parameters | Clear 400 errors before code runs |
Mock servers | Example responses | A fake API for front-end and client work |
Contract testing | Documented response schemas | Tests that catch drift between docs and server |
Agent tools | Operation names, descriptions, parameter schemas | Function-calling tool definitions or an MCP server |
Generated SDKs are the most visible example. A generator reads the document and writes a typed client for each language, with one method per operation and a type for every schema. Many platforms generate the low-level client this way and add hand-written convenience methods on top. Gateways and middleware use the same document to validate incoming requests before they reach application code, rejecting malformed payloads with a clear error, and contract tests compare live responses against the documented schemas to catch drift.
Design-first and code-first
There are two ways to produce an OpenAPI document. In a design-first workflow, the team writes the specification before any code, reviews it like any other design document, generates mocks so client teams can start building, and then implements the server to match. This tends to produce more consistent APIs, because naming, error formats and pagination are decided in one place.
In a code-first workflow, the document is generated from the server code, usually from annotations, type definitions or a framework that infers schemas from request and response models. This keeps the specification close to the implementation and costs less effort, but its quality depends on how carefully the code is annotated. Missing descriptions and vague types in the code become missing descriptions and vague types in the documentation, the SDKs and anything an AI model reads.
OpenAPI, Swagger and other formats
Swagger was the original name of the specification, created in 2010 and donated to the OpenAPI Initiative in 2015, when the specification itself was renamed OpenAPI. Swagger lives on as the name of a popular set of tools, including Swagger UI and Swagger Editor, which is why the two words are often used interchangeably. Strictly, OpenAPI is the standard and Swagger is one family of tools that work with it.
OpenAPI is designed for request and response APIs over HTTP, most commonly REST APIs. Other interface styles have their own description formats. AsyncAPI covers event-driven and message-based APIs. GraphQL APIs describe themselves through a schema that clients can query. gRPC services are defined in Protocol Buffer files. A platform with both a REST API and webhooks may describe the outgoing events in OpenAPI too, since version 3.1 added a top-level webhooks object for exactly that.
OpenAPI and AI agents
AI agents call APIs through function calling: the model is given a list of tools, each with a name, a description and a JSON Schema for its parameters, and returns a structured call when it decides to use one. An OpenAPI operation already has all three, an operationId, a summary and a parameter schema, so converting a specification into a set of agent tools is largely mechanical. Several agent frameworks and an agent SDK or two can load an OpenAPI document and expose its operations as tools directly.
The same idea drives a lot of MCP work. Teams generate an MCP server from an existing OpenAPI document so that any MCP client can call the API, which is the bridge discussed in MCP vs API and MCP vs function calling. The limiting factor is rarely the conversion. It is the quality of the descriptions: a model chooses tools and fills parameters from the text it is given, so an operation summarised as getData with an undocumented parameter called q will be misused, while one called searchResources with a clear description of what q matches will be called correctly.
Large APIs raise a second problem. A specification with three hundred operations becomes three hundred tools, which crowds the model’s context window and makes selection harder. In practice teams expose a curated subset of operations to agents, or group related operations behind a few higher-level tools, and keep the full specification for SDK generation and documentation. Publishing a concise llms.txt alongside the specification is another way to help models find the right entry points.
Writing a specification that tools and models can use
A few habits make an OpenAPI document far more useful. Give every operation a stable, descriptive operationId, because it becomes a method name in every SDK and a tool name for every agent. Write descriptions for operations, parameters and schema fields that say what the value means and when to use it, not only its type. Use enums for fixed sets of values, mark required fields accurately, and include examples. Document error responses with a consistent schema, including rate limit responses such as HTTP 429, so clients can handle them in code. And version the document alongside the API, so a breaking change is visible in a diff before it reaches customers.
A worked example
Take an endpoint that creates a memory for an agent. In the OpenAPI document it appears under paths as /v2/memories with a post operation. The operation has an operationId such as createMemory, a summary of Add a memory, a request body whose schema requires a source field and a content string and accepts an optional infer boolean, and a response schema describing the job that is returned. The security requirement points to an API key scheme sent in a header.
From that one definition, a documentation tool renders a reference page with a form to try the request, a generator writes a typed createMemory method in each target language, a gateway rejects a request missing content before it reaches the service, and an agent framework turns the operation into a tool called createMemory whose parameters the model fills from the conversation. None of those artefacts needed separate maintenance.
Where Exabase fits
Exabase publishes an OpenAPI document for its REST API, available from the API reference, which covers every product area: Memory, Bases, Resources, Deep Search, Extract and Workers. The reference has a page for each operation, such as creating a memory, and the introduction covers authentication with the X-Api-Key header and Base scoping with X-Exabase-Base-Id. For TypeScript there is an official SDK, described in the SDK overview; from any other language you can call the API directly or generate a client from the OpenAPI document.
Because the endpoints are small and consistently named, they translate well into agent tools, which is part of the thinking in designing an API for agents, not humans. If you are building internal agents on top of APIs like this, the internal tools use case and the agent memory solution show how the pieces fit, and the roundup of AI agent frameworks covers which frameworks load OpenAPI tools natively.
FAQs
Is OpenAPI the same as Swagger?
Not quite. OpenAPI is the specification, and Swagger is the original name of that specification and now the name of a set of tools that work with it, such as Swagger UI. Swagger 2.0 documents are the predecessor of OpenAPI 3.
What is an OpenAPI specification used for?
It describes an HTTP API in a machine-readable way, so tools can generate documentation, SDKs, mock servers, request validation and tests from one source. AI frameworks also use it to turn API operations into agent tools.
Is OpenAPI only for REST APIs?
It is designed for HTTP request and response APIs, which are mostly REST. Event-driven APIs usually use AsyncAPI, GraphQL has its own schema, and gRPC uses Protocol Buffers.
What is the difference between OpenAPI 3.0 and 3.1?
OpenAPI 3.1 aligns schemas fully with JSON Schema and adds a top-level webhooks object. In 3.0 the schema dialect was close to JSON Schema but not identical, which caused validation mismatches.
Can an AI agent use an OpenAPI specification?
Yes. Each operation’s operationId, description and parameter schema map directly onto a function-calling tool definition, and many frameworks can load a specification and expose its operations as tools. Clear descriptions matter more than the conversion itself.
Should I write the OpenAPI document by hand or generate it?
Either works. Design-first, writing the document before the code, tends to give more consistent APIs; code-first, generating it from annotated code, is less effort. Both need good descriptions to be useful.
Does Exabase have an OpenAPI specification?
Yes. An OpenAPI document for the Exabase REST API is available from the API reference, alongside the official TypeScript SDK.
Related pages: SDK, REST API, JSON Schema, Function calling, MCP vs API, MCP server, Agent tools, API reference, Agent memory