Introduction
Step into the world of streamlined document management with the BoldSign API. In this concise guide, we’ll look at how to use BoldSign for digital transactions, simplifying the process of sending documents out to collect signatures.
A document in BoldSign acts as the overall container for the signing process, holding all the files and information required for the workflow. It can hold one or more files to be signed, along with sender and recipient details, status, and history. Every document is assigned a unique documentId, which you can use to retrieve or track it later. Using the BoldSign API or SDKs, you can send documents for eSignatures, self-sign, sign as a recipient, send on behalf of another user, add authentication, send reminders, delete a document, get document details, or list documents. To learn more about creating documents including the full parameter list and request/response schema, refer to BoldSign Send Document API.
Asynchronous document processing
The process of document send is asynchronous. You will quickly get the document ID when you start, but the actual file might still be processing in the background. To check if the document was sent successfully, you need to listen to webhooks.
The system will trigger either a Sent event for success or a SendFailed event for failure. If it fails, you will get a SendFailed event with an error message. You need to fix this error to make sure the document is sent correctly next time. Refer to the Webhooks documentation for further details and see the Verify Webhook Events guide for security best practices.
Example Code for Sending Documents
Here’s an example code snippet of how you can send documents via the BoldSign API in various programming languages.
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 'Signers={
"name": "Test",
"emailAddress": "[email protected]",
"signerType": "Signer",
"deliveryMode": "Email",
"formFields": [
{
"id": "signature1",
"fieldType": "Signature",
"pageNumber": 1,
"bounds": { "x": 80, "y": 50, "width": 31, "height": 21 },
"isRequired": true
}
],
"locale": "EN"
}' \
-F 'Files=@{FILE_PATH};type=application/pdf' \
-F 'Title=Title'
var apiClient = new ApiClient("https://api.boldsign.com", "YOUR_API_KEY");
var documentClient = new DocumentClient(apiClient);
var documentFilePath = new DocumentFilePath
{
ContentType = "application/pdf",
FilePath = "FILE_PATH",
};
var filesToUpload = new List<IDocumentFile>
{
documentFilePath,
};
var signatureField = new FormField(
id: "signature1",
isRequired: true,
type: FieldType.Signature,
pageNumber: 1,
bounds: new Rectangle(x: 80, y: 50, width: 31, height: 21));
var signer = new DocumentSigner(
signerName: "Test",
signerType: SignerType.Signer,
signerEmail: "[email protected]",
formFields: new List<FormField> { signatureField },
locale: Locales.EN);
var documentSigners = new List<DocumentSigner>
{
signer
};
var sendForSign = new SendForSign
{
Title = "DOCUMENT_TITLE",
Signers = documentSigners,
Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
import boldsign
configuration = boldsign.Configuration(api_key="YOUR_API_KEY")
with boldsign.ApiClient(configuration) as api_client:
document_api = boldsign.DocumentApi(api_client)
signatureField = boldsign.FormField(
fieldType="Signature",
pageNumber=1,
bounds=boldsign.Rectangle(x=80, y=50, width=31, height=21),
isRequired=True,
id="signature1"
)
signer = boldsign.DocumentSigner(
name="Test",
emailAddress="[email protected]",
signerType="Signer",
formFields=[signatureField],
locale="EN"
)
send_for_sign = boldsign.SendForSign(
title="DOCUMENT_TITLE",
signers=[signer],
files=["FILE_PATH"],
)
document_created = document_api.send_document(send_for_sign=send_for_sign)
import { DocumentApi, DocumentSigner, FormField, Rectangle, SendForSign } from 'boldsign';
import * as fs from 'fs';
async function main() {
const api = new DocumentApi();
api.setApiKey('YOUR_API_KEY');
const bounds = new Rectangle();
bounds.x = 80;
bounds.y = 50;
bounds.width = 31;
bounds.height = 21;
const signatureField = new FormField();
signatureField.fieldType = FormField.FieldTypeEnum.Signature;
signatureField.pageNumber = 1;
signatureField.bounds = bounds;
signatureField.id = 'signature1';
signatureField.isRequired = true;
const signer = new DocumentSigner();
signer.name = 'Test';
signer.emailAddress = '[email protected]';
signer.signerType = DocumentSigner.SignerTypeEnum.Signer;
signer.formFields = [signatureField];
signer.locale = 'EN';
const send = new SendForSign();
send.title = 'DOCUMENT_TITLE';
send.signers = [signer];
send.files = [fs.createReadStream('FILE_PATH')];
const documentCreated = await api.sendDocument(send);
}
main();
ApiClient client = Configuration.getDefaultApiClient();
client.setApiKey("YOUR_API_KEY");
DocumentApi documentApi = new DocumentApi(client);
FormField signatureField = new FormField();
signatureField.setFieldType(FieldTypeEnum.SIGNATURE);
signatureField.setPageNumber(1);
signatureField.setBounds(new Rectangle().x(80f).y(50f).width(31f).height(21f));
signatureField.setIsRequired(true);
signatureField.setId("signature1");
List<FormField> formFields = new ArrayList<FormField>();
formFields.add(signatureField);
DocumentSigner signer = new DocumentSigner();
signer.setName("Test");
signer.setEmailAddress("[email protected]");
signer.setSignerType(DocumentSigner.SignerTypeEnum.SIGNER);
signer.setFormFields(formFields);
signer.setLocale(DocumentSigner.LocaleEnum.EN);
List<DocumentSigner> signers = new ArrayList<DocumentSigner>();
signers.add(signer);
File file = new File("{FILE_PATH}");
List<File> files = new ArrayList<File>();
files.add(file);
SendForSign sendForSign = new SendForSign();
sendForSign.setTitle("DOCUMENT_TITLE");
sendForSign.setSigners(signers);
sendForSign.setFiles(files);
DocumentCreated documentCreated = documentApi.sendDocument(sendForSign);
<?php
require_once "vendor/autoload.php";
$config = new BoldSign\Configuration();
$config->setApiKey('YOUR_API_KEY');
$document_api = new BoldSign\Api\DocumentApi($config);
$signatureField = new BoldSign\Model\FormField();
$signatureField->setId("signature1");
$signatureField->setFieldType('Signature');
$signatureField->setPageNumber(1);
$signatureField->setBounds(new BoldSign\Model\Rectangle([80, 50, 31, 21]));
$signatureField->setIsRequired(true);
$signer = new BoldSign\Model\DocumentSigner();
$signer->setName("Test");
$signer->setEmailAddress("[email protected]");
$signer->setSignerType("Signer");
$signer->setFormFields([$signatureField]);
$signer->setLocale("EN");
$send_for_sign = new BoldSign\Model\SendForSign();
$send_for_sign->setTitle('DOCUMENT_TITLE');
$send_for_sign->setSigners([$signer]);
$send_for_sign->setFiles(['FILE_PATH']);
$documentCreated = $document_api->sendDocument($send_for_sign);
Conclusion
In conclusion, the BoldSign API offers simplicity and flexibility for the signature collection process. Whether users have a BoldSign account or not, they can conveniently sign documents.
By following these guidelines and incorporating the code examples provided, you can seamlessly integrate document sending functionalities directly into your applications. You can also streamline your workflow by generating signing requests directly from templates. Refer to the Send Document From Template guide in the BoldSign documentation. Begin your 30-day trial now to see firsthand how BoldSign streamlines and optimizes your eSignature processes.
Your feedback is important to us, so please feel free to share your thoughts in the comments section below. If you have any questions or require additional information about our services, please schedule a demo or contact our support team through our dedicated support portal.