A command-line tool for bidirectional conversion between Postman collections and OpenAPI specifications.
Modern API development often starts with Postman collections, but the broader API ecosystem — documentation systems, gateways, code generators, and CI/CD pipelines — largely revolves around OpenAPI specifications.
Postman introduced a Git integration mode where collections are stored as a structured YAML directory tree instead of a single exported JSON file. This improves version control and diffability, but it also makes it harder to integrate with the rest of the API tooling ecosystem.
p2oa solves that problem.
It acts as a bridge between Postman and OpenAPI workflows, allowing developers to convert collections in either direction and integrate Postman‑based API design into automated pipelines.
- Convert Postman JSON collections → OpenAPI YAML
- Convert Postman JSON → Postman Git YAML structure
- Convert Postman Git repositories → Postman JSON collections
- Supports Postman v2.0 and v2.1 collections
- Generates OpenAPI 3.1 by default
- CLI‑friendly for automation and CI/CD pipelines
Convert a Postman collection into an OpenAPI specification:
p2oa to-openapi -i collection.json -o openapi.yamlPipe the output directly into another tool:
p2oa to-openapi -i collection.json | openapi-generator generate \
-g typescript-fetch \
-i /dev/stdin \
-o ./client- Portable Version: Download
p2oa-portable.zip, extract it, and runp2oa.exe. No installation required. - Installer Version: Download
p2oa-installer.zip, extract it, and run the installer for a full installation.
Releases are attested using GitHub's build provenance attestation, providing verifiable proof of the build process and source code integrity. This ensures that downloaded artifacts are authentic and have not been tampered with.
To verify the attestation of a downloaded artifact, you can use the GitHub CLI (gh):
-
Install the GitHub CLI from cli.github.com.
-
Run the following command, replacing
<artifact>with the downloaded file (e.g.,p2oa-portable.zip):gh attestation verify <artifact> --repo PaulStSmith/PostmanOpenAPIConverter
Example:
gh attestation verify p2oa-portable.zip --repo PaulStSmith/PostmanOpenAPIConverter
If the verification succeeds, it confirms the artifact was built from the specified repository and has not been modified.
Convert a Postman collection JSON → OpenAPI YAML.
p2oa to-openapi -i <collection.json> [-o <output.yaml>] [-v <version>]
| Option | Short | Description |
|---|---|---|
| --input | -i | Postman collection JSON file (required) |
| --output | -o | Output file path (default: stdout) |
| --openapi-version | -v | OpenAPI version: 3.1 (default), 3.0, 3.2, or 2.0 |
Print OpenAPI output to stdout:
p2oa to-openapi -i collection.jsonWrite OpenAPI to a file:
p2oa to-openapi -i collection.json -o openapi.yamlTarget a specific OpenAPI version:
p2oa to-openapi -i collection.json -o openapi.yaml -v 2.0Convert a Postman JSON export → Postman Git repository format.
p2oa to-postman-git -i <collection.json> -o <output-directory>
| Option | Short | Description |
|---|---|---|
| --input | -i | Postman collection JSON file |
| --output | -o | Output directory |
p2oa to-postman-git -i collection.json -o ./repoExample output structure:
repo/
.postman/
resources.yaml
postman/
globals/
workspace.globals.yaml
collections/
My API/
.resources/
definition.yaml
Users/
.resources/
definition.yaml
List Users.request.yaml
Get User.request.yaml
Create User.request.yaml
Health Check.request.yaml
Convert a Postman Git YAML repository → Postman JSON collection.
p2oa from-postman-git -i <directory> [-o <output.json>] [-c <collection-name>]
| Option | Short | Description |
|---|---|---|
| --input | -i | Repository root or collection directory |
| --output | -o | Output JSON file (default: stdout) |
| --collection | -c | Collection name if multiple collections exist |
Auto-detect collection:
p2oa from-postman-git -i ./repo -o collection.jsonConvert specific collection:
p2oa from-postman-git -i ./repo/postman/collections/My\ API -o collection.json| Postman Concept | OpenAPI Output |
|---|---|
| Collection name | info.title |
| Collection description | info.description |
| Folder name | Tag |
| {{baseUrl}} variable | Server URL |
| :param or {{param}} | Path parameter |
| Query parameters | in: query parameters |
| Request body | requestBody |
| Request description | Operation description |
Content type is determined using the following priority order:
- Explicit
Content-Typerequest header - Postman body language option
- Body content inspection
- Default fallback:
application/json
Running:
to-postman-git → from-postman-git
produces a Postman collection equivalent to the original.
Preserved data includes:
- Collection metadata
- Folder hierarchy
- Request method and URL
- Headers and query parameters
- Request bodies
- Authentication configuration
- Pre-request scripts
- Test scripts
- Item ordering
The repository includes a working example API.
Examples/
Postman/
task-manager-api.json
OpenAPI/
task-manager-api.yaml
GIT/
postman/
This example demonstrates:
- folders
- path parameters
- query parameters
- JSON request bodies
- base URL variables
Current limitations include:
- Request body schemas are exported as generic
type: object - Example responses are not converted into OpenAPI response definitions
- Authentication settings are preserved internally but not yet mapped to OpenAPI
securitySchemes
These areas may be expanded in future releases.
Requirements:
.NET 10 SDK
Clone the repository:
git clone https://github.com/your-username/PostmanToOpenAPI.git
cd PostmanToOpenAPIRun directly:
dotnet run --project PostmanOpenAPIConverter -- to-openapi -i collection.jsonBuild a standalone executable:
dotnet publish PostmanOpenAPIConverter \
-c Release \
-r win-x64 \
--self-containedMIT License
