OpenAPI Specification
A YAML or JSON file describing every endpoint, input, and response of an API, so tools can generate docs, clients, and mocks from it.
See it
What it is
OpenAPI is a YAML or JSON file that describes an HTTP API in a format machines can read: every path and method, the parameters, the request and response schemas, the auth scheme, the error shapes. It used to be called Swagger, which is why people still say 'send me the swagger file' long after the format moved on and kept moving: 2.0, then 3.0, 3.1, and later releases in the 3.x line. Version matters less than compatibility, so check which one your generator, validator, and docs renderer actually accept before you commit to one.
The payoff is tooling. One file gives you rendered docs (Swagger UI, Redoc, Scalar), a typed client in almost any language (openapi-typescript, orval, openapi-generator), a mock server to code against before the backend exists (Prism), and request validation in the middle of your stack. If a vendor publishes a spec, generate the client instead of hand-writing fetch calls; if you publish an API, the spec is the cheapest documentation you will ever maintain.
The failure mode is drift. A spec written by hand in a separate file quietly lies about the API within two sprints. Generate it from the code (Zod plus a route builder, FastAPI, tRPC adapters, decorators) or test the running API against it in CI, so the file cannot disagree with reality without something turning red.
Ask AI for it
Write an OpenAPI spec for this API as openapi.yaml, using the newest 3.x version my tooling supports and stating which one you picked. Cover every route with its method, path and query parameters, request body, and response codes including the error shape, and put shared models under components/schemas with $ref reuse. Declare bearer auth in components/securitySchemes and apply it per operation. Include one realistic example per response, then generate a typed TypeScript client from the spec with openapi-typescript and show me the fetch call for one endpoint.