Combine audit trail and signed document using API

BoldSign provides the option to combine an audit trail with the signed document using its API.

The following are the detailed instructions on how to effectively combine signed documents with their corresponding audit trails using the API:

Creating a brand with combine audit trail option

To initiate the process, you need to create a brand with Combine Audit Trail option enabled. This configuration will ensure that both the audit trail and the signed document are combined in the final output.

Here are example codes that can be used to do this:

Code snippet

curl -X 'POST' \ 'https://api.boldsign.com/v1/brand/create' \
     -H 'accept: application/json;odata.metadata=minimal;odata.streaming=true' \
     -H 'X-API-KEY: {your API key}' \
     -F 'CombineAuditTrail=true' \
     -F 'BrandLogo={Your logo file}' \
     -F 'BrandName={Your brand Name}' \
var apiClient = new ApiClient("https://api.boldsign.com", " {your API key}");
var brandingClient = new BrandingClient(apiClient);
var brandSettings = new BrandSettings()
{
  BrandName = "{Your brand Name}",
  BrandLogo = new DocumentFileBytes
  {
      ContentType = "image/png",
      FileName = "{your logo file}",
  },
  CombineAuditTrail = true
};
BrandingData brandingData = await brandingClient.CreateBrandAsync(brandSettings).ConfigureAwait(false);
string brandId = brandingData.BrandId;
import requests

url = "https://api.boldsign.com/v1/brand/create"

payload = {
  'CombineAuditTrail': 'true',
  'BrandName': 'Syncfusion'
}
files = [
  ('BrandLogo',('{file name}',open('{Your logo file}','rb'),'image/png'))
]
headers = {
  'accept': 'application/json;odata.metadata=minimal;odata.streaming=true',
  'X-API-KEY': '{your API key}'
}

response = requests.request("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('CombineAuditTrail', 'true');
data.append('BrandLogo', fs.createReadStream('{Your logo file}'));
data.append('BrandName', '{Your brand Name}');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.boldsign.com/v1/brand/create',
  headers: { 
    'accept': 'application/json;odata.metadata=minimal;odata.streaming=true', 
    '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);
});
<?php

require_once "vendor/autoload.php";
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7;

$client = new Client([
    'verify' => false
]);

$url = "https://api.boldsign.com/v1/brand/create";

$payload = [
    [
        'name' => 'CombineAuditTrail',
        'contents' => 'true'
    ],
    [
        'name' => 'BrandName',
        'contents' => 'Test'
    ],
    [
        'name' => 'BrandLogo',
        'contents' => fopen('{Your file path}', 'r'),
        'filename' => '{Your file name}',
        'headers'  => [
            'Content-Type' => 'image/png'
        ]
    ]
];

$headers = [
    'accept' => 'application/json;odata.metadata=minimal;odata.streaming=true',
    'X-API-KEY' => '{Your API Key}'
];

$response = $client->post($url, [
    'multipart' => $payload,
    'headers' => $headers
]);

echo $response->getBody();

In the provided example, the crucial step is setting the CombineAuditTrail parameter to true, enabling the combination of the audit trail and the signed document. Ensure that you input the necessary details, such as BrandName and BrandLogo. The brand logo must be in formats like JPG, JPEG, or PNG. Execute the above to create a brand with the Combine Audit Trail option enabled.

Send document with the brand with combine audit trail

Once you have a brand with the combine audit trail option enabled, proceed to create a document using the API. Associate the brand with the desired combination of the audit trail and the signed document.

Code snippet to create a document with combine audit trail and signed document

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 'BrandId= {your brand ID}' \
     -F 'Message=' \
     -F 'Signers={
        "name": "Hanky",
        "emailAddress": "hankyWhites@cubeflakes.com",
        "signerType": "Signer",
        "formFields": [
           {
                "id": "string",
                "name": "string",
                "fieldType": "Signature",
                "pageNumber": 1,
                "bounds": {
                  "x": 50,
                  "y": 50,
                  "width": 1,
                  "height": 1
                   },
      "isRequired": true
    }
  ],
  "locale": "EN"
}' \
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");
var documentClient = new DocumentClient(apiClient);

var documentFilePath = new DocumentFilePath
{
   ContentType = "application/pdf",
   FilePath = "agreement.pdf", 
};

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: "David",
    signerType: SignerType.Signer,
    signerEmail: "david@cubeflakes.com",
    formFields: formFieldCollections,
    locale: Locales.EN);


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

var sendForSign = new SendForSign()
{
   Message = "please sign this",
   Title = "Agreement",
   BrandId = "{your brand ID}",
   Signers = documentSigners,
   Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
import requests
import json

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

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

payload = {
    'BrandId': '{Your Brand Id}',
    'Message': '',
    'Signers': json.dumps(signer_data),
    'Title': '{title}'
}

files = [
    ('Files', (
        'doc-2.pdf',
        open('{Your file path}', 'rb'),
        'application/pdf'
    ))
]

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

response = requests.request("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('BrandId', '{Your Brand Id}');
data.append('Message', '');
data.append('Signers', '{\r\n        "name": "Hanky",\r\n        "emailAddress": "hankyWhites@cubeflakes.com",\r\n        "signerType": "Signer",\r\n        "formFields": [\r\n           {\r\n                "id": "string",\r\n                "name": "string",\r\n                "fieldType": "Signature",\r\n                "pageNumber": 1,\r\n                "bounds": {\r\n                  "x": 50,\r\n                  "y": 50,\r\n                  "width": 1,\r\n                  "height": 1\r\n                   },\r\n      "isRequired": true\r\n    }\r\n  ],\r\n  "locale": "EN"\r\n}');
data.append('Files', fs.createReadStream('{Your file path}'));
data.append('Title', '{title}');

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);
});

In the provided example, replace BrandId with the actual brand id in which the combine audit trail option is enabled. Once the signer completes the signing process, you can download the document containing both the signed document and the accompanying audit trail.