
Starting now, you can use our brand-new product, Box Doc Gen, via the Box Doc Gen API. This new innovation allows you to programmatically generate business documents, such as offer letters, sales contracts, invoices and agreements. Generated documents are based on templates previously created and uploaded to Box, with data fields that can be dynamically filled. Plus, data can come from any number of sources, such as third party applications, Box Apps, and more!
Let’s see how it works.
Tutorial
Below, you’ll find a tutorial on how to generate an NDA using the Box Doc Gen API. The steps are broken into three parts: creating the template, labeling the template, and generating a document. The examples shown are in cURL to be framework agnostic, but our latest Box SDK libraries are updated so you can use them if you wish.
This tutorial demonstrates product usage only and should not be construed as legal advice or guidance for drafting NDAs. All processes shown are illustrative examples.

Pre-requisites
Before you can use Box Doc Gen via the API, you’ll need to complete the following actions.
- Your Box instance must have a subscription plan that includes Box Doc Gen. Developer accounts do not include Box Doc Gen. Reach out to your Box sales representative for more information if you would like to try out these features.
- To use Box Doc Gen, you must have access to Microsoft Word, as it is required for creating and authoring your document templates. Box Doc Gen is designed to facilitate the dynamic generation of business documents, but it is important to note that Box does not have control over users’ access to Microsoft Word. Users must ensure they have the necessary permissions and access to Microsoft Word to create and author document templates effectively.
- Box Doc Gen must be enabled by an admin in the Admin Console. If you are your instance’s Box Admin, you will find the necessary information on how to turn on this setting in the Enterprise Settings: Content & Sharing Tab documentation.

- The appropriate scope must be added to a Box custom application. You can use any type of application. Find out how to set an app up in our developer docs.

Create template
To begin, we need to create a template that can be used to generate a NDA for a new client. You can download this document to jump-start creating the template, or you can create your own from scratch. This NDA example also contains Box Sign template tags, so a document can be sent for signature after creation.
While it’s not required to use Microsoft Word to create the template, it can make it significantly easier — thanks to the Box Doc Gen add-in for Microsoft Word. No matter how the document is created, it will need to be saved as a DOCX file type in order to generate documents with Box Doc Gen.
After downloading the file linked above, open it Microsoft Word. If using the plugin, install the add-in using these instructions. After installing the plugin you can then use a JSON object to generate tags or manually create them.
Also, note that you can use Microsoft Word online if you don’t wish to work with the file locally.
For this walkthrough, you can use this JSON file for the NDA template we are creating.

Click start with your data, followed by uploading the JSON file you downloaded. It should look like the below screenshot.

After clicking “Generate tags,” you will see fields that can be used in the document.

Add fields by placing your cursor where you’d like a value to go. Then, click the field in the list. In the screenshot below, fields that have been added are highlighted.

In addition to the JSON data, you can also add conditional logic using IF statements. Let’s add an “if” so that Part 3 of the document will only show if the NDA signer is in California.

Save the document. Make sure its DOCX.
Mark template
Now, let’s upload the document to Box and mark it as a Box Doc Gen template. You can do this in a few ways.
You could simply upload the file to Box (wherever you’d like to store it). Then, in the options menu, select “Mark as Doc Gen Template.”

Or, you could go into the Relay Doc Gen menu, and create/upload it there.

Finally, you could also use the Box Platform API to mark a file in Box as a template.
curl -L 'https://api.box.com/2.0/docgen_templates' \
-H 'box-version: 2025.0' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-D '{
"file": {
"id": "12345678",
"type": "file"
}
}'Regardless of how you designate your template, you should see the file appear afterwards in the Doc Gen tab of the Relay menu option.

It will also appear in results returned by the Box Platform API endpoint for listing out Box Doc Gen templates.
{
"limit": 10,
"next_marker": null,
"prev_marker": null,
"entries": [{
"file": {
"id": "1749734642013",
"type": "file"
},
"file_name": "Increo NDA Doc Gen Template.docx"
}]
}Generate document
After the above steps have been completed, you can generate a document using the template. Run the following command. Make sure to update the access token, file ID and destination folder ID, respectively.
curl -L 'https://api.box.com/2.0/docgen_batches' \
-H 'box-version: 2025.0' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-d '{
"file": {
"id": "FILE_ID",
"type": "file"
},
"input_source": "api",
"destination_folder": {
"id": "FOLDER_ID",
"type": "folder"
},
"output_type": "docx",
"document_generation_data": [
{
"generated_file_name": "Box Doc Gen Increo NDA",
"user_input": {
"contract": {
"date": "18-08-2023",
"companyName": "ABC Finance",
"clientName": "Bob Smith",
"engagementType": "Sprint Support",
"companyIndustry": "Finance",
"customerAddress": {
"state": "CA"
}
}
}
}
]
}'When a request to generate a document is completed, a job is created. The response you receive from the Box Platform API should look like this.
{
"id": "d770504e-18a2-487f-baf9-7e6ec7d260e6",
"type": "docgen_batch"
}While one-off tutorials like this will be quick, larger more scaled projects may take more time. Also, since you can generate several documents in one call, they are batched together. You can use the endpoints described on this page to learn more about using the API to monitor job completion.
In addition to using the API to monitor job/batch progress, you can see all requests for a particular template in the Doc Gen activity tab.

You’ll also find direct links to the generated document.

And, since this NDA template has Box Sign tags, you could send it directly for signature using the Box UI or the API!
Wrap up
With this latest release, you can speed up time-consuming processes with document creation across your organization.
Also, it’s worth noting that this tutorial only demonstrated Box Doc Gen as a standalone solution., but you can use document generation in tandem with other Box products too. For example, you can send documents for signature after you generate them.
Stay tuned — next week we will release an SDK-based workshop on Box Doc Gen similar to the one we released on Box AI.
More Box Doc Gen endpoints
We’ve released additional Doc Gen endpoints. Learn more from our API reference pages.
Resources
Box Doc Gen Microsoft Word plugin
🦄 Want to engage with other Box Platform champions?
Join our Box Developer Community for support and knowledge sharing!

