# Manage element tags programmatically in Postman with the Postman API

**URL:** <https://community.postman.com/t/manage-element-tags-programmatically-in-postman-with-the-postman-api/76984>\
**Category:** Learning Lab\
**Tags:** tutorial, postman-api, tags\
**Created:** [March 17, 2025, 3:01pm UTC](https://community.postman.com/t/manage-element-tags-programmatically-in-postman-with-the-postman-api/76984 "2025-03-17T15:01:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![david-espi-hernandez](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/david-espi-hernandez/32/25537_2.png) [@david-espi-hernandez](https://community.postman.com/u/david-espi-hernandez)\
**Post date:** [March 17, 2025, 3:01pm UTC](https://community.postman.com/t/manage-element-tags-programmatically-in-postman-with-the-postman-api/76984/1 "2025-03-17T15:01:00Z")

</div>

Postman [Enterprise](https://www.postman.com/pricing/) users can add tags 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). You can use tags to improve organization, collaboration, documentation, discoverability, and productivity.

You can manually manage element tags in Postman, but did you know that you can do it programmatically with the [Postman API](https://api.postman.com)? With the API, you can manage your [collection](https://www.postman.com/postman/postman-public-workspace/folder/dok5dr4/tags), [API](https://www.postman.com/postman/postman-public-workspace/folder/ub1vm7a/tags), and [workspace tags](https://www.postman.com/postman/postman-public-workspace/folder/u064piq/tags). You can also [search for elements by tag](https://www.postman.com/postman/workspace/postman-public-workspace/request/12959542-37ee816c-1fa4-4f04-9a1a-e5c810931498). This endpoint’s 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 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.
- Get all APIs containing the under-review tag and send them to a Slack channel.
- Automate clean up tasks. With the Postman API you can delete all elements (workspaces, APIs, and collections) that contain a specific tag, like to-delete.
- If a monitor fails, mark its collection with a tag so it’s easily found.
- … and more!

## 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 [GET](https://www.postman.com/postman/postman-public-workspace/request/0o5vgfj/get-elements-by-tag) `/tags/{slugId}/entities` endpoint, then uses the DELETE endpoints for [workspaces](https://www.postman.com/postman/postman-public-workspace/request/ch49fs2/delete-a-workspace), [collections](https://www.postman.com/postman/postman-public-workspace/request/nhrbi86/delete-a-collection), and [APIs](https://www.postman.com/postman/postman-public-workspace/request/uz2bu10/delete-an-api). Basically, it gets all elements containing the tag, then[iterates](https://learning.postman.com/docs/collections/running-collections/building-workflows/) on deleting collections, APIs, and workspaces in different requests in the collection:

 ![The workflow of the Delete Postman Elements by Tag collection](https://us1.discourse-cdn.com/getpostman/original/3X/c/9/c9345d2a13c140b80f21acedf0f2f7fc817d3533.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, then run the collection:

![The Variables tab](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdneUtUltVA8iYRQqMslLULBT6Ovl2u2eTwDI3V5MrrUHjqT003vy6xmI00dYOCxyBqXo6_RzOK6IAoi06MUle48hTkJQmi6RZkP8i3yZmqNocVlawkNC2tWtJycQJdcOYsv-QQZA?key=UL5gpBAaCeiavV-SC0oDyg)

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 completed collection run display results](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdURr54KJhDtTsjidoJP62VVFve8D2-lwZU79_-2JBH7ugRVOwWkNGgE5EMQPuhidacg6_Qv7kdWM36g17MhS8Pc0j4RXK0xvwE39GKqeo0XdLJq1jGIgVIWWKz1SQWzOlP07ytiPGoJaffTc9yobljv2US?key=UL5gpBAaCeiavV-SC0oDyg)

## 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 add value to your development process. Do you have a specific use case? How would you use the Postman API in your development process to tag your elements and work with these tags? Let us know about your use cases!
