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.
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
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.
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.
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.
The project by Joolfe is one of the best ways to convert Postman to swagger
I have personally tested the code and found it most effective for converting to Open API.
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