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

# Trackstar Tags

> Tagging objects in Trackstar

Trackstar allows you to tag objects with custom metadata that isn't synced into the underlying integration. This is useful for
adding fields that don't fit into the integration's schema, or for adding additional context to objects.

Tags are supported across WMS, Cart, and Carrier integrations.

## The Trackstar Tag Object

A tag can be either a string or a dictionary with one key-value pair. e.g.

* A string: `"tag1"`
* A dictionary: `{"tag1": "value1"}`

## Setting Tags

To create a tag, make a `PUT` request to `/{integration_type}/{object_type}/{object_id}/trackstar-tags`. The request body includes a list of tags to add to the object.

*Note, because this is a `PUT` request, the tags will be replaced with the new list.*

### Supported Endpoints

| Integration | Endpoint                                                            |
| :---------- | :------------------------------------------------------------------ |
| WMS         | `/wms/inventory/{inventory_id}/trackstar-tags`                      |
| WMS         | `/wms/products/{product_id}/trackstar-tags`                         |
| WMS         | `/wms/orders/{order_id}/trackstar-tags`                             |
| WMS         | `/wms/inbound-shipments/{inbound_shipment_id}/trackstar-tags`       |
| WMS         | `/wms/returns/{return_id}/trackstar-tags`                           |
| WMS         | `/wms/warehouses/{warehouse_id}/trackstar-tags`                     |
| Cart        | `/cart/orders/{order_id}/trackstar-tags`                            |
| Cart        | `/cart/products/{product_id}/trackstar-tags`                        |
| Cart        | `/cart/warehouses/{warehouse_id}/trackstar-tags`                    |
| Carrier     | `/carrier/invoice-line-items/{invoice_line_item_id}/trackstar-tags` |

### Example

<CodeGroup>
  ```bash cURL theme={null}

  curl --request PUT \
    --url https://production.trackstarhq.com/cart/orders/{order_id}/trackstar-tags \
    --header 'Content-Type: application/json' \
    --header 'x-trackstar-access-token: <x-trackstar-access-token>' \
    --header 'x-trackstar-api-key: <x-trackstar-api-key>' \
    --data '{
    "trackstar_tags": [
      "tag1",
      "tag2",
      {
        "tag3": "value3"
      }
    ]
  }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://production.trackstarhq.com/cart/orders/{order_id}/trackstar-tags"

  payload = {"trackstar_tags": ["tag1", "tag2", {"tag3": "value3"}]}
  headers = {
      "x-trackstar-api-key": "<x-trackstar-api-key>",
      "x-trackstar-access-token": "<x-trackstar-access-token>",
      "Content-Type": "application/json"
  }

  response = requests.request("PUT", url, json=payload, headers=headers)
  ```
</CodeGroup>

## Getting Tags

Once you've added tags to an object, they will be returned in the `trackstar_tags` field of the object's response from any `GET` request.
