Generate an API specification from your collection

You can generate an OpenAPI 3.0 specification from a collection in Spec Hub. Generated specifications enable you to complete the API lifecycle by integrating your API with downstream systems, such as API gateways or security scanners. 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

Syncing isn’t available for collections generated from AsyncAPI specifications.

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 or specification, such as by adding a new request, Postman alerts you that the generated specification isn’t in sync with the collection.

Postman doesn’t delete elements from a collection when you sync it with the specification. For example, if you change the name of an existing path in your specification, Postman creates a new path in your collection when it’s updated. The existing path still exists with the previous name in your generated collection, and you can choose to delete the path.

Sync changes to a specification

Syncing collections to multi-file OpenAPI specifications isn’t supported.

To sync changes made in a generated collection to your OpenAPI specification, do the following:

  1. Click Collection icon Collections, then select the collection you want to sync.
  2. In the collection’s Overview tab, navigate to Specifications. An orange dot next to Specifications indicates that the collection isn’t in sync with the specification.
  3. Click the Down Large icon arrow next to Specifications, then click Update to update the generated specification.

Update a generated specification

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

Sync changes to a collection

To sync changes made in an OpenAPI specification to a generated collection, do the following:

  1. Click Docs icon Specs in the sidebar and select an OpenAPI 3.0 specification.

    An orange dot on the Down Large icon arrow next to New collection icon Generate Collection indicates one or more collections aren’t in sync with the specification.

  2. Click the Down Large icon arrow next to New collection icon Generate Collection.

  3. Click Update next to the generated collection you want to update.

Last modified: 2025/10/15