# Add document tags

{% patch /%}
{% path text="/v1/document/addTags" /%}

You can add tags (labels) to the document while creating it or after sending it, with your tenant IDs or any unique ID to make it easy to fetch or list documents based on tenants or users. Added tags can be accessed by all users within the same organization who have document permission.

Please refer to the {% customlink href="/documents/send-document/" text="Send document" /%} article, for adding tags (labels) while creating the document.

## Code snippet

{% codetab %}

cURL

```shell 
curl -X PATCH "https://api.boldsign.com/v1/document/addTags" 
     -H 'X-API-KEY: {your API key}'   
     -H "Content-Type: application/json" 
     -d "{\"DocumentId\": \"{documentId}\", \"Tags\": [\"test\", \"api\"]}"
```

C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "Your_API_Key");

var documentClient = new DocumentClient(apiClient);

var addtag = new DocumentTags()
{
    DocumentId = "YOUR_DOCUMENT_ID",
    Tags = new List<string>() { "test", "api" },
};

documentClient.AddTag(addtag);
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    document_api = boldsign.DocumentApi(api_client)
	
    document_tags = boldsign.DocumentTags(
        documentId="YOUR_DOCUMENT_ID",
        tags=["test", "api"])
    
    document_api.add_tag(document_tags)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\DocumentTags;

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$document_tags = new DocumentTags(); 
$document_tags->setDocumentId('YOUR_DOCUMENT_ID');
$document_tags->setTags(['test', 'api']);

$document_api->addTag($document_tags);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
		   
DocumentApi documentApi = new DocumentApi(client);

DocumentTags documentTags = new DocumentTags();
documentTags.setDocumentId("YOUR_DOCUMENT_ID"); 
documentTags.setTags(Arrays.asList("test", "api")); 

documentApi.addTag(documentTags);
```

NodeJS

```js
import { DocumentApi, DocumentTags } from "boldsign";

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const documentTags = new DocumentTags();
documentTags.documentId = "YOUR_DOCUMENT_ID";
documentTags.tags = ["test", "api"];

documentApi.addTag(documentTags);
```

{% /codetab %}

## Request body

{% nestedtable %}

- {% arguments name="DocumentId" /%}{% batch datatype="string" /%}{% required /%} 
- ID of the requested document

---

- {% arguments name="Tags" /%}{% batch datatype="String" /%}{% required /%} 
- A collection of tags that will be added to the document. It can only contain a maximum of 50 tags. Each tag cannot exceed 255 characters and cannot contain white space.

{% /nestedtable %}

## Example response

***200 Success***
