Edit BoldSign Templates Seamlessly Using Our API Guide

how-to-edit-templates-via-api
how-to-edit-templates-via-api

Table of Contents

Sign Docs 3x Faster

Send, sign, and manage documents securely and efficiently.

Summarize the blog post with:

A template is useful when you frequently send the same contract for signature to many people with the same fields. However, after creating a template, you may sometimes need to make small changes or customize it for a specific purpose. 

The BoldSign API lets you make changes and customizations without manual intervention. Whether you need to update contract templates, modify form fields, or adjust layouts, using an API to edit templates can save time and ensure consistency across your documents.

Editing a Template Using a BoldSign API

The Edit Template API in BoldSign allows users to modify the properties of existing templates and draft templates. This could include modifying the title, description, document message, document title, roles, or form fields associated with the template.

Users can execute partial updates to a template by specifying only the fields they intend to modify. The API will solely modify the provided fields, leaving the remainder unchanged. However, this is limited to top-level properties. When dealing with nested properties within top-level objects, users must provide the complete object for modification.

When you need to update a nested property, you will need to use the Template Properties API, which will retrieve all the properties of the given template. Then, you can modify the required properties within the nested object and send the updated template object to the Edit Template API.

Read more about the Template Properties API

Following are code examples you can use to edit a template.


curl --location --request PUT 'https://api.boldsign.com/v1-beta/template/edit?templateId={Your Template ID }' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: {API-KEY}' \
--data-raw '{
"title": "{A new title}",
"roles": [
{
"name": "Manager",
"index": 1,
"defaultSignerName": "Alex",
"defaultSignerEmail": "[email protected]",
"signerType": "Signer",
"formFields": [
{
"id": "Signature1",
"type": "Signature",
"isRequired": true,
"bounds": {
"x": 600,
"y": 200,
"width": 100,
"height": 32
},
"pageNumber": 1
}
],
"enableEditRecipients": true,
"enableDeleteRecipients": true
}
]
}'
    

var apiClient = new ApiClient("https://api.boldsign.com", "{API-KEY}");
var templateClient = new TemplateClient(apiClient);
var formFields = new List
{
    new FormField(
        id: "Sign",
        type: FieldType.Signature,
        pageNumber: 1,
        isRequired: true,
        bounds: new Rectangle(x: 150, y: 150, width: 200, height: 30)),
};
var templateRoles = new List
{
    new TemplateRole()
    {
        Name = "Manager",
        Index = 1,
        DefaultSignerName = "Alex",
        DefaultSignerEmail = "[email protected]",
        SignerType = SignerType.Signer,
        FormFields = formFields,
        AllowRoleEdit = true,
        AllowRoleDelete = true,
    },
};
var editTemplateRequest = new EditTemplateRequest("{templateId}")
{
    Title = "A new title for template",
    Roles = templateRoles,
};
await templateClient.EditTemplateAsync(editTemplateRequest);
    

import requests
url = 'https://api.boldsign.com/v1-beta/template/edit?templateId={your templateid}'
headers = {
    'Content-Type': 'application/json',
    'X-API-KEY': '{API-KEY}'  
}
data = {
    "title": "{A new title for template}",
    "roles": [
        {
            "name": "Manager",
            "index": 1,
            "defaultSignerName": "Alex",
            "defaultSignerEmail": "[email protected]",
            "signerType": "Signer",
            "formFields": [
                {
                    "id": "Signature1",
                    "type": "Signature",
                    "isRequired": True,
                    "bounds": {
                        "x": 625.0,
                        "y": 293.0,
                        "width": 124.0,
                        "height": 32.0
                    },
                    "pageNumber": 1
                }
            ],
            "enableEditRecipients": True,
            "enableDeleteRecipients": True
        }
    ]
}
response = requests.put(url, headers=headers, json=data)
print(response.status_code)
    

