> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/api-documentation/api-guides/products-labels-and-brands/label-service/label.md).

# Label Tutorial

## How to add a label to a product

To label a product with a specific information, follow these steps:

1. Create a label
2. Add a label image
3. Update a product with the label information

## Create a label

To create a new label, send the request to the [Creating a label](https://developer.emporix.io/api-documentation/api-guides/products-labels-and-brands/label-service/api-reference/label#post-labels) endpoint.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/ili5tphwzcypmdTE78Cg" %}
[API Reference](/api-documentation/api-guides/products-labels-and-brands/label-service/api-reference.md)
{% endcontent-ref %}

```bash
curl -i -X POST 
  https://api.emporix.io/label/labels 
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}' 
  -H 'Content-Type: application/json' 
  -d '{
    "name": "Worldwide Shipment",
    "description": "<p>Worldwide Shipment</p>"
  }'
```

Executing a request to create a label returns a response that includes an "id" field, which should then be used in the next steps.

## Add a label image

Firstly, create and add an image for a new label. Design the image and upload it to your media repository. Send a request to the [Creating an asset](https://developer.emporix.io/api-documentation/api-guides/media/media/api-reference/assets#post-media-tenant-assets) endpoint.\
The `labelId` is necessary to provide.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/5ZJ6YjxQ7XQYEg0S7bd4" %}
[API Reference](/api-documentation/api-guides/media/media/api-reference.md)
{% endcontent-ref %}

```bash
curl -L 
  --request POST 
  --url 'https://api.emporix.io/media/{tenant}/assets' 
  --header 'Content-Type: multipart/form-data' 
  --data '{
    "file": {
      "externalValue": "https://res.cloudinary.com/saas-ag/image/upload/v1695804155/emporix-logo-white-2f5e621206edefea6015fb4793959376_nswfbz.png"
    },
    "body": {
      "type": "BLOB",
      "access": "PUBLIC",
      "refIds": [
        {
          "id": "66fe65e83132e30001e6be29",
          "type": "LABEL"
        }
      ],
      "details": {
        "filename": "theBestImage",
        "mimeType": "image/jpg"
      }
    }
  }'
```

## Update a product with a new label

You can now update a product with a newly created label to indicate that shipping is available worldwide for this product. Send the request to the [Partially updating a product](https://developer.emporix.io/api-documentation/api-guides/products-labels-and-brands/product-service/api-reference/products#patch-product-tenant-products-productid) endpoint.

To specify a brand for a product, you need to provide the `labelId` field on product level which should be used. You can add brands either during the creation of the product, or by updating a product that already exists in the system.

{% hint style="success" %}
To test the endpoint, open the API reference or check the example of a curl request.
{% endhint %}

{% content-ref url="/pages/oc2OYFSxw8q0blT7o8ia" %}
[API Reference](/api-documentation/api-guides/products-labels-and-brands/product-service/api-reference.md)
{% endcontent-ref %}

```bash
curl -i -X PATCH 
  'https://api.emporix.io/product/{tenant}/products/{productId}?skipVariantGeneration=false&doIndex=true' 
  -H 'Authorization: Bearer {{OAUTH2_ACCESS_TOKEN}}' 
  -H 'Content-Language: string' 
  -H 'Content-Type: application/json' 
  -d '{
    "published": true
    "labelIds": ["66fe65e83132e30001e6be29"]
  }'
```

As a result, the product is marked with a new label.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.emporix.io/api-documentation/api-guides/products-labels-and-brands/label-service/label.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
