Postman To Swagger

Convert Postman Collection to Swagger Open API

If you are looking for conversion, please use our Online Postman Collection to Swagger Converter

Postman Collections

Postman has its own format for saving the API specs. They call it Postman Collection.

All the APIs we test and document are stored in Postman Collection format. Postman collection is a json format.

The current version is 2.1 and they have provided a converter to migrate from version v1 to v2

postman-collection-transformer convert \
    --input ./v1-collection.json \
    --input-version 1.0.0 \
    --output ./v2-collection.json 
    --output-version 2.0.0 \
    --pretty \
    --overwrite

No Swagger Export option in Postman

Postman doesn't allow the option to download the APIs into OpenAPI format AKA swagger specs. You can only download the APIs in postman collection format.

The Open API Standard

Swagger has graduated to become the Open API. Before Open API, different tools had their own format for describing APIs like raml, postman collections etc.

They have provided the reverse option of importing Open API into Postman collection and it makes sense as Postman should have the ability to import swagger specs generated by code.

Here Postman team explains how Postman has adopted the open standard. Storing postman collection in the form of Open API is the standard way of documenting your API.

What are your options?

Coming back to our question, how do we convert Postman Collections.

Top google results show API Transform. Now that is a paid service. Why pay for converting a format to an open standard (Open API)

On this stackoverflow question

The following options are listed.

  • API Matic - Note that the site requires an account to be created to use
  • Rest United - only free if one has <=5 endpoints per API and <=3 APIs.
  • API Spec Converter - Only works with postman V1

Solution

So we created an online postman collection to swagger converter.

You can paste the postman collection json into the editor and it will be converted to swagger (Open API 3.0) specification.

Tested this tool with slack postman collection

If you are looking for a command line utility, this project is the best ways to convert Postman collection to swagger.The command line tool allows to easily convert Postman Collections V2.0 JSON to Open API 3.0 yaml

p2o ./path/to/PostmantoCollection-2.json -f ./path/to/open-api-3.0.yml