How to add files using file URLs when sending a document by merging multiple templates?
BoldSign allows you to add files using file URLs for e-signature using the FileUrls
property. The supported file formats that can be used in FileUrls
are .pdf, .png, .jpg, and .docx. The .pdf is the preferred format. You can refer to the following link for supported file formats. Make sure that the header content-type in the file URL should be in proper format like application/pdf, application/msword.
Create templates in BoldSign
To perform merge and send, you need to retrieve the template IDs of the templates you are going to use. If you don’t have templates in your account, you can create them using either the API or web app.
Code Snippet
Here is an example demonstrating how to add a file using a file URL when sending a document by merging multiple templates for eSignature using the BoldSign API.
Curl
curl -X 'POST' \ 'https://api.boldsign.com/v1-beta/template/mergeAndSend' \
-H 'accept: application/json' \
-H 'X-API-KEY: {your API key}' \
-H 'Content-Type: application/json;odata.metadata=minimal;odata.streaming=true' \
-d '{
"templateIds": [
"4fe17627-xxxx-41ff-xxxx-0af80fd77740", "d57d9f60-xxxx-4f30-xxxx-2830b6a8fb3f"
],
"title": "Invitation form",
"message": "Kindly review and sign this.",
"FileUrls": [
"https://www.dropbox.com/scl/fi/jcya44l0ui2sq4rjl0wsg/Customer-Contract-Form-Cubeflex.pdf?rlkey=earhpfci3i2zqzugcchxkb451&st=sjbm7jcs&dl=1"
],
"roles": [
{
"roleIndex": 1,
"signerName": "David",
"signerEmail": "david@cubeflakes.com",
"signerType": "Signer",
"formFields": [
{
"id": "SignField",
"fieldType": "Signature",
"pageNumber": 1,
"bounds": {
"x": 100,
"y": 100,
"width": 100,
"height": 50
},
"isRequired": true
}
],
"locale": "EN"
}
]
}'
.NET
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}");
var templateClient = new TemplateClient(apiClient);
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 templateRole = new Roles(
roleSignerIndex:1,
roleSignerName:"David",
roleSignerEmailAddress:"david@cubeflakes.com",
formFields: formFieldCollections,
locale: Locales.EN);
var roles = new List<Roles>
{
templateRole,
};
var mergeAdSend = new MergeAndSendForSign()
{
TemplateIds = new string[] { "4fe17627-xxxx-41ff-xxxx-0af80fd77740", "d57d9f60-xxxx-4f30-xxxx-2830b6a8fb3f" },
Roles = roles,
};
mergeAndSend.FileUrls = new List<Uri>() {
new Uri("https://documentmanipulatordev.blob.core.windows.net/dev-public/EBrochure.pdf"),
new Uri("https://documentmanipulatordev.blob.core.windows.net/dev-public/Brouchure2021.pdf")
};
var documentCreated = await templateClient.MergeAndSendAsync(mergeAdSend).ConfigureAwait(false);
Python
import boldsign
configuration = boldsign.Configuration(api_key="YOUR_API_KEY")
with boldsign.ApiClient(configuration) as api_client:
template_api = boldsign.TemplateApi(api_client)
role = boldsign.Role(
signerRole="NewRole",
roleIndex=1,
signerName="David",
signerEmail="david@cubeflakes.com")
merge_and_send_for_sign_form = boldsign.MergeAndSendForSignForm(
templateIds=["YOUR_TEMPLATE_ID", "YOUR_TEMPLATE_ID"],
roles=[role],
fileUrls=[
'https://www.dropbox.com/scl/fi/jcya44l0ui2sq4rjl0wsg/Customer-Contract-Form-Cubeflex.pdf?rlkey=earhpfci3i2zqzugcchxkb451&st=sjbm7jcs&dl=1'
])
document_created = template_api.merge_and_send(merge_and_send_for_sign_form)
PHP
<?php require_once "vendor/autoload.php";
use BoldSign\Configuration;
use BoldSign\Api\TemplateApi;
use BoldSign\Model\{Role, MergeAndSendForSignForm};
$config = new Configuration();
$config->setApiKey('YOUR_API_KEY');
$template_api = new TemplateApi($config);
$role = new Role();
$role->setRoleIndex(1);
$role->setSignerName('David');
$role->setSignerEmail('david@cubeflakes.com');
$role->setSignerRole('NewRole');
$merge_and_send_for_sign_form = new MergeAndSendForSignForm();
$merge_and_send_for_sign_form->setTemplateIds(['YOUR_TEMPLATE_ID', 'YOUR_TEMPLATE_ID']);
$merge_and_send_for_sign_form->setRoles([$role]);
$merge_and_send_for_sign_form->setFileUrls([
'https://www.dropbox.com/scl/fi/jcya44l0ui2sq4rjl0wsg/Customer-Contract-Form-Cubeflex.pdf?rlkey=earhpfci3i2zqzugcchxkb451&st=sjbm7jcs&dl=1'
]);
$document_created = $template_api->mergeAndSend($merge_and_send_for_sign_form);
Java
ApiClient client = Configuration.getDefaultApiClient();
client.setApiKey("YOUR_API_KEY");
TemplateApi templateApi = new TemplateApi(client);
Role role = new Role();
role.setRoleIndex(1);
role.setSignerName("David");
role.setSignerEmail("david@cubeflakes.com");
role.setSignerRole("HR");
MergeAndSendForSignForm mergeAndSendForSignForm = new MergeAndSendForSignForm();
mergeAndSendForSignForm.setTemplateIds(Arrays.asList("YOUR_TEMPLATE_ID", "YOUR_TEMPLATE_ID"));
mergeAndSendForSignForm.setRoles(Arrays.asList(role));
mergeAndSendForSignForm.setFileUrls(Arrays.asList(
'https://www.dropbox.com/scl/fi/jcya44l0ui2sq4rjl0wsg/Customer-Contract-Form-Cubeflex.pdf?rlkey=earhpfci3i2zqzugcchxkb451&st=sjbm7jcs&dl=1'
));
templateApi.mergeAndSend(mergeAndSendForSignForm);
Node
import { TemplateApi, FormField, MergeAndSendForSignForm, Rectangle, Role } from "boldsign";
const templateApi = new TemplateApi();
templateApi.setApiKey("YOUR_API_KEY");
const role = new Role();
role.roleIndex = 1;
role.signerName = "David";
role.signerEmail = "david@cubeflakes.com";
role.signerRole = "Manager";
const mergeAndSendForsign = new MergeAndSendForSignForm();
mergeAndSendForsign.roles = [role];
mergeAndSendForsign.templateIds = ["YOUR_TEMPLATE_ID", "YOUR_TEMPLATE_ID"];
mergeAndSendForsign.fileUrls=[
'https://www.dropbox.com/scl/fi/jcya44l0ui2sq4rjl0wsg/Customer-Contract-Form-Cubeflex.pdf?rlkey=earhpfci3i2zqzugcchxkb451&st=sjbm7jcs&dl=1'
]);
const documentCreated = templateApi.mergeAndSend(mergeAndSendForsign);
In the provided code examples, make sure to replace the SignerEmail
and SignerName
properties with the email and name of the signer you wish to send the document.