# Add Label Sets into Existing Project

We allow users to add new label sets in the existing project.

First, you need to create the label set first by following the steps provided in [this page](/api/labeling/create-label-set.md) and obtain the returned label set id to be used for the following step:

## cURL

Use the following cURL command to add a label set into an existing project. You can copy and paste the following template and replace the access\_token and the content of the label set items according to your needs.

```javascript
curl --location --request POST 'https://datasaur.ai/graphql' \
--header 'Authorization: Bearer access_token' \
--header 'Content-Type: application/json' \
--data-raw '{"query": "mutation UpdateTextDocumentLabelSetSettingsMutation($input: UpdateTextDocumentInput!) { textDocument: updateTextDocument(input: $input) { id } }", "operationName": "UpdateTextDocumentLabelSetSettingsMutation", "variables": { "input": { "id": "document-id", "settings": { "labelSets": [{ "id": "labelset-id", "index": 1 } ] } }}}'
```

Below is a more readable version of the above curl command's request body.

```javascript
{
  "query": "mutation UpdateTextDocumentLabelSetSettingsMutation($input: UpdateTextDocumentInput!) { textDocument: updateTextDocument(input: $input) { id } }",
  "operationName": "UpdateTextDocumentLabelSetSettingsMutation",
  "variables": {
    "input": {
      "id": "document-id",
      "settings": {
        "labelSets": [
          { "id": "labelset-id", "index": 0 }
        ]
      }
    }
  }
}
```

* **operationName**: you can fill any alphanumeric string in as the operationName. Refer [this page](https://graphql.org/learn/queries/#operation-name) for best practices on choosing an `operationName` .
* **variables:**
  * **input:**
    * **id:** string, reviewer's document id of the project.
    * **settings:**
      * **labelSets:** list of label sets to be registered.
        * **id:** id of the label set. Please follow the instruction to create a label set in [this page](/api/labeling/create-label-set.md).
        * **index**: the label set slot in **zero-based index**. For example, if you want to insert the labelset for the 2nd label set, you need to set this value to: **1**
* **query**: Copy this from the example above.

💡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.

## 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-sets-into-existing-project.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.
