Create embedded template
The embedded template allows users to compose and create reusable templates on your website or mobile app using an iFrame, pop-up window, or a new tab. The process is similar to the embedded request, but it is used for template creation.
The templates created using the embedded template will be in the draft
state until the user completes the create process from the generated URL.
Create an embedded template link
post/v1/template/createEmbeddedTemplateUrlThe embedded template link is created in the same way as the regular template, but with additional properties to customize the embedded process. Please refer to the Create template for the create template API specific properties.
This API supports both multipart/form-data
and application/json
content types.
Asynchronous document processing
The template creation process is asynchronous in nature. You will receive an embedded request URL and template ID immediately, but the uploaded document might still be processing in the background. In the meantime, you can see the progress of the document processing by opening the embedded create template URL in the browser.
Request body
RedirectUrlstring | The redirect URI to be redirected after the template create process is completed. The string should be in URI format. |
ShowToolbarboolean | Controls the visibility of the toolbar at the top of the document editor. Defaults to false. |
ViewOptionstring | Configures the initial view page to be loaded from the generated URL. The FillingPage is used to customize roles, enforce authentication, etc. The PreparePage is used to configure form fields for the roles. Either PreparePage or FillingPage. Defaults to PreparePage. |
ShowSaveButtonboolean | Controls the visibility of the Defaults to true. |
ShowSendButtonboolean | Controls the visibility of the Defaults to true. |
ShowPreviewButtonboolean | Controls the visibility of the Defaults to true. |
AllowNewFilesboolean | When set to true, the sender can add new files while using this template to send signature requests. If set to false, the sender will not be able to add new files. Defaults to true. |
AllowModifyFilesboolean | When set to true, the sender can replace or delete existing files while using this template to send signature requests. If set to false, the sender will not have the ability to replace or delete files. Defaults to true. |
ShowNavigationButtonsboolean | Controls the visibility of the Defaults to true. |
LinkValidTillstring | Configures the expiration for the generated URL. A maximum of 180 days can be assigned. The string should be in date-time format. |
ShowTooltipboolean | To control the visibility of the Defaults to false. |
autoDetectFieldsboolean | When enabled, it will convert all the fillable form fields in the document to BoldSign form fields. BoldSign supports Textbox, Checkbox, Radio button, and Signature form fields. Other fields will not be detected as of now. Defaults to false. |
Example request using multipart/form-data
curl --location --request POST 'https://api.boldsign.com/v1/template/createEmbeddedTemplateUrl' \ --header 'X-API-KEY: ****YOUR-API-KEY****' \ --form 'Title=" API template"' \ --form 'Description=" API template description"' \ --form 'DocumentTitle=" API document title"' \ --form 'DocumentMessage=" API document message description"' \ --form 'AllowMessageEditing=" true"' \ --form 'Roles[0][name]="Manager"' \ --form 'Roles[0][index]="1"' \ --form 'ShowToolbar="true"' \ --form 'ShowSaveButton="true"' \ --form 'ShowSendButton="true"' \ --form 'ShowPreviewButton="true"' \ --form 'ShowNavigationButtons="true"' \ --form 'ShowTooltip="false"' \ --form 'ViewOption="PreparePage"' \ --form 'AllowNewFiles="true"' \ --form 'AllowModifyFiles="true"' \ --form 'Files=@"/docs/test-document.pdf"'
var apiClient = new ApiClient("https://api.boldsign.com", "Your-API-KEY"); var templateClient = new TemplateClient(apiClient); var templateRequest = new CreateEmbeddedTemplateRequest { Title = "Template created from API SDK", Description = "The is a template created to get a quick contract sign.", DocumentTitle = "Sent using template created from API SDK", DocumentMessage = "This is document message sent from API SDK", AllowMessageEditing = true, AllowNewFiles = true, AllowModifyFiles = true, Roles = new List<TemplateRole> { new TemplateRole(index: 1, name: "Manager"), }, Files = new List<IDocumentFile> { new DocumentFileStream { ContentType = "application/pdf", FileData = fileStream, FileName = "NDA1.pdf", }, new DocumentFileBytes() { ContentType = "application/pdf", FileData = fileByteArray, FileName = "NDA2.pdf", }, new DocumentFilePath { ContentType = "application/pdf", // directly provide file path FilePath = "NDA3.pdf", }, }, // customize page options ViewOption = PageViewOption.PreparePage, ShowToolbar = true, ShowNavigationButtons = true, ShowSaveButton = true, ShowPreviewButton = false, ShowCreateButton = true, ShowTooltip = false, }; var templateCreated = await templateClient.CreateEmbeddedTemplateUrlAsync(templateRequest); // url to send the document from your web application var templateCreateUrl = templateCreated.CreateUrl;
import boldsign configuration = boldsign.Configuration( api_key = "YOUR_API_KEY" ) with boldsign.ApiClient(configuration) as api_client: template_api = boldsign.TemplateApi(api_client) template_role = boldsign.TemplateRole( index=1, name="Manager" ) embedded_create_template_request = boldsign.EmbeddedCreateTemplateRequest ( title="API template", description="API template description", documentTitle="API document title", documentMessage="API document message description", allowMessageEditing=True, roles=[template_role], showToolbar=True, showNavigationButtons=True, showPreviewButton=True, showSendButton=True, showSaveButton=True, locale="EN", showTooltip=False, allowNewFiles=True, viewOption="PreparePage", files=["YOUR_FILE_PATH"], ) embedded_request_url_document_response = template_api.create_embedded_template_url( embedded_create_template_request=embedded_create_template_request )
const axios = require('axios'); const FormData = require('form-data'); const fs = require('fs'); const form = new FormData(); form.append('Title', ' API template'); form.append('Description', ' API template description'); form.append('DocumentTitle', ' API document title'); form.append('DocumentMessage', ' API document message description'); form.append('AllowMessageEditing', ' true'); form.append('Roles[0][name]', ' Manager'); form.append('Roles[0][index]', ' 1'); form.append('ShowToolbar', ' true'); form.append('ShowSaveButton', ' true'); form.append('ShowSendButton', ' true'); form.append('ShowPreviewButton', ' true'); form.append('ShowNavigationButtons', ' true'); form.append('ShowTooltip', 'false'); form.append('AllowNewFiles', 'true'); form.append('AllowModifyFiles', 'true'); form.append('ViewOption', ' PreparePage'); form.append('Files', fs.readFileSync('/docs/test-document.pdf'), '/docs/test-document.pdf'); const response = await axios.post( ' https://api.boldsign.com/v1/template/createEmbeddedTemplateUrl', form, { headers: { ...form.getHeaders(), 'X-API-KEY': '****YOUR-API-KEY****' } } );
Example request using application/json
curl -X POST 'https://api.boldsign.com/v1/template/createEmbeddedTemplateUrl' \ -H 'X-API-KEY: ****YOUR-API-KEY****' \ -H 'Content-Type: application/json' \ -d '{ "Title": "API template", "Description": "API template description", "DocumentTitle": "API document title", "DocumentMessage": "API document message description", "AllowMessageEditing": true, "Roles": [ { "name": "Manager", "index": 1 } ], "ShowToolbar": true, "ShowSaveButton": true, "ShowSendButton": true, "ShowPreviewButton": true, "ShowNavigationButtons": true, "ShowTooltip": false, "ViewOption": "PreparePage", "Files": [ "data:application/pdf;base64,JVBERi0xLjcKJcfs..." ] }'
import requests url = "https://api.boldsign.com/v1/template/createEmbeddedTemplateUrl" payload = { "Title": "API template", "Description": "API template description", "DocumentTitle": "API document title", "DocumentMessage": "API document message description", "AllowMessageEditing": True, "Roles": [ { "name": "Manager", "index": 1 } ], "ShowToolbar": True, "ShowSaveButton": True, "ShowSendButton": True, "ShowPreviewButton": True, "ShowNavigationButtons": True, "ShowTooltip": False, "ViewOption": "PreparePage", "Files": [ "data:application/pdf;base64,JVBERi0xLjcKJcfs..." ] } headers = { 'X-API-KEY': '****YOUR-API-KEY****', 'Content-Type': 'application/json' } response = requests.post(url, headers=headers, json=payload) print(response.text)
const axios = require('axios'); const fs = require('fs'); const url = 'https://api.boldsign.com/v1/template/createEmbeddedTemplateUrl'; const apiKey = '****YOUR-API-KEY****'; // Define the payload object const payload = { Title: 'API template', Description: 'API template description', DocumentTitle: 'API document title', DocumentMessage: 'API document message description', AllowMessageEditing: true, Roles: [ { name: 'Manager', index: 1 } ], ShowToolbar: true, ShowSaveButton: true, ShowSendButton: true, ShowPreviewButton: true, ShowNavigationButtons: true, ShowTooltip: false, ViewOption: 'PreparePage', Files: [ "data:application/pdf;base64,JVBERi0xLjcKJcfs..." ] }; // Make the POST request const response = await axios.post(url, payload, { headers: { 'Content-Type': 'application/json', 'X-API-KEY': apiKey } }); console.log(response.data);
<?php require_once "vendor/autoload.php"; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Exception\RequestException; $client = new Client(); $apiKey = '****YOUR-API-KEY****'; $headers = [ 'Content-Type' => 'application/json', 'X-API-KEY' => $apiKey, ]; $body = [ 'Title' => 'API template', 'Description' => 'API template description', 'DocumentTitle' => 'API document title', 'DocumentMessage' => 'API document message description', 'AllowMessageEditing' => true, 'Roles' => [ [ 'name' => 'Manager', 'index' => 1, ] ], 'ShowToolbar' => true, 'ShowSaveButton' => true, 'ShowSendButton' => true, 'ShowPreviewButton' => true, 'ShowNavigationButtons' => true, 'ShowTooltip' => false, 'ViewOption' => 'PreparePage', 'Files' => [ 'data:application/pdf;base64,JVBERi0xLjcKJcfs...' ] ]; $options = [ 'json' => $body, ]; $url = 'https://api.boldsign.com/v1/template/createEmbeddedTemplateUrl'; try { $response = $client->post($url, [ 'headers' => $headers, 'json' => $body, ]); echo $response->getBody(); } catch (RequestException $e) { echo 'Error: ' . $e->getMessage(); } ?>
Example response
{ "templateId": "6a154b94...", "createUrl": "https://app.boldsign.com/document/embed/?templateId=6a154b94..." }