# Manage element tags programmatically with the Postman API

Postman [Enterprise](https://www.postman.com/pricing/) users can now add [tags](https://blog.postman.com/introducing-tags-the-new-way-to-navigate-in-postman/) to [collections](https://learning.postman.com/docs/collections/using-collections/#tagging-a-collection), [workspaces](https://learning.postman.com/docs/collaborating-in-postman/using-workspaces/managing-workspaces/#tagging-a-workspace), and [APIs](https://learning.postman.com/docs/designing-and-developing-your-api/managing-apis/#tagging-apis). Tags help improve organization, collaboration, documentation, [discoverability](https://blog.postman.com/how-to-improve-api-discoverability-with-postman-workspaces/), and productivity. You can manually manage element tags in Postman, but did you know that you can also do it programmatically with the [Postman API](https://www.postman.com/postman/workspace/postman-public-workspace/documentation/12959542-c8142d51-e97c-46b6-bd77-52bb66712c9a)? We’ve recently exposed the following tag-related endpoints:

- [**Collection tags**](https://www.postman.com/postman/workspace/postman-public-workspace/folder/12959542-ac30eddb-71e9-4cc6-9ee5-d60da94db381): Manage your collection’s tags with the `/collections/:collectionId/tags` endpoint.
- [**API tags**](https://www.postman.com/postman/workspace/postman-public-workspace/folder/12959542-e1b6fb3b-7221-40e8-83f8-b9ef970dbd6f): Manage API tags with the `/apis/:apiId/tags` endpoint.
- [**Workspace tags**](https://www.postman.com/postman/workspace/postman-public-workspace/folder/12959542-2581bf7a-36b8-4f09-8d2d-dbbaeb0c25bb): Manage workspace tags with the `/workspaces/:workspaceId/tags` endpoint.
- [**Search for elements by tag**](https://www.postman.com/postman/workspace/postman-public-workspace/request/12959542-37ee816c-1fa4-4f04-9a1a-e5c810931498): Search by tag across all of your Postman elements with the `/tags/:slug/entities` endpoint. The response contains a paginated list of elements with the given tag. We use [cursor](https://jsonapi.org/profiles/ethanresnick/cursor-pagination/) pagination on this endpoint, and you can also filter your search by workspace, collection, or API.
 
 With these new endpoints, you can: - Add an *under-review* tag to an API when you create a new version with the Postman API. You can then share this tag with your stakeholders so they can easily filter elements that contain that tag: ![Filtered search results by tags in Postman.](https://blog.postman.com/wp-content/uploads/2023/10/2136-filter-tag-results-300x166.jpg)
- Get all APIs that contain the *under-review* tag and send them to a Slack channel.
- Automate cleanup tasks. For instance, you can delete all elements (i.e., workspaces, APIs, and collections) that contain a specific tag, like *to-delete*.
- If a monitor fails, mark its collection with a tag so it can be easily found.
 
## A collection that deletes elements with a specific tag

 We’ve created a [**Delete Postman Elements by Tag**](https://www.postman.com/postman/workspace/postman-public-workspace/collection/16473433-f2898904-8629-4fef-b0ef-26420d89470b) collection that deletes any collections, APIs, and workspaces that contain a given tag. The collection uses the [**Search elements by tag**](https://www.postman.com/postman/workspace/postman-public-workspace/request/12959542-37ee816c-1fa4-4f04-9a1a-e5c810931498) endpoint—and then uses the DELETE endpoints for workspaces, collections, and APIs. Basically, it gets all elements containing the tag, then [iterates](https://learning.postman.com/docs/collections/running-collections/building-workflows/) on deleting all of collections, APIs, and workspaces that contain that tag: ![A diagram of the "Delete Postman Elements by Tags" workflow](https://blog.postman.com/wp-content/uploads/2023/10/2136-delete-tagged-entities-flow-50x300.png) To delete all elements with a specific tag, open the collection’s **Variables** tab, enable the *tag* variable and provide the tag you want to use, and run the collection: ![The "Variables" tab in Postman displaying the enabled "tag" variable](https://blog.postman.com/wp-content/uploads/2023/10/2136-variables-tab-300x67.jpg) The collection run results will display. If the collection finds an element with the given tag (like the *delete* tag), you’ll see that the collection deleted the elements that had the given tag: ![The collection run results in Postman displaying the collection's deleted elements](https://blog.postman.com/wp-content/uploads/2023/10/2136-tag-collection-run-results-300x116.jpg)## How are you using tags in Postman?

 This is just one example of how you can automate your tag management with the Postman API and streamline your development process. Do you have a specific use case? How would you use the Postman API to tag your elements and work with these tags? Let us know in the comments!