How to add metadata while sending document for signature?

The metadata can be used to store additional information about the document in the form of key-value pairs. In the context of digital documents, metadata is essential for defining and categorizing various aspects of the document. BoldSign allows you to add metadata for the document while sending document for e-signature. You can add meta data for the document by using MetaData property. Here is an example demonstrating how to add metadata while sending a document for e-signature using the BoldSign API:

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: application/json' \
  -d '{
    "Message": "Test document",
    "Signers": [
        {
            "name": "Alex",
            "emailAddress": "alexgayle@cubeflakes.com",
            "signerType": "Signer",
            "formFields": [
                {
                    "id": "sign1",
                    "name": "sign1",
                    "fieldType": "Signature",
                    "pageNumber": 1,
                    "bounds": {
                        "x": 50,
                        "y": 50,
                        "width": 125,
                        "height": 25
                    },
                    "isRequired": true
                }
              ],
            "locale": "EN"
        }
    ],
   
   "Files": [
        "data:application/pdf;base64,JVBERi0xLjcKJcfs..."
    ],
    "Title": "Sampledocument",
    "MetaData": {
    "DocumentType": "new",
    "DocumentCategory": "Software"
  }
  }'

using BoldSign.Api;
using BoldSign.Model;

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 signatureField = new FormField(
    id: "sign",
    isRequired: true,
    type:FieldType.Signature,
    pageNumber: 1,
    bounds: new Rectangle(x: 100, y: 100, width: 100, height: 50));

var formFieldCollections = new List<FormField>()
{
    signatureField
};

var signer = new DocumentSigner(
    signerName: "Alex",
    signerType: SignerType.Signer,
    signerEmail: "alexgayle@cubeflakes.com",
    formFields: formFieldCollections,
    locale: Locales.EN);

var documentSigners = new List<DocumentSigner>()
{
    signer
};

var metaData = new Dictionary<string, string>()
{
    ["DocumentType"] = "new",
    ["DocumentCategory"] = "software",
};

var sendForSign = new SendForSign()
{
    Message = "please sign this",
    Title = "Agreement",
    Signers = documentSigners,
    Files = filesToUpload,
    MetaData = metaData

};
var documentCreated = documentClient.SendDocument(sendForSign);
Console.WriteLine(documentCreated);
import requests
import json

url = "https://api.boldsign.com/v1/document/send"

signer_data = {
    "name": "Alex",
    "emailAddress": "alexgayle@cubeflakes.com",
    "signerType": "Signer",
    "formFields": [
        {
            "id": "sign1",
            "name": "sign1",
            "fieldType": "Signature",
            "pageNumber": 1,
            "bounds": {
                "x": 50,
                "y": 50,
                "width": 200,
                "height": 25
            },
            "isRequired": True
        }
       
    ],
    "locale": "EN"
}

payload = {
    'Message': 'Please sign this.',
    'Signers': [signer_data],
    'Title': 'Agreement',
    'Files': [
        'data:application/pdf;base64,JVBERi0xLjcNCi...'
    ],
    'MetaData': {
    'DocumentType': 'new',
    'DocumentCategory': 'Software'
  }
}

headers = {
  'Content-Type': 'application/json',
  'accept': 'application/json',
  'X-API-KEY': '{Your API Key}'
}

response = requests.post(url, headers=headers, json=payload)
print(response.text)
const axios = require('axios');

const url = "https://api.boldsign.com/v1/document/send";

const signerData = {
  "name": "Alex",
  "emailAddress": "alexgayle@cubeflakes.com",
  "signerType": "Signer",
  "formFields": [
    {
      "id": "string",
      "name": "string",
      "fieldType": "Signature",
      "pageNumber": 1,
      "bounds": {
        "x": 50,
        "y": 50,
        "width": 200,
        "height": 25
      },
      "isRequired": true
    }
  ],
  "locale": "EN"
};

const payload = {
  'Message': 'Please sign this.',
  'Signers': [signerData],
  'Title': 'Agreement',
  'Files': [
    'data:application/pdf;base64,JVBERi0xLjcNCi...'
  ],
  
  'MetaData': {
    'DocumentType': 'new',
    'DocumentCategory': 'Software'
  }
};

const headers = {
  'Content-Type': 'application/json',
  'accept': 'application/json',
  'X-API-KEY': '{Your API Key}'
};

axios.post(url, payload, { headers })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

In the provided code examples, update the SignerEmail and SignerName properties with the email and name of the signer you wish to send the document to. By following the code snippets provided, you can send documents with the meta data using BoldSign API.