> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Generate collections from your API specification

You can [generate a collection from a specification](#generate-collections-from-a-specification) to share it with your team members and consumers. With the generated collection, they can test your API or explore its capabilities. You can also [keep a collection in sync](#keep-collections-in-sync-with-an-openapi-specification) with its specification if it was generated from an OpenAPI 2.0, 3.0, or 3.1 specification.

To learn more about generating and syncing collections, see [Sync collections and specifications reference](/docs/design-apis/sync-specifications-reference/).

## Generate collections from a specification

You can generate a [Postman Collection](/docs/use/use-collections/overview/) from your OpenAPI, AsyncAPI, and Smithy [specifications](/docs/design-apis/specifications/overview#supported-specification-formats) that use the WebSocket protocol. Postman automatically creates a collection with folders, requests, and response examples based on the specification. You can generate more than one collection from the same specification.

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

1. Expand **Specs** in the sidebar, then select a supported specification.

2. In the workbench, click <img alt="New collection icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/action-newCollection-stroke.svg#icon" width="20px" /> **Generate Collection** in the upper right. You can also click <img alt="Options icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/action-options-stroke.svg#icon" width="20px" /> **More actions** next to the specification and then select **Generate Collection**.

   ![Generate a collection from a specification](https://assets.postman.com/postman-docs/v12/specs-generate-collection-v12-03.png)

3. Enter a name for your collection.

4. (OpenAPI specifications only) Change any settings to customize the new collection:

   * **Naming requests** — Determines how request names in the generated collection. Select **Fallback** (default) to name the requests based on the `summary`, `operationId`, `description`, or `url` schema values. Select **URL** to name the requests based on the path parameter.

   * **Folder organization** — Choose whether to create folders based on the specification's **Paths** (default) or **Tags**.

   * **Nested folder organization using tags** — If you created folders based on the specification's tags, turn this on to create a nested folder structure based on the order of tags used to group operations.

   * **Set indent character** — Set character indentation to **Space** (default) or **Tab**.

   * **Include auth info in example requests** — Turn this on to include authentication parameters from example requests.

   * **Enable optional parameters** — Turn this on to enable optional parameters in the generated collection and its requests.

   * **Keep implicit headers** — Turn this on to include implicit headers in the generated collection and its requests. This is turned off by default.

   * **Include deprecated properties** — Turn this on to include deprecated operations, parameters, and properties in the generated collection.

   * **Always inherit authentication** — Turn this on to include authentication details in every request and inherit authentication details from the parent collection. This is turned off by default.

   The **Parameter generation** setting is deprecated. Generated collections will use examples for parameter generation by default. Any existing collections generated using the schema parameter generation will continue to sync using their existing strategy.

5. Click **Generate collection**.

To view the generated collection, click <img alt="New collection icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/action-newCollection-stroke.svg#icon" width="20px" /> **Collections**, then click the generated collection's name. You can also click **Collections** in the sidebar to navigate to your generated collection.

## Keep collections in sync with an OpenAPI specification

Syncing isn't available for collections generated from AsyncAPI or Smithy specifications.

When you [generate a collection](#generate-collections-from-a-specification) from your OpenAPI specifications, Postman creates a collection with requests that match what's defined in the specification. If you update the collection or specification, such as by adding a new request or path, Postman alerts you that the generated collection isn't in sync with the specification.

By default, Postman doesn't delete elements from a generated collection when you sync it with the specification. If you enable the **Remove orphan requests** [setting](#sync-settings), requests that don't match any endpoints in the specification are deleted during sync. For example, if you rename an existing path in your specification, Postman creates a new request in your collection for the renamed path. The request for the previous path remains unless the **Remove orphan requests** setting is enabled.

### Sync changes to a collection

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

1. Expand **Specs** in the sidebar, then select an OpenAPI specification.
2. In the workbench, click <img alt="Warning icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/state-warning-stroke.svg#icon" width="20px" /> **Update Collection** in the upper right.
3. Click **Update** next to the generated collection.

### Sync changes to a specification

Syncing collections to [multi-file OpenAPI specifications](/docs/design-apis/specifications/add-files-to-a-specification/) isn't supported.

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

1. Expand **Collections** in the sidebar, then select the collection you want to sync.
2. In the collection's **Overview** tab, click <img alt="Update icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/action-update-stroke.svg#icon" width="20px" /> **Sync specification**.

![Update a specification from a collection](https://assets.postman.com/postman-docs/v12/collection-sync-specification-12-02.png)

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

## Configure sync settings

You can configure settings that enable you to customize the syncing behavior between collections and OpenAPI specifications.

To configure sync settings, do the following:

1. Expand **Specs** in the sidebar and select an OpenAPI specification with a generated collection.
2. In the workbench, click <img alt="New collection icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/action-newCollection-stroke.svg#icon" width="20px" /> **Collections** in the upper right.
3. Click <img alt="Setting icon" src="https://assets.postman.com/postman-docs/aether-icons/v12/descriptive-setting-stroke.svg#icon" width="20px" /> **Configure update settings** next to a collection.
4. [Configure sync settings](#sync-settings) between the collection and specification.
5. Click **Save**.

You can also [configure sync settings](/docs/design-apis/collections/generate-specifications/#configure-sync-settings) from a collection.

### Sync settings

You can configure the following sync settings between collections and OpenAPI specifications:

* **Sync example values between Spec and Collection** — Turn this on to keep examples in the specification and values in the collection in sync.
* **Remove orphan requests** — When enabled, requests that don't match any endpoints in the specification are deleted from the collection during sync to match the updated specification.