What you can do with OpenAPI & Swagger to Postman Collection Generator
- Convert swagger to postman collection
- Export openapi to postman
How this developer utility works
Convert OpenAPI 3.0/3.1 or Swagger 2.0 JSON/YAML specifications into Postman Collection v2.1, Postman Environment, and cURL output.
Example input
{"openapi":"3.0.0","info":{"title":"User API","version":"1.0.0"},"paths":{"/users":{"get":{"summary":"List users"}}}}Example output
{"info":{"name":"User API","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"item":[{"name":"List users","request":{"method":"GET","url":"{{baseUrl}}/users"}}]}Practical workflow
- Paste an OpenAPI or Swagger specification in JSON or YAML format; the sample starts with a fictional API at api.example.com.
- Review the generated Postman Collection v2.1. Operations are grouped under their first tag, or under General when no tag is present.
- Select the Postman Environment tab for the first server URL, or Batch cURL for shell commands using the specification's server URL.
- Copy the current output or download the collection or environment JSON, then inspect and configure it in Postman before sending requests.
Common use cases
- Converting newly written OpenAPI specifications into runnable Postman workspaces for QA teams.
- Migrating legacy Swagger 2.0 definitions into modern Postman Collection v2.1 format.
- Creating a Postman starting collection from an existing API contract without sending the specification to a service.
Important notes and limitations
- The converter handles GET, POST, PUT, PATCH, and DELETE operations, query parameters, path placeholders, and JSON request bodies. It uses only the first server URL.
- It does not interpret OpenAPI security schemes or add Authorization headers. Configure authentication after import; cURL path placeholders such as :userId must be replaced before running.
OpenAPI & Swagger CLI conversion tools
CLI convert OpenAPI 3.0 spec to Postman collection v2.1
npx --yes openapi-to-postmanv2 -s openapi.yaml -o postman_collection.json -pConverts OpenAPI YAML specification into a structured Postman collection with request bodies and headers.
Validate OpenAPI specification syntax with spectral
npx --yes @stoplight/spectral-cli lint openapi.yamlLints OpenAPI specifications for schema syntax errors, missing parameter descriptions, and broken refs.
Convert Swagger 2.0 to OpenAPI 3.0 via swagger2openapi
npx --yes swagger2openapi --yaml swagger.json -o openapi3.yamlUpgrades legacy Swagger 2.0 JSON definitions to modern OpenAPI 3.0 YAML specifications.
API Specification Formats & Postman Schema Comparison
| Specification Format | Version | Primary Schema Syntax | Postman Collection Compatibility | Key Advantage |
|---|---|---|---|---|
| OpenAPI 3.1 | 3.1.0 | Full JSON Schema 2020-12 alignment | Supported via Postman Collection v2.1 import | Native union types and full JSON Schema keyword compatibility |
| OpenAPI 3.0 | 3.0.3 | Extended subset of JSON Schema draft-04 | 100% native Postman collection import | Broadest tooling support across code generators and API gateways |
| Swagger 2.0 | 2.0 (Legacy) | Swagger JSON Schema dialect | Legacy support | Historical legacy format, missing components/requestBodies |
| Postman Collection | v2.1.0 | Postman proprietary JSON execution schema | Native execution environment | Pre-request scripts, environment variables, Newman CLI automation |
OpenAPI to Postman schema conversion troubleshooting
Circular $ref detected / conversion terminates unexpectedly
Cause: Schema definitions reference themselves (e.g. Tree Node containing children: [Node]), causing infinite loops during generation.
Solution: Enable schema resolution limits in converter settings or limit recursion depth to 2 levels.
Missing base URL / collection requests default to {{baseUrl}} without value
Cause: The OpenAPI specification lacks a 'servers' array (e.g. servers: [{ url: 'https://api.example.com' }]).
Solution: Add a valid server URL under the 'servers:' key in OpenAPI or define {{baseUrl}} in Postman collection variables.
Request body examples rendered as empty or null
Cause: OpenAPI schema defines types without providing 'example' or 'default' properties for model fields.
Solution: Add 'example: "sample-value"' to your OpenAPI property definitions so Postman can populate mock payloads.
Continue your workflow
- API Request Tester — Execute and test individual HTTP requests defined in your OpenAPI specification.
- cURL to Code — Convert cURL commands generated from OpenAPI schemas into multi-language snippets.
- JSON Schema Validator — Validate request and response JSON payloads against OpenAPI schema definitions.
- Mock API Generator — Generate realistic mock data payloads matching your OpenAPI model schemas.
Frequently asked questions
Does this converter support both Swagger 2.0 and OpenAPI 3.1?
Yes. The parser recognizes both legacy Swagger 2.0 documents and modern OpenAPI 3.0 / 3.1 specifications in either JSON or YAML format.
Does the converter read security schemes or add authentication tokens?
No. It does not interpret security schemes and does not add Authorization headers. Configure authentication in Postman after import, and keep real credentials out of shared specifications.
How are the generated Postman requests grouped?
Each operation is placed under its first OpenAPI tag. Operations without a tag are placed in a General folder; the tool does not offer a path-based grouping control.