Skip to content

By Mohammed Khair · Updated

OpenAPI vs Swagger in 2027: What's the Difference, With Examples

Share

OpenAPI is the specification; Swagger is its old name and now a set of tools. Here is how the two names split, the same endpoint written in Swagger 2.0 and OpenAPI 3.1, and every field that changed between them.

OpenAPI vs Swagger in 2027: What's the Difference, With Examples

Summarize this page with

OpenAPI vs Swagger at a glance

OpenAPI Swagger
What it is A specification: the rules for describing an API in a file The spec's name up to 2.0, and today a family of tools
Owned by The OpenAPI Initiative, a Linux Foundation project SmartBear
Current version 3.2.0, released September 19, 2025 The last spec version under the name was 2.0, from 2014
First line of the file openapi: 3.1.0 swagger: "2.0"
Licence Apache 2.0 The open-source tools are Apache 2.0; SmartBear also sells a paid platform
What you do with it Write it, or generate it from your code Render it (Swagger UI), edit it (Swagger Editor), generate code from it (Swagger Codegen)

In short: OpenAPI is the format, Swagger is a set of tools for that format, and the two names overlap only because the format used to be called Swagger.

How one name became two

Year What happened
2010 Tony Tam starts Swagger at Wordnik to describe Wordnik's own API
2011 Swagger 1.0 is released, with Swagger UI to render it
2014 Swagger 2.0 is released on September 8
2015 SmartBear buys Swagger in March. In November, SmartBear and nine other companies, Google, IBM and Microsoft among them, form the OpenAPI Initiative under the Linux Foundation, and the spec is donated to it as the OpenAPI Specification
2017 OpenAPI 3.0.0, the first version released under the new name, on July 26
2021 OpenAPI 3.1.0 on February 15, with schemas aligned to JSON Schema and webhooks
2025 OpenAPI 3.2.0 on September 19

SmartBear kept the Swagger name for its tools. That is why "OpenAPI 2.0" and "Swagger 2.0" are the same document, and why there was never a spec called Swagger 3.0: the version after Swagger 2.0 is OpenAPI 3.0.

The same endpoint in Swagger 2.0 and OpenAPI 3.1

Here is one POST /pets endpoint described both ways. It takes a pet as JSON and returns the pet it created.

Swagger 2.0

yaml
swagger: "2.0"
info:
  title: Pets API
  version: 1.0.0
host: api.example.com
basePath: /v1
schemes: [https]
paths:
  /pets:
    post:
      operationId: createPet
      consumes: [application/json]
      produces: [application/json]
      parameters:
        - in: body
          name: pet
          required: true
          schema:
            $ref: "#/definitions/Pet"
      responses:
        "201":
          description: Created
          schema:
            $ref: "#/definitions/Pet"
definitions:
  Pet:
    type: object
    required: [name]
    properties:
      name:
        type: string
      tag:
        type: string

OpenAPI 3.1

yaml
openapi: 3.1.0
info:
  title: Pets API
  version: 1.0.0
servers:
  - url: https://api.example.com/v1
paths:
  /pets:
    post:
      operationId: createPet
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Pet"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
components:
  schemas:
    Pet:
      type: object
      required: [name]
      properties:
        name:
          type: string
        tag:
          type: [string, "null"]

Four things moved. The address is one servers URL instead of host, basePath and schemes. The body is a requestBody instead of a parameter with in: body. Media types sit under content instead of in consumes and produces. And shared models live in components/schemas instead of definitions. The 3.1 file can also say tag may be null, which Swagger 2.0 has no standard way to say.

What changed from Swagger 2.0 to OpenAPI 3

Swagger 2.0 OpenAPI 3.x
swagger: "2.0" openapi: 3.0.4, 3.1.1 or 3.2.0
host, basePath, schemes servers, a list of URLs that can hold variables
definitions components/schemas
Shared parameters and responses at the top level components/parameters and components/responses
securityDefinitions components/securitySchemes
Parameters with in: body or in: formData requestBody, with a schema per media type
consumes and produces content, keyed by media type, on each request and response
No oneOf or anyOf oneOf, anyOf and not (3.0)
The x-nullable vendor extension nullable: true (3.0), type: [string, "null"] (3.1)
type: file type: string with format: binary (3.0), contentMediaType (3.1)
OAuth flows accessCode and application authorizationCode and clientCredentials
Nothing callbacks and links (3.0), webhooks (3.1)

None of this changes what your API does. It changes how the file describes it, and mostly in ways that let the file say more: several media types per request, polymorphic bodies, nullable fields, and webhooks your API sends.

