> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up resource tags

> Create and manage resource tags to organize projects, datasets, prompts, and other resources within a LangSmith workspace.

<Info>
  Resource tags are available for [Plus and Enterprise plans](/langsmith/pricing-plans).
</Info>

While [workspaces](/langsmith/administration-overview#workspaces) help separate trust boundaries and access control, tags help you organize resources within a workspace. Tags are key-value pairs that you can attach to resources.

<Note>
  **Not to be confused with commit tags**: Resource tags are key-value pairs used to organize and filter workspace resources (projects, datasets, prompts, etc.). [Commit tags](/langsmith/manage-prompts#commit-tags) are labels that reference specific versions in a prompt's commit history. While both types of tags can use similar terminology (like `prod` or `staging`), resource tags help you *organize resources* across your workspace, while commit tags control *which version* of a prompt is used in your code.
</Note>

You can manage resource tags through the [LangSmith UI](https://smith.langchain.com?utm_source=docs\&utm_medium=cta\&utm_campaign=langsmith-signup\&utm_content=langsmith-set-up-resource-tags) or programmatically via the [REST API](https://api.smith.langchain.com/redoc):

<Tabs>
  <Tab title="UI" icon="browser">
    ## Create a tag

    <Note>
      To create resource tags, you must have the [`workspaces:manage` permission](/langsmith/organization-workspace-operations) (granted to the [workspace admin](/langsmith/rbac#workspace-admin) role by default). Editors can apply **Application** tags to resources they have update access to, but creating tag keys or applying other tag types requires this permission. For more on applying tags to resources, refer to the workspace operations [Tags section](/langsmith/organization-workspace-operations#tags).
    </Note>

    To create a tag:

    1. Navigate to the workspace **Settings** page and click on **Resource tags** in the left-hand sidebar.
    2. Here, you'll find the existing tag values, grouped by key. LangSmith creates the **Application** and **Environment** keys by default. You can use the **Application** key to filter resources shown in the UI.
    3. Select <Icon icon="tag" /> **New Tag** at the top of the page. You'll be prompted to enter a key and a value for the tag. Note that you can use an existing key or create a new one.

           <img className="block dark:hidden" src="https://mintcdn.com/langchain-5e9cc07a/86CKyoiUyLIrfcjr/langsmith/images/create-tag-light.png?fit=max&auto=format&n=86CKyoiUyLIrfcjr&q=85&s=3b409ea215cfd522d6c31c5231b26bd3" alt="Create resource tag modal accessed from the Settings menu in the LangSmith UI." width="865" height="1076" data-path="langsmith/images/create-tag-light.png" />

           <img className="hidden dark:block" src="https://mintcdn.com/langchain-5e9cc07a/86CKyoiUyLIrfcjr/langsmith/images/create-tag-dark.png?fit=max&auto=format&n=86CKyoiUyLIrfcjr&q=85&s=4f99d9a64c2a0cd3fce8d89aa19e406d" alt="Create resource tag modal accessed from the Settings menu in the LangSmith UI." width="866" height="1082" data-path="langsmith/images/create-tag-dark.png" />

    ## Assign a tag to a resource

    Within the same side panel for creating a new tag, you can also assign resources to tags. Search for corresponding resources in the **Assign resources** section and select the resources you want to tag.

    <Note>
      You can only tag workspace-scoped resources with resource tags. This includes Tracing Projects, Annotation Queues, Deployments, Experiments, Datasets, and Prompts.
    </Note>

    To un-assign a tag from a resource, click the <Icon icon="trash" /> trash icon next to the tag, both in the tag panel and the resource tag panel.

    ## Delete a tag

    You can delete either a key or a value of a tag from the [**Settings** page > **Resource tags** page](https://smith.langchain.com/settings/workspaces/resource_tags). To delete a key, click the <Icon icon="trash" /> trash icon next to the key. To delete a value, click the <Icon icon="trash" /> trash icon next to the value.

    If you delete a key, LangSmith will delete all values associated with that key. When you delete a value, you will lose all associations between that value and resources.
  </Tab>

  <Tab title="API" icon="terminal">
    ## Manage tags via API

    You can create, assign, and query resource tags programmatically using the LangSmith REST API. All tag endpoints live under `/api/v1/workspaces/current/` and require an [API key](/langsmith/create-account-api-key).

    ### Set up

    Import the `requests` library and configure your API key and headers. All the following examples assume these variables are in scope:

    ```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    import os
    import requests

    LANGSMITH_API_URL = "https://api.smith.langchain.com"
    LANGSMITH_API_KEY = os.environ["LANGSMITH_API_KEY"]
    headers = {"x-api-key": LANGSMITH_API_KEY, "Content-Type": "application/json"}
    ```

    ### Create a tag key

    <Note>
      Creating tag keys requires the [`workspaces:manage`](/langsmith/organization-workspace-operations) permission.
      If you want to apply the default **Application** key, skip this step and list existing keys instead.
    </Note>

    ```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    response = requests.post(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/tag-keys",
        headers=headers,
        json={"key": "Environment", "description": "Deployment environment"},
    )
    response.raise_for_status()
    tag_key = response.json()
    tag_key_id = tag_key["id"]
    ```

    ### Create a tag value

    ```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    response = requests.post(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/tag-keys/{tag_key_id}/tag-values",
        headers=headers,
        json={"value": "production"},
    )
    response.raise_for_status()
    tag_value = response.json()
    tag_value_id = tag_value["id"]
    ```

    ### Assign a tag to a resource

    ```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    response = requests.post(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/taggings",
        headers=headers,
        json={
            "tag_value_id": tag_value_id,
            "resource_type": "project",
            "resource_id": "<project-uuid>",
        },
    )
    response.raise_for_status()
    tagging_id = response.json()["id"]
    ```

    Valid `resource_type` values: `project`, `dataset`, `prompt`, `experiment`, `queue`,
    `deployment`, `dashboard`, `evaluator`, `mcp_server`, `fleet_integration`.

    <Note>
      **Permissions**: Assigning the **Application** tag only requires update access to the target resource,
      so editors can do this without `workspaces:manage`. Assigning any other tag key requires `workspaces:manage`.
    </Note>

    **Applying existing tags**: If the key and value already exist (for example, the default **Application** key), retrieve their IDs first and go straight to the assign step:

    ```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    tags = requests.get(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/tags",
        headers=headers,
    ).json()
    # tags is a list of {id, key, values: [{id, value}, ...]}
    ```

    ### Query tags

    ```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    # All tag keys and values in the workspace
    tags = requests.get(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/tags",
        headers=headers,
    ).json()

    # Tags on a specific resource
    resource_tags = requests.get(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/tags/resource",
        headers=headers,
        params={"resource_type": "project", "resource_id": "<project-uuid>"},
    ).json()

    # All resources tagged with a specific value
    taggings = requests.get(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/taggings",
        headers=headers,
        params={"tag_value_id": tag_value_id},
    ).json()
    ```

    ### Remove a tag from a resource

    ```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    requests.delete(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/taggings/{tagging_id}",
        headers=headers,
    )
    ```

    ### Delete a tag key or value

    ```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    # Delete a value (removes all resource assignments for that value)
    requests.delete(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/tag-keys/{tag_key_id}/tag-values/{tag_value_id}",
        headers=headers,
    )

    # Delete a key (also deletes all its values)
    requests.delete(
        f"{LANGSMITH_API_URL}/api/v1/workspaces/current/tag-keys/{tag_key_id}",
        headers=headers,
    )
    ```

    For a full list of request/response fields, refer to the [API reference](https://api.smith.langchain.com/redoc).
  </Tab>
</Tabs>

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/set-up-resource-tags.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
