Category / Section
How to download the completed documents individually using API?
Published:
3 mins read
BoldSign allows users to download individual documents separately, rather than as a single combined file, when multiple documents are uploaded for signing.
In this article, we’ll walk you through how to request signatures and download each document individually using the BoldSign API.
Code Snippet
Curl
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 'Message=' \
-F 'DocumentDownloadOption=Individually' \
-F 'Signers={
"name": "Hanky",
"emailAddress": "hankyWhites@cubeflakes.com",
"signerType": "Signer",
"deliveryMode": "Email",
"formFields": [
{
"id": "string",
"name": "string",
"fieldType": "Signature",
"pageNumber": 1,
"bounds": {
"x": 50,
"y": 50,
"width": 1,
"height": 1
},
"isRequired": true
}
],
"locale": "EN"
}' \
-F 'Files=@{your file}' \
-F 'Title={title}' \
.NET
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: "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",
Signers = documentSigners,
Files = filesToUpload,
DocumentDownloadOption = DocumentDownloadOption.Individual,
};
var documentCreated = documentClient.SendDocument(sendForSign);
Python
import boldsign
configuration = boldsign.Configuration(api_key="YOUR_API_KEY")
with boldsign.ApiClient(configuration) as api_client:
document_api = boldsign.DocumentApi(api_client)
form_field = boldsign.FormField(
fieldType="Signature",
pageNumber=1,
bounds=boldsign.Rectangle(x=50, y=50, width=200, height=25))
document_signer = boldsign.DocumentSigner(
name="David",
emailAddress="david@cubeflakes.com",
signerType="Signer",
formFields=[form_field])
send_for_sign = boldsign.SendForSign(
title= "Document SDK API",
files=["YOUR_FILE_PATH"],
signers=[document_signer],
documentDownloadOption= DocumentDownloadOption.Individually)
document_created = document_api.send_document(send_for_sign)
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->setApiKey('YOUR_API_KEY');
$document_api = new DocumentApi($config);
$form_field = new FormField();
$form_field->setFieldType('Signature');
$form_field->setPageNumber(1);
$bounds = new Rectangle([100, 100, 100, 50]);
$form_field->setBounds($bounds);
$document_signer = new DocumentSigner();
$document_signer->setName("David");
$document_signer->setEmailAddress("david@cubeflakes.com");
$document_signer->setSignerType("Signer");
$document_signer->setFormFields([$form_field]);
$send_for_sign = new SendForSign();
$files = new FileInfo();
$files = 'YOUR_FILE_PATH';
$send_for_sign->setFiles([$files]);
$send_for_sign->setSigners([$document_signer]);
$send_for_sign->setTitle('Document SDK API');
$send_for_sign->setDocumentDownloadOption('Individually');
$document_created = $document_api->sendDocument($send_for_sign);
Java
ApiClient client = Configuration.getDefaultApiClient();
client.setApiKey("YOUR_API_KEY");
DocumentApi documentApi = new DocumentApi(client);
FormField signatureField = new FormField();
signatureField.setFieldType(FormField.FieldTypeEnum.SIGNATURE);
signatureField.setPageNumber(1);
Rectangle bounds = new Rectangle().x(100f).y(100f).width(100f).height(50f);
signatureField.setBounds(bounds);
DocumentSigner signer = new DocumentSigner();
signer.setName("David");
signer.setEmailAddress("david@cubeflakes.com");
signer.setSignerType(DocumentSigner.SignerTypeEnum.SIGNER);
signer.setFormFields(Arrays.asList(signatureField));
SendForSign sendForSign = new SendForSign();
File file = new File("YOUR_FILE_PATH");
sendForSign.setFiles(Arrays.asList(file));
sendForSign.setSigners(Arrays.asList(signer));
sendForSign.setTitle("Document SDK API");
sendForSign.setDocumentDownloadOption(DocumentDownloadOptionEnum.INDIVIDUALLY);
DocumentCreated documentCreated = documentApi.sendDocument(sendForSign);
Node
import { DocumentApi, DocumentSigner, FormField, Rectangle, SendForSign } from "boldsign";
import * as fs from 'fs';
const documentApi = new DocumentApi();
documentApi.setApiKey("YOUR_API_KEY");
const bounds = new Rectangle();
bounds.x = 100;
bounds.y = 50;
bounds.width = 100;
bounds.height = 100;
const formField = new FormField();
formField.fieldType = FormField.FieldTypeEnum.Signature;
formField.pageNumber = 1;
formField.bounds = bounds;
const documentSigner = new DocumentSigner();
documentSigner.name = "David";
documentSigner.emailAddress = "david@cubeflakes.com";
documentSigner.signerType = DocumentSigner.SignerTypeEnum.Signer;
documentSigner.formFields = [formField];
const files = fs.createReadStream("YOUR_FILE_PATH");
const sendForSign = new SendForSign();
sendForSign.title = "Agreement";
sendForSign.signers = [documentSigner];
sendForSign.files = [files];
sendForSign.documentDownloadOption = SendForSign.DocumentDownloadOptionEnum.Individually;
const documentCreated =documentApi.sendDocument(sendForSign);
In the examples above, make sure to set the DocumentDownloadOption
to Individually
before making the request. Once the document is signed, downloading it will result in a ZIP file containing the individual documents. You can refer to this documentation for downloading the document via API: Download document