# How to Request Signatures Using Text Tags
## What are BoldSign Text Tags?
BoldSign text tags serve as a combination of text and symbols strategically placed within a document to define the position, size, and type of form fields. 

When sending a document to a signer via the API, you can easily identify text tags by enabling the `UseTextTags` property and setting it to `true`.

**Syntax:**

Text tags are encapsulated within double curly braces {{ }}, starting with {{ and concluding with }}. The components within the tag are separated by a pipe "|" symbol.

```json
 {{*Field type*|*Signer Index*|*Required*|*Field label*|*Field ID*}} 
```

## Sections in Text Tags:
- **Field Type:** Specifies the type of field, such as text, sign, or init.
- **Signer Index:** Represents the index of signers to whom the form fields are assigned.
- **Required:** Indicates whether the field is mandatory.
- **Field Label:** Serves as a placeholder for text fields.
- **Field ID:** A unique identifier that supports characters A-Z, a-z, 0-9, hyphen, and underscore.

**Example**
```json
 {{text|1|*|Enter name|field_1}}
```
In this example, the text tag denotes a field of type "text," assigned to the first signer, marked as required, labeled "Enter name," and uniquely identified as "field_1."

## Code snippet
{% codetab %}
cURL
```shell 
curl -X 'POST' \
  curl -X 'POST' \
 'https://api.boldsign.com/v1/document/send' \
 -H 'accept: application/json' \
 -H 'X-API-KEY: {your API key}' \
 -H 'Content-Type: multipart/form-data' \
 -F 'Title="Sample Document"' \
 -F 'UseTextTags=true' \
 -F 'Signers={
 "name": "hanky",
 "emailAddress": "hankyWhites@gmail.com",
 "signerType": "Signer",
 "signerRole": "Signer",
 "locale": "EN"
}' \
 -F 'Files={your file}' \
```

C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "Your API Key");
var documentClient = new DocumentClient(apiClient);
 
var documentFilePath = new DocumentFilePath
{
    ContentType = "application/pdf",
    FilePath = "Your File Path.pdf"
};
 
var filesToUpload = new List<IDocumentFile>
{
    documentFilePath,
};
 
var signer = new DocumentSigner(
    signerName: "David",
   signerEmail: "david@cubeflakes.com"
);
 
var documentSigners = new List<DocumentSigner>()
{
    signer
};
 
var sendForSign = new SendForSign()
{
    DisableEmails = true,
    Signers = documentSigners,
    Title = "Sample Document",
    UseTextTags = true,
    Files = filesToUpload
};
var documentCreated = await documentClient.SendDocumentAsync(sendForSign);
Console.WriteLine(documentCreated.DocumentId);
```

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) 
    send_for_sign = boldsign.SendForSign(
          title="Document SDK API",
          document_title = "SDK Document Test case",
          description="Testing document from SDK integration test case", 
          files=["Your File Path.pdf"],
          signers=[
               boldsign.DocumentSigner(
                     name="Hanky",
                     emailAddress="stacy@cubeflakes.com",
                     signerType="Signer",
                    
                   privateMessage="This is private message for signer"
               )
            ],
            useTextTags=True
   )
   send_document_response = document_api.send_document(send_for_sign)
   print(send_document_response)
```

PHP

```php
<?php require_once "vendor/autoload.php";
 
use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{FormField,Rectangle, DocumentSigner, SendForSign,FileInfo};
 
$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('Your API Key');
 
$document_api = new DocumentApi($config);
 
$document_signer = new DocumentSigner();
$document_signer->setName("David");
$document_signer->setEmailAddress("david@cubeflakes.com");
$document_signer->setSignerType("Signer");
 
$send_for_sign = new SendForSign();
$files = 'Your file path.pdf';
$send_for_sign->setFiles([$files]);
$send_for_sign->setSigners([$document_signer]);
$send_for_sign->setTitle('Document SDK API');
$send_for_sign->setUseTextTags(true);
$document_created = $document_api->sendDocument($send_for_sign);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("Your API Key");
      
DocumentApi documentApi = new DocumentApi(client);
 
DocumentSigner signer = new DocumentSigner();
signer.setName("David");
signer.setEmailAddress("david@cubeflakes.com");
signer.setSignerType(DocumentSigner.SignerTypeEnum.SIGNER);
 
SendForSign sendForSign = new SendForSign();
File file = new File("Your File Path.pdf");
sendForSign.setFiles(Arrays.asList(file));
sendForSign.setSigners(Arrays.asList(signer));
sendForSign.setTitle("Test");
sendForSign.setUseTextTags(true);
 
DocumentCreated documentCreated = documentApi.sendDocument(sendForSign);
 
System.out.println(documentCreated.getDocumentId());
```

NodeJS

```js
import { DocumentApi,DocumentSigner, FormField, Rectangle,SendForSign } from "boldsign";
import * as fs from 'fs';

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("Your API Key");
 
const documentSigner = newDocumentSigner();
documentSigner.name = "David";
documentSigner.emailAddress = "david@cubeflakes.com";
documentSigner.signerType = DocumentSigner.SignerTypeEnum.Signer;
 
const files = fs.createReadStream("Your file path.pdf");
 
const sendForSign = newSendForSign();
sendForSign.title = "Agreement";
sendForSign.signers = [documentSigner];
sendForSign.files = [files];
sendForSign.useTextTags = true;
const documentCreated = documentApi.sendDocument(sendForSign);
```

{% /codetab %}

You can also refer our [demo sample](https://demos.boldsign.com/text-tags/) for working example of TextTags.

In conclusion, BoldSign Text Tags present a dynamic and efficient approach to embed form fields into documents, improving the overall signing experience. When you run the provided code, it generates a document with the specified `TextTags` values for the form fields. For additional guidance, you may explore the [Text Tag documentation](https://developers.boldsign.com/text-tags/introduction/).
