How to request signature with text tags for dynamic documents in BoldSign API?
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.
{{*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
{{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
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", "formFields": [ { "id": "TextBox", "name": "TextBox", "fieldType": "TextBox", "pageNumber": 1, "bounds": { "x": 100, "y": 100, "width": 125, "height": 25 }, "isRequired": true, "value": "Default Value", "isReadOnly": true } ], "locale": "EN" }' \ -F 'Files={your file}' \
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}" }; var filesToUpload = new List<IDocumentFile> { documentFilePath, }; var TextBoxField = new FormField( id: "sign", isRequired: true, isReadOnly: true, value: "Default Value", type: FieldType.TextBox, pageNumber: 1, bounds: new Rectangle(x: 200, y: 200, width: 125, height: 25)); var formFieldCollections = new List<FormField>() { TextBoxField }; var signer = new DocumentSigner( name: "David", emailAddress: david@cubeflakes.com, formFields: formFieldCollections, locale: Locales.FR); var documentSigners = new List<DocumentSigner>() { signer }; var sendForSign = new SendForSign() { DisableEmails = true, Signers = documentSigners, Title = "Sample Document", UseTextTags = true, Files = filesToUpload }; var documentCreated = documentClient.SendDocument(sendForSign); Console.WriteLine(documentCreated.DocumentId);
import requests import json url = https://api.boldsign.com/v1/document/send signer_data = { "name": "hanky", "emailAddress": davidJames@cubeflakes.com, "signerType": "Signer", "signerRole": "Signer", "formFields": [ { "id": "TextBox", "name": "TextBox", "fieldType": "TextBox", "pageNumber": 1, "bounds": { "x": 100, "y": 100, "width": 125, "height": 25 }, "isRequired": True, "value": "Default Value", "isReadOnly": True } ], "locale": "EN" } payload = { 'Signers': json.dumps(signer_data), 'UseTextTags': True, 'Title': "Sample Document" } files = [ ('Files', ('{Your file name}', open('{Your file path}', 'rb'), 'application/pdf')) ] headers = { 'accept': 'application/json', 'X-API-KEY': '{Your API key}' } response = requests.post(url, headers=headers, data=payload, files=files) print(response.text)
const axios = require('axios'); const FormData = require('form-data'); const fs = require('fs'); let data = new FormData(); data.append('Signers', '{\r\n "name": "hanky",\r\n "emailAddress": hankyWhites@gmail.com,\r\n "signerType": "Signer",\r\n "signerRole": "Signer",\r\n "formFields": [\r\n {\r\n "id": "TextBox",\r\n "name": "TextBox",\r\n "fieldType": "TextBox",\r\n "pageNumber": 1,\r\n "bounds": {\r\n "x": 100,\r\n "y": 100,\r\n "width": 125,\r\n "height": 25\r\n },\r\n "isReadOnly": true,\r\n "isRequired": true\r\n}\r\n ],\r\n "locale": "EN"\r\n}'); data.append('Title', "Sample Document"); data.append('UseTextTags', "true"); data.append('Files', fs.createReadStream('{Your file path}')); let config = { method: 'post', maxBodyLength: Infinity, url: 'https://api.boldsign.com/v1/document/send', headers: { 'accept': 'application/json', 'X-API-KEY': '{Your API key}', ...data.getHeaders() }, data : data }; axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); });
You can also refer our demo sample 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.