Postman can ingest your OpenAPI (Swagger) specification and instantly generate a fully functional API collection.

Here’s a live example. Imagine you have this minimal OpenAPI 3.0 spec in a file named petstore.yaml:

openapi: 3.0.0
info:
  title: Petstore API
  version: 1.0.0
paths:
  /pets:
    get:
      summary: List all pets
      operationId: listPets
      responses:
        '200':
          description: A list of pets.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Pet'
    post:
      summary: Create a pet
      operationId: createPet
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewPet'
      responses:
        '201':
          description: Null response
  /pets/{petId}:
    get:
      summary: Info for a specific pet
      operationId: showPetById
      parameters:
        - name: petId
          in: path
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
components:
  schemas:
    Pet:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
    NewPet:
      type: object
      required:
        - name
      properties:
        name:
          type: string
        tag:
          type: string

To import this into Postman, you’d click the "Import" button in the sidebar, select "Link" or "File," and paste the URL to petstore.yaml or upload the file. Postman will then present you with an import summary. You can choose to import it as a collection, and Postman will automatically create folders for each API path (/pets, /pets/{petId}) and individual requests for each HTTP method (GET, POST).

Here’s what the generated collection might look like in Postman’s sidebar:

Petstore API (1.0.0)
  ├── GET /pets
  ├── POST /pets
  └── GET /pets/{petId}

Clicking into GET /pets, you’ll see a request configured with the correct URL (/pets), headers, and a pre-generated example response based on the 200 schema defined in your OpenAPI spec. For POST /pets, Postman will include a request body pre-populated with fields from the NewPet schema, like name and tag. The GET /pets/{petId} request will have a path parameter petId already set up, ready for you to input a value.

This isn’t just a static import; Postman analyzes your spec to understand the relationships between endpoints, the expected request bodies, and the possible responses. It uses this information to build a collection that’s immediately usable for testing, documentation, and collaboration. For instance, if your spec defines authentication methods (like API keys or OAuth 2.0), Postman will attempt to pre-configure those as well, prompting you for the necessary credentials.

The magic happens in Postman’s parsing engine, which translates the structured YAML or JSON of your OpenAPI spec into Postman’s internal collection format. It maps OpenAPI paths to collection folders and individual request methods. operationId fields are used as request names. Schemas defined in components/schemas are used to generate example request bodies and response structures, making the imported collection a living, interactive documentation of your API. Path and query parameters are automatically detected and added as variable placeholders within the request builder.

When Postman generates a collection from an OpenAPI spec, it doesn’t just copy endpoints; it understands the semantics of your API. For example, if your OpenAPI spec includes examples for a given schema, Postman will often import these as pre-defined Postman examples for that request. This means you don’t just get a runnable collection, but one that already demonstrates common use cases. This makes it incredibly efficient for developers to quickly understand and interact with an API without needing to read through extensive documentation separately.

The most powerful aspect is how Postman infers relationships and constraints. If you define a Pet schema with id as a required integer, Postman will ensure the GET /pets/{petId} request has a path parameter petId set to an integer type, and it will warn you if you try to input a non-numeric value. Similarly, for the POST /pets request, the requestBody will be structured according to the NewPet schema, including fields like name and tag, and Postman will flag missing required fields.

The next step after importing is to explore the generated collection’s environment variables, particularly those related to base URLs and authentication, to ensure your requests are directed to the correct server and authorized properly.

Want structured learning?

Take the full Swagger course →