Postman to OpenAPI
Convert a Postman collection into an OpenAPI 3.0 spec.
Related Tools
Convert an OpenAPI 3.0 spec into a Postman collection.
Validate JSON against a JSON Schema with JSON-pointer error paths.
Convert a cURL command into a Python requests call.
Convert a cURL command into a Go net/http request.
Convert a cURL command into a Node.js fetch call.
Convert a cURL command into a PHP curl_setopt call.
Documentation
What is Postman to OpenAPI?
This tool converts an exported Postman Collection (v2.x JSON) into an OpenAPI 3.0.3 document, output as either YAML or JSON via a toggle in the toolbar. It infers each operation's parameters and request body schema directly from the recorded requests, giving you a starting spec without writing OpenAPI YAML from scratch.
How it works
The collection's item tree is flattened recursively — folders are walked into so nested requests aren't skipped. For each request, the URL is split into a path and query string (handling both the raw-string and structured { path, query } URL forms), Postman's :id colon path variables become OpenAPI's {id} syntax, and a matching in: path, required: true parameter is added. Query params and non-auth headers become in: query / in: header parameters with their captured value as an example. If the request has a raw JSON body, it's parsed and walked recursively to infer a schema — objects become type: object with per-property schemas, arrays infer their item type from the first element, and strings/numbers/booleans map to the matching OpenAPI type with the value kept as example. Toggling the format button re-runs the same conversion and serializes with either js-yaml's dump() or JSON.stringify.
Features
- Recursively flattens requests nested in Postman folders
- Converts :id path variables to OpenAPI's {id} syntax with matching parameters
- Infers a JSON request body schema from the recorded raw body sample
- Output toggle between YAML and JSON
- Copy, download as openapi.yaml/.json, or load a collection file directly
Example
Input (Postman request): GET {{baseUrl}}/users/:id with header Authorization: Bearer {{token}}.
Output (YAML format):
paths:
/users/{id}:
get:
summary: Get user
parameters:
- name: id
in: path
required: true
schema:
type: string
- name: Authorization
in: header
required: false
schema:
type: string
example: 'Bearer {{token}}'
responses:
'200':
description: OKCommon errors
"Not a Postman collection — expected a top-level item array" means the pasted JSON doesn't have the item array every Postman collection export has — check you exported the collection itself, not an environment or a single request. Because the body schema is inferred from one recorded example rather than a formal contract, generated types are a best guess — always review required fields, enums, and nullability by hand afterward.
Best practices
Capture requests in Postman with realistic example values and a real JSON body before converting — richer captured data produces a more useful inferred schema. Since {{baseUrl}} and other environment variables in the URL host are stripped rather than mapped to OpenAPI's servers, add the real server URL to the generated spec manually.
Frequently Asked Questions
Does this handle folders inside the collection?▾
Yes — Postman collections can nest requests inside folders for organization; this tool walks the whole tree recursively and flattens every request into the OpenAPI spec's paths, regardless of how deeply it was nested in folders.
How are Postman path variables (:id) converted?▾
To OpenAPI's {id} curly-brace syntax, with a matching path parameter (in: path, required: true) added automatically to the operation.
How is the request body schema generated?▾
From the raw JSON body sample in the Postman request — each field's inferred type (string/number/boolean/object/array) becomes the corresponding OpenAPI schema type. This is inferred from one example, not a formal contract, so double-check the generated schema against your API's actual constraints (required fields, enums, etc.).
What happens to {{variables}} like {{baseUrl}}?▾
Postman environment variables in the URL host are stripped out, since OpenAPI represents the base URL via a separate servers field rather than inline in each path. Variables used elsewhere (e.g. in headers) are passed through as literal example values.