---
title: "Send eSignature Envelopes with Attachments Using BoldSign API"
description: "Learn how to add documents to existing eSignature templates via API using BoldSign. Boost efficiency with secure, scalable workflows & real-world code examples."
url: "https://boldsign.com/blogs/add-documents-to-existing-esignature-templates-via-api/"
---

1. [Blog](https://boldsign.com/blogs.md)
2. [API](https://boldsign.com/category/api.md)

# How to Include Additional Documents While Sending an eSignature Envelope Using a Template via API

[Gopinath Kannusamy](https://boldsign.com/author/gopinath-kannusamy/) June 11, 2024 Updated July 23, 2026 4 min read

The process of sending an eSignature envelope using a template has become significantly easier with the ability to include additional documents. Recently, we introduced this new support. In this blog, we will see how to include additional documents while sending an eSignature envelope using a template via an API. We will cover examples in different programming languages, demonstrating how to achieve this with both application/json and multipart/form-data content types.

## Why Including Additional Documents Is Important

[Including additional documents](https://developers.boldsign.com/how-to-guides/how-to-add-additional-files-while-sending-document-from-template?region=us) while sending an eSignature envelope allows users to include all necessary documents in one go, improving efficiency. Whether you need to attach supporting documents, addendums, or additional forms, this feature makes the process seamless.

## Prerequisites

- **API Key or OAuth Access Token:** You need a BoldSign API key, or an access token obtained from an OAuth app. Refer to this [documentation](https://developers.boldsign.com/authentication/introduction/?region=us) for more information about BoldSign API authentication.
- **Template ID:** The ID of the template you want to use to send an envelope.
- **Files:** The additional documents you want to attach.

## Code Examples

Following are code examples in different programming languages. To send an envelope for signature, you need to construct a payload with all the necessary details. Include details such as the title, message, signer name, and signer email address. If you are using the application/json content type, the files should be updated in base64 format. The base64 format is **data:application/{{fileType}};base64,{{content}}**. When using the multipart/form-data content type to send an envelope, you should include the files as part of the payload in their original binary format.

### *Application/JSON*

```
curl -X 'POST' \
  \ 'https://api.boldsign.com/v1/template/send?templateId=YOUR_TEMPLATE_ID' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {YOUR_API_KEY}' \
  -H 'Content-Type: application/json;odata.metadata=minimal;odata.streaming=true' \
  -d '{
  "title": "Invitation form",
  "message": "Kindly review and sign this.",
  "roles": [
    {
      "roleIndex": 1,
      "signerName": "david",
      "signerEmail": "david@cubeflakes.com"
    }
  ],
  "files": [
    "data:application/{{fileType}};base64,{{content}}"
  ]
}'
```

### *Multipart/form-data*

```
curl -X 'POST' \
  'https://api.boldsign.com/v1/template/send?templateId=b8085b47-63b3-47f8-8d5e-cb0acfe2d916' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {your API key}' \
  -F 'files=@{your file path};type=application/pdf' \
  -F 'title=Invitation form' \
  -F 'message=Kindly review and sign this.' \
  -F 'roles[0][roleIndex]=1' \
  -F 'roles[0][signerName]=Richard' \
  -F 'roles[0][signerEmail]=richard@boldsign.dev'
```

```
var apiClient = new ApiClient("https://api.boldsign.com", "{YOUR_API_KEY}");
var templateClient = new TemplateClient(apiClient);
var documentFilePath = new DocumentFilePath
{
    ContentType = "application/pdf",
    FilePath = "YOUR_FILE_PATH"
};
var filesToUpload = new List<IDocumentFile>
{
    documentFilePath,
};
var templateRole = new Roles(
    roleSignerName:"david",
    roleSignerEmailAddress:"david@cubeflakes.com",
    roleSignerIndex:1
);
var roles = new List<Roles>
{
    templateRole,
};
var sendForSignFromTemplate = new SendForSignFromTemplate()
{
    TemplateId = "YOUR_TEMPLATE_ID",
    Files = filesToUpload,
};
var documentCreated =  templateClient.SendUsingTemplate(sendForSignFromTemplate);
```

```
import boldsign

configuration = boldsign.Configuration(api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    template_api = boldsign.TemplateApi(api_client)

    send_for_sign_from_template_form = boldsign.SendForSignFromTemplateForm(
        title="Invitation form",
        message="Kindly review and sign this",
        files=["YOUR_FILE_PATH"],
        roles=[boldsign.Role(roleIndex=1, signerName="david", signerEmail="david@cubeflakes.com")],
    )

    document_created = template_api.send_using_template(
        template_id="YOUR_TEMPLATE_ID",
        send_for_sign_from_template_form=send_for_sign_from_template_form,
    )
```

```
<?php
require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\TemplateApi;
use BoldSign\Model\{Role, SendForSignFromTemplateForm, FileInfo};

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$template_api = new TemplateApi($config);

$role = new Role();
$role->setRoleIndex(1);
$role->setSignerName('david');
$role->setSignerEmail('david@cubeflakes.com');

$send_for_sign_from_template = new SendForSignFromTemplateForm();
$send_for_sign_from_template->setRoles([$role]);

$files = new FileInfo();
$files = 'YOUR_FILE_PATH';
$send_for_sign_from_template->setFiles([$files]);

$document_created = $template_api->sendUsingTemplate($template_id = 'YOUR_TEMPLATE_ID', $send_for_sign_from_template);

?>
```

```
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");

TemplateApi templateApi = new TemplateApi(client);

Role role = new Role();
role.roleIndex(1);
role.setSignerName("david");
role.setSignerEmail("david@cubeflakes.com");
SendForSignFromTemplateForm sendForSignFromTemplate = new SendForSignFromTemplateForm();
sendForSignFromTemplate.setRoles(Arrays.asList(role));
File file = new File("YOUR_FILE_PATH");
sendForSignFromTemplate.setFiles(Arrays.asList(file));

DocumentCreated documentCreated =
        templateApi.sendUsingTemplate("YOUR_TEMPLATE_ID", sendForSignFromTemplate);
```

```
import { TemplateApi, Role, SendForSignFromTemplateForm } from "boldsign";
import * as fs from "fs";

async function main() {
  const templateApi = new TemplateApi();
  templateApi.setApiKey("YOUR_API_KEY");

  const role = new Role();
  role.roleIndex = 1;
  role.signerName = "david";
  role.signerEmail = "david@cubeflakes.com";

  const sendForSignFromTemplate = new SendForSignFromTemplateForm();
  sendForSignFromTemplate.roles = [role];

  const files = fs.createReadStream("YOUR_FILE_PATH");
  sendForSignFromTemplate.files = [files];

  const documentCreated = templateApi.sendUsingTemplate(
    "YOUR_TEMPLATE_ID",
    sendForSignFromTemplate,
  );
}

main();
```

> **Note:** When sending an envelope using a template via the API, you must use either **files or fileUrls parameter** in a single request. Both parameters cannot be used together.

## Customizing your request

In the previous examples, replace placeholders such as the API key, signer details, file paths, and template ID with your own values before sending the request. Beyond the minimal fields shown, the same request supports common production needs such as signing order, CC recipients, reminders, and branding. These options sit alongside your existing fields and signer information in the request body. For a complete list of configurable properties and examples, refer to the [Template Send API documentation](https://developers.boldsign.com/documents/send-document-from-template).

## Conclusion

By following the examples provided in this blog, you can successfully include additional documents when sending an eSignature envelope using a template via an API. Whether you prefer using the application/json or multipart/form-data content type, the process is straightforward and can be implemented in various programming languages. This added flexibility ensures that your document workflows are efficient, accurate, and tailored to your specific needs.

To experience the benefits firsthand, start a [30-day free trial](https://account.boldsign.com/signup?planId=1020\&utm_source=boldsignblogs\&utm_medium=redirect\&utm_campaign=boldsign) of BoldSign. We genuinely value your feedback and invite you to share your thoughts below. If you require any assistance or wish to explore our services further, don’t hesitate to [schedule a demo](https://boldsign.com/request-demo.md) or reach out to our dedicated support team via our [support portal](https://support.boldsign.com/support/tickets/create).

Topics [API integration](https://boldsign.com/blogs/tag/api-integration.md)[Templates](https://boldsign.com/blogs/tag/templates.md)

## Sign documents 3x faster

Send, sign and manage documents securely and efficiently.

[Try it today](https://account.boldsign.com/signup?planId=1018\&utm_source=boldsignblogs\&utm_medium=redirect\&utm_campaign=boldsign)

## Gopinath Kannusamy

Gopinath is a passionate software developer with 2 years of experience at BoldSign. He is an avid writer and enjoys sharing his insights on technology and development. In his free time, he enjoys exploring new technologies and learning new things. Connect with him on [LinkedIn](https://www.linkedin.com/in/gopinath-kannusamy-b7b84517a/).

[More posts by Gopinath Kannusamy](https://boldsign.com/author/gopinath-kannusamy/)

## Related posts

- [API](https://boldsign.com/category/api.md) September 29, 2026 10 min read

  ## [How to Migrate from Docusign Without Losing Templates or Workflow Continuity](https://boldsign.com/blogs/migrate-from-docusign.md)

  Learn how to migrate from Docusign while protecting templates, signed records, and active workflows. Explore key risks, a practical checklist, and next steps.

- [API](https://boldsign.com/category/api.md) September 22, 2026 9 min read

  ## [What Are the Common Challenges When Using Signature APIs in Software Development](https://boldsign.com/blogs/common-signature-api-challenges.md)

  Explore the common challenges developers face with a Signature API, from authentication issues to PDF rendering, webhooks, templates, and rate limits.

- [API](https://boldsign.com/category/api.md) September 18, 2026 6 min read

  ## [How to Safely Edit eSignature API Templates in Production](https://boldsign.com/blogs/edit-esignature-api-template.md)

  Learn what can break when you edit an eSignature API template, including roles, fields, and indexes, and how to update templates safely in production today.

Get started

## Sign up for your free trial today!

[Start free trial](https://account.boldsign.com/signup?planId=1018)

- 30-day free trial
- No credit card required

*Picture: A completed employment contract: signed by John Doe on 11/03/2026, all parties have signed*