What "Swagger" means today

When people say Swagger now, they usually mean one of SmartBear's tools:

  • Swagger UI renders an OpenAPI file as an interactive reference, with a "Try it out" button on every endpoint. It is the page many APIs serve at /swagger.
  • Swagger Editor is a browser editor that checks the file as you type and previews it.
  • Swagger Codegen generates client libraries and server stubs from the file.
  • Swagger, the paid platform once called SwaggerHub, adds hosting, design reviews and portals. An external portal started at €32.34 per user a month when we read SmartBear's pricing page on December 2, 2026.

The three open-source tools read both Swagger 2.0 and OpenAPI 3.x files. So "Swagger docs" for a 3.1 API is normal: it means Swagger UI rendering an OpenAPI file.

Swagger UI rendering the Petstore sample API
Swagger UI, the most common Swagger tool, rendering an OpenAPI file.

Should you move a Swagger 2.0 file to OpenAPI 3?

For a new API, write OpenAPI 3.1. Most current tools read it, and its schemas are plain JSON Schema, so JSON Schema validators work on them as they are. Check that your tools read 3.2 before you use its new fields.

For an existing Swagger 2.0 file, convert it when you need something 2.0 cannot say: more than one media type for a body, oneOf for a polymorphic field, nullable fields, or webhooks. The conversion is mechanical. The open-source swagger2openapi package does it from the command line (npx swagger2openapi swagger.yaml -o openapi.yaml), and Swagger Editor can convert a file in the browser. Read the result before you replace the old file: vendor extensions such as x-nullable carry across as they are, and you will want to swap them for the 3.x keyword.

Many frameworks can also emit 3.x for you. FastAPI, NestJS, Springdoc and ASP.NET Core all generate OpenAPI 3 from your code, so moving the framework's generator to 3.x may be all the work there is.

Docs, SDKs and an MCP server from either file

Octri's documentation site, the API Studio overview page

Before you publish anything, you can check the file itself. Octri's free OpenAPI linter scores a spec out of 10 against the rules SDK generators depend on, with no account. Box's public spec, for example, scores 9.1.

Octri spec score for the Box Platform API: 9.1 out of 10, with the rules that cost points listed below.
Octri's published score for Box's public OpenAPI spec.

Which should you use?

Swagger 2.0, OpenAPI 3.1 or Octri?

Where does your API description come from?
What do you need the file to describe?
Who reads the result?

FAQ

Is Swagger the same as OpenAPI?

Not anymore. Swagger 2.0 and OpenAPI 2.0 are the same specification under two names, but since 3.0 the specification is only called OpenAPI. Swagger is now the name of SmartBear's tools that read OpenAPI files.

Is there a Swagger 3.0?

No. The version after Swagger 2.0 is OpenAPI 3.0, released in July 2017. When people say "Swagger 3" they usually mean an OpenAPI 3 file, or version 3 of a Swagger tool such as Swagger UI.

What does OpenAPI stand for?

It is a name, not an acronym. The OpenAPI Specification, or OAS, is the format, and the OpenAPI Initiative, or OAI, is the Linux Foundation project that maintains it. The API in the name is the usual Application Programming Interface.

Is OpenAPI YAML or JSON?

Either. An OpenAPI document can be written in YAML or JSON, and the two hold the same content. YAML is more common for files people edit by hand, and JSON for files a framework generates.

Is OpenAPI still used?

Yes. It is the standard way to describe a REST API, and the OpenAPI Initiative released version 3.2.0 in September 2025. API gateways, docs tools, SDK generators and testing tools read it.

Can I still use Swagger UI with OpenAPI 3.1?

Yes. Swagger UI and Swagger Editor read OpenAPI 3.x files as well as Swagger 2.0 ones. If you want a page that reads better than Swagger UI, see the best Swagger UI alternatives.

Do I need to convert my Swagger 2.0 file to use Octri?

No. Octri reads Swagger 2.0, OpenAPI 3.0 and 3.1, Postman collections and AsyncAPI documents, in JSON or YAML, up to 15 MB. A 2.0 file is converted to OpenAPI 3 when you import it.

Conclusion

OpenAPI is the specification, and Swagger was its name until 2.0. Today Swagger names the tools, and nearly all of them read OpenAPI 3.x. For a new API, write 3.1. For an old 2.0 file, convert it when you need what 3.x adds. For more, read what an OpenAPI spec is, compare Postman vs Swagger, or score your spec for free.

Share

More comparisons