> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/examples/extract-list.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# Export a list of tags for feature flags and segments

Learn how to extract a list of tags associated with feature flags and segments using the Admin API.

## Overview <a href="#overview" id="overview"></a>

Use this script to extract a list of tags associated with feature flags and segments.

## Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* Install the [Python Admin API Wrapper](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/wrappers/python-admin-api.md).
* You have created an Admin API key from the Harness FME UI.
* Make sure you have the tag name associated with your feature flags and segments.

## Configuration <a href="#configuration" id="configuration"></a>

Before running the script, update the following variables in the code:

* `ADMIN API KEY`: Your Admin API key.

Run this script using Python 3 from your local machine or preferred development environment.

```python
from splitapiclient.main import get_client

client = get_client({'apikey': 'ADMIN API KEY'})
print('workspace, split, segment, tag')
for ws in client.workspaces.list():
    for split in client.splits.list(ws.id):
        if split._tags is None:
            continue
        for tag in split._tags:
            print(ws.name+","+split._name+",,"+tag['name'])
    for segment in client.segments.list(ws.id):
        if segment._tags is None:
            continue
        for tag in segment._tags:
            print(ws.name+","+segment._name+",,"+tag['name'])
```

## Next steps

* Go to [Export all feature flags that have not received impressions from a specific date](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/examples/export-flags.md) to find flags that have not received impressions.
* Go to [Get a list of feature flags with rollout status](https://developer.harness.io/feature-management-experimentation/management-and-administration/api-best-practices/examples/get-list.md) to list flags with their rollout status.

{% @harness-feedback/feedback %}