const axios = require('axios');
const url = 'https://api.boldsign.com/v1-beta/template/edit?templateId={your templateid}';
const headers = {
    'Content-Type': 'application/json',
    'X-API-KEY': '{API-KEY}'  
};
const data = {
    "title": "{A new title for template}",
    "roles": [
        {
            "name": "Manager",
            "index": 1,
            "defaultSignerName": "Alex",
            "defaultSignerEmail": "[email protected]",
            "signerType": "Signer",
            "formFields": [
                {
                    "id": "Signature1",
                    "type": "Signature",
                    "isRequired": true,
"bounds": {
                        "x": 625.0,
                        "y": 293.0,
                        "width": 124.0,
                        "height": 32.0
                    },
                    "pageNumber": 1
                }
            ],
            "enableEditRecipients": true,
            "enableDeleteRecipients": true
        }
    ]
};
axios.put(url, data, { headers: headers })
    .then(response => {
        console.log(response.status);
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });
    

<?php
require 'vendor/autoload.php'; // Include Guzzle HTTP library
use GuzzleHttp\Client;
$url = 'https://api.boldsign.com/v1-beta/template/edit?templateId={templateId}';
$headers = [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '{API-KEY}' // Replace {API-KEY} with your actual API key
];
$data = [
    "title" => "A new title for template",
    "EnableSigningOrder" => false,
    "roles" => [
        [
            "name" => "Manager",
            "index" => 1,
            "defaultSignerName" => "Alex",
            "defaultSignerEmail" => "[email protected]",
            "signerOrder" => 1,
            "signerType" => "Signer",
            "formFields" => [
                [
                    "id" => "Signature1",
                    "type" => "Signature",
                    "isRequired" => true,
                    "bounds" => [
                        "x" => 625.0,
                        "y" => 293.0,
                        "width" => 124.0,
                        "height" => 32.0
                    ],
                    "pageNumber" => 1
                ]
            ],
            "enableEditRecipients" => true,
            "enableDeleteRecipients" => true
        ]
    ]
];
$client = new Client();
try {
    $response = $client->request('PUT', $url, [
        'headers' => $headers,
        'json' => $data
    ]);
    $statusCode = $response->getStatusCode();
    $responseData = $response->getBody()->getContents();
    echo 'HTTP Status: ' . $statusCode . "\n";
    echo 'Response: ' . $responseData . "\n";
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
    

Conclusion

By incorporating the Edit Template API into your application, you can make real-time changes to your templates effortlessly, thus ensuring your documents are up-to-date. This not only saves time but also enhances the accuracy and uniformity of your documents.

If you are not yet a BoldSign customer, please start a 30-day free trial today to experience all its great features. We value your feedback, so please share your thoughts in the comments section. If you have any questions or need more information about our services, don’t hesitate to schedule a demo or reach out to our support team through our support portal.

Like what you see? Share with a friend.

Latest blog posts

How UCC Consignment Affects Cash Flow and Credit Risk

How UCC Consignment Affects Cash Flow and Credit Risk

Learn how UCC consignment helps manage cash flow, inventory costs, filing requirements, breach exposure, and bankruptcy risk for businesses online today.

How to Fill Out a Vehicle Bill of Sale and Sign Online

How to Fill Out a Vehicle Bill of Sale and Sign Online

Fill out a vehicle bill of sale, avoid VIN and odometer mistakes, & collect secure online signatures with an audit trail for both parties. Start signing today.

The Future of Joint Venture Agreements: Governance, Compliance, and Digital Transformation

The Future of Joint Venture Agreements: Governance, Compliance, and Digital Transformation

Explore how AI, blockchain, smart contracts, and digital governance are transforming joint venture agreements through better compliance and collaboration.

Sign up for your free trial today!

  • Yes
    30-day free trial
  • Yes
    No credit card required
  • Yes
    30-day free trial
  • Yes
    No credit card required
Sign up for BoldSign free trial