Your API in Postman can include more than an API definition. You can add elements such as collections to help you document and test your API.
When you add a collection, an independent copy of the collection is added to the API. The copy in the API will no longer be in sync with the original. If you move or delete an API, any collections contained in the API are moved or deleted with it.
Add a collection to document your API or help others test your API's endpoints. You can add an existing collection or generate a new collection from your API definition.
You can also add a test suite to your API. Learn more about testing an API.
To copy an existing collection to your API, do the following:
The copy of the collection displays on your API's overview and under your API in the sidebar. To view documentation for the collection, select the collection and select View complete documentation.
To generate a new collection from your API definition, do the following:
The collection displays on your API's overview and under your API in the sidebar. To view documentation for the collection, select the collection and select View complete documentation.
You can also generate a collection when you import an API. For more information, see importing an API.
To add a new collection to your API, do the following:
When you generate a new collection from your API definition, Postman creates a collection with requests that match what's defined in the API. If you update the API definition, for example by adding a path, those changes won't be reflected in the generated collection.
In this case, you could repeat the process of generating a collection from the API definition. However, this new collection wouldn't include any changes you might have made to the first collection you generated. For example, you might have added documentation content or endpoints for test setup that you want to keep. Instead, Postman can offer suggestions for updating the collection based on the changes to the API definition.
Collection update suggestions are supported for OpenAPI 3.0 and 3.1 definitions.
You can enable update suggestions for any collection that's been added to an API. When suggestions are enabled, Postman will detect when there are differences between the API definition and the collection and will offer suggestions for updating the collection.
To enable update suggestions for your collection, do the following:
If you want to turn off suggestions, select the more actions icon next to a collection and select Disable update suggestions from definition.
When suggestions are enabled, the update collection icon appears next to a collection if Postman detects differences between the collection and the API definition. Differences can occur if the API definition is changed, for example by adding, removing, or modifying endpoints. Differences can also occur if requests are added, removed, or modified in the collection. You can review the differences and, if you choose, update the collection with the suggested changes.
To update your collection based on your API definition, do the following:
Select the update collection icon next to the collection on the API's overview.
Review the suggested updates to the collection:
When you're ready to make the suggested updates to the collection, select Update Collection.
The table below lists changes you can make to API definitions, and it notes which changes will result in a suggestion if collection update suggestions are enabled.
Change | Suggestion |
---|---|
Add an endpoint | Yes |
Remove an endpoint | Yes |
Remove a path parameter | No |
Add a required query parameter to an endpoint | Yes |
Add a required property to the request body | Yes |
Change the data type of a request body property | Yes |
Update the request summary | Yes |
Update the request description | No |
Add an example response | Yes |
Remove an example response | Yes |
Collections added to an API can't be used with monitors, mock servers, or CI integrations. To use a collection in an API with these features, you must fork the collection.
To fork a collection from your API, do the following:
Learn more about forking elements in Postman.
To delete a collection from your API, do the following:
You can also delete a collection from the API's overview. Select the more actions icon next to a collection and select Delete.
Last modified: 2024/09/04
Additional resources
Videos
Blog posts