# Add Label Set Item into Project's Label Set

In addition to adding label set items through the [Label Set Extension](/advanced/extensions/labels.md), you can also add new items to an existing label set using the API.\
\
**Mutation**: [AppendLabelSetTagItems](https://api-docs.datasaur.ai/#mutation-appendLabelSetTagItems)

## cURL

Use the following cURL command to add one or more label set items to an existing project. Copy and paste it, then replace the following:

* **`access_token`** with your own API access token.
* **`label-set-id`** with the ID of the label set (see [Get List of Label Sets in a Project](/api/labeling/get-list-of-label-sets-in-a-project.md)).

```javascript
curl --location --request POST '<https://datasaur.ai/graphql>' \\
--header 'Authorization: Bearer access_token' \\
--header 'Content-Type: application/json' \\
--data-raw '{ "query": "mutation AppendLabelSetTagItems($input: AppendLabelSetTagItemsInput!) { appendLabelSetTagItems(input: $input) { id color parentId tagName } }", "operationName": "AppendLabelSetTagItems", "variables": { "input": { "labelSetId": "project-label-set-id", "tagItems": [ { "tagName": "LOC", "color": null }, { "tagName": "GPE", "color": null } ] } } }'

```

Here’s the same request in a more readable format:

```javascript
{
    "operationName": "AppendLabelSetTagItems",
    "query": "mutation AppendLabelSetTagItems($input: AppendLabelSetTagItemsInput!) { appendLabelSetTagItems(input: $input) { id color parentId tagName } }",
    "variables": {
        "input": {
            "labelSetId": "label-set-id",
            "tagItems": [
                {
                    "tagName": "LOC",
                    "color": null
                },
                {
                    "tagName": "GPE",
                    "color": null
                }
            ]
        }
    }
}
```

* **operationName**: you can fill any alphanumeric string in as the operationName. Refer to [this page](https://graphql.org/learn/queries/#operation-name) for best practices on choosing an `operationName` .
* **variables:**
  * **input:**
    * **labelSetId:** string, id of the target label set in a project. Refer to [this page](/api/labeling/get-list-of-label-sets-in-a-project.md) to obtain label set ID.
    * **tagItems:**
      * **tagName:** name of the label item
      * **color:** valid HTML readable color code
* **query**: Copy this from the example above.

{% hint style="info" %}
A **tag** has the same meaning as **label**. In the near future, we will update the GraphQL Schema to refer to all instances as labels.
{% endhint %}

## Response

Here is the response you can expect after issuing the cURL command. Use the **id** to create the project.

```javascript
{
    "data": {
        "textDocument": {
            "id": "c541e403-776a-b740-4baf-955c7be86c0d"
        }
    },
    "extensions": {}
}
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datasaur.ai/api/labeling/add-label-item-into-projects-label-set.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
