OpenAPI is a standard way to describe a web API in a single file. The file lists every address the API offers, what each one accepts, what it returns and what can go wrong. Humans read it as documentation, and software reads it to generate test pages, code and checks automatically.
You will also hear it called Swagger, its original name. If you are hiring a developer to connect two tools, commissioning a custom app, or judging whether a platform is serious about integrations, knowing what an OpenAPI file is helps you ask for the right deliverable and avoid paying twice for the same work.
What is OpenAPI?
The OpenAPI Specification is an open standard, maintained by the OpenAPI Initiative under the Linux Foundation, for describing REST APIs. An OpenAPI document is a text file written in YAML or JSON. It is not code that runs. It is a precise description, like a detailed product sheet for an API.
A typical OpenAPI file contains:
- General information: the API's name, version, contact and base address.
- Paths: every endpoint, such as /orders or /products/{id}, and the methods allowed on each (GET, POST, PATCH, DELETE).
- Parameters: filters and options, like "status=paid" or "page=2".
- Request and response bodies: the exact fields, their types and which ones are required. For example, an order has an id, a total in cents, a currency code and a list of lines.
- Error responses: what the API returns when something fails, such as 404 for an unknown order.
- Security: how clients prove who they are, such as an API key or an OAuth token.
About the names. Swagger was created in 2011 as a specification and a set of tools. In 2015 the specification was donated to a neutral foundation and renamed OpenAPI. The tools kept the Swagger name. So today, OpenAPI is the format, and Swagger refers to tools that work with it, the best known being Swagger UI, which turns an OpenAPI file into an interactive documentation page. Many people still say "Swagger file" when they mean an OpenAPI document.
OpenAPI is not an API itself, and it does not make an API good or secure. It describes REST-style APIs. GraphQL APIs use their own schema instead, and event-based APIs often use a sibling format called AsyncAPI.
Why it matters
An OpenAPI file turns vague knowledge about an API into a shared, checkable document. That saves money in three places.
First, estimates get more accurate. Suppose a brand with 800 orders a month wants its store connected to a warehouse. The freelancer quotes 4 days at $500, so $2,000. If both APIs publish OpenAPI files, the freelancer can confirm before quoting that the warehouse accepts orders with gift messages and returns tracking numbers. Without it, that discovery happens on day 3, and the quote grows by 2 days, $1,000, or the feature is dropped.
Second, work goes faster. Tools read the OpenAPI file and generate client code, test requests and mock servers automatically. A developer who would spend a day hand-writing request code can start from generated code in an hour.
Third, you keep what you paid for. If you commission a custom API, the OpenAPI file is the manual that lets the next developer take over. An agency that leaves you with code but no description leaves you dependent on them. With a complete OpenAPI file, a new freelancer can understand the API in hours, not weeks.
How it works
OpenAPI fits into an API's life like this:
- Someone writes or generates the file. In API-first design, the team writes it by hand before coding. In code-first projects, a framework generates it from the code.
- The file is reviewed. Founders and developers check the endpoints and fields match the business needs.
- Tools read the file. Swagger UI and similar tools render readable, clickable documentation. Others generate client libraries in many languages or create mock servers that return sample data.
- Developers test calls. From the documentation page, they send real requests with a test key and see the responses.
- Automated checks compare reality with the file. Tests confirm the live API returns exactly the fields and codes the file promises.
- The file is versioned. When the API changes, the file changes with it, and the version number tells integrators what moved.
The current major versions are 3.0 and 3.1. Older documents in version 2.0 are still called Swagger 2.0.
Benchmarks and examples
Useful reference points:
- Size: a small API with 10 to 20 endpoints often fits in an OpenAPI file of 500 to 2,000 lines. Large platforms publish files with tens of thousands of lines.
- Effort: writing a clean OpenAPI file for an existing small API takes a developer roughly 1 to 3 days. Keeping it in sync costs a few hours per release.
- Code generation: generated client code can save 1 to 3 days on a typical integration, depending on the language and how clean the file is.
- Adoption: most major payment, shipping and messaging providers publish an OpenAPI description or build their documentation from one.
Typical situations:
- A freelancer imports a payment provider's OpenAPI file and tests every call before writing a line of integration code.
- An agency building a custom booking back end delivers the OpenAPI file alongside the code so the client's mobile developer can start.
- A brand's developer generates a mock server from the file to build a wholesale portal while the real API is still being finished.
- A founder asks for the OpenAPI file in the contract so a future developer can take over without reverse engineering.
Common mistakes
- Treating the file as optional. Without it, knowledge lives in one developer's head. Put it in the deliverables.
- Letting it drift from the code. A file that describes last year's API misleads everyone who reads it.
- Leaving out errors and examples. A file that lists fields but no error cases or sample values forces developers to guess.
- Publishing internal endpoints by accident. An admin endpoint described in a public file invites unwanted attention. Review what you publish.
- Confusing the file with security. Documenting an API does not protect it. Authentication and permissions still have to be built.
Best practices
- Write it into the contract. When you commission an API, list a complete, up-to-date OpenAPI file as a deliverable you own.
- Ask for examples on every endpoint. Sample requests and responses make the file readable for non-developers too.
- Generate or check it automatically. Either produce the file from code or test the code against the file on every release.
- Use clear business names. Fields like "shipping_cost" and "gift_message" read better than "field_12".
- Keep a changelog next to it. A short note per version tells integrators what changed and what might break.
- Publish it with readable docs. Pair the file with a tool like Swagger UI so partners can explore the API without special software.
In Roctify
Roctify is a SaaS and a no-code platform, so you run your store without reading API descriptions. Products, variants, stock, customers and orders live in one shared catalog used by your link-in-bio page, storefront and checkout, and Roctify connects Stripe and PayPal for payments. The integration work that an OpenAPI file usually supports is, for most sellers, already done inside the platform.
Roctify does not offer a public API or an OpenAPI description today. If you need your data elsewhere, Pro includes reports and exports, and custom integrations for larger operations are discussed on the Enterprise plan. When you evaluate other tools to use next to your store, a published OpenAPI file is a good sign that their integrations are well maintained.
FAQ
Is OpenAPI the same as Swagger?
Almost. Swagger was the original name of the specification. Since 2015 the specification is called OpenAPI, and Swagger refers to a family of tools that work with it, such as Swagger UI. People still use both words for the file.
Do I need to read an OpenAPI file myself?
Usually not. Your developer reads it. What matters for you is to ask whether the tools you plan to connect publish one, and to require one when you commission a custom API.
Can OpenAPI describe any API?
It is designed for REST-style HTTP APIs. GraphQL APIs are described by their own schema, and event-driven APIs often use AsyncAPI. Most web APIs you meet as a seller are REST, so OpenAPI covers them.