Generate an API specification from your collection

You can generate an OpenAPI 3.0 specification from a collection. The generated specification is created in Spec Hub. You can use a generated specification to integrate your API with downstream systems, such as API gateways or security scanners, to complete the API lifecycle. You can also keep the specification in sync with its collection.

Add types to parameters and headers and body data that describe your APIs. This way Postman can generate a complete OpenAPI 3.0 specification in Spec Hub. Learn more about types in collections.

Generate OpenAPI specifications from a collection

You can generate an OpenAPI 3.0 specification from your collection. Postman automatically creates a specification with paths, components, and more based on your collection. The specification will also have types associated with parameters, headers, and body data if types are defined in the collection.

To generate a specification from a collection, do the following:

  1. Click Collection icon Collections in the sidebar.
  2. Click Options icon View more actions next to a collection, then select More > Generate Specification.
  3. Enter a name for the specification.
  4. Select YAML or JSON as the file format in the generated specification.
  5. Click Generate Specification.

To view the generated specification, open the collection’s overview, and then click the specification’s name under Specification. You can also click Docs icon Specs in the sidebar and select the specification.

Your Postman plan gives you a limited number of specifications in your team’s internal workspaces. Learn more about resource usage in Postman.

You can only generate one API specification from the same collection. To generate a new specification from the collection, delete the generated specification from Spec Hub.

Keep OpenAPI specifications in sync with a collection

When you generate an OpenAPI 3.0 specification from a collection, Postman creates a specification that matches the requests in the collection. If you update the collection, such as creating a new request, Postman alerts you that the generated specification isn’t in sync with the collection.

To update a generated specification, do the following:

  1. Click Collection icon Collections in the sidebar and select a collection.

    An orange dot next to Specification in the collection’s overview indicates the specification isn’t in sync with the collection.

  2. Click Specification.

  3. Click Update to update the specification.

Update a generated specification

Updates to the source collection may overwrite changes made directly to the generated specification. To avoid this, it’s recommended that you only update the source collection and then follow the steps to sync it with the generated specification.

Changes to vendor extensions, operations, and requests made directly to the generated specification won’t be overwritten by the source collection.

Last modified: 2025/04/01