How to customize signed document naming using BoldSign API?
In BoldSign, you can customize the naming format for signed documents to suit your needs. By default, a standard naming format is applied, but this can be tailored to include specific details by specifying them using the downloadFileName
property. This feature ensures consistent naming conventions and helps keep your signed documents organized.
Notes:
Please refer to below rules for naming cutom files
You can use up to three syntax patterns. Use the predefined patterns or custom text. If custom text contains spaces, they will be replaced with underscores (_).
Allowed characters: A-Z, a-z, 0-9, hyphens (-), and underscores (_).
Max length: File names can be up to 200 characters long. Longer names will be truncated.
Send document with download file name option
When sending out document for signature you can specify the file name format for signed documents and audit trails, which will apply to emails, downloads, and cloud storage. By default, the file name includes the document title and status. For customized naming, you can use placeholders like {title}, {status}, or {date} to create a format that fits your needs. Additionally, you can name file using more tha one file format. Refer to below list of available file name pattern options:
{title} : The title of the document.
{documentId} : The unique identifier of the document.
{status} : The status of the document.
{signername} : The name of the first signer in the document.
{signername_last} : The name of the last signer in the document.
{sendername} : The sender of the document.
{signername_order#1} : When multiple signers are added to a document, specify which signer's name to use by indicating their placement in the signing order.
{completeddate} : The document's completion date.
Below are examples of how to do this:
Code snippet
curl -X 'POST' \ 'https://api.boldsign.com/v1/document/send' \ -H 'accept: application/json' \ -H 'X-API-KEY: {YOUR API KEY}' \ -H 'Content-Type: multipart/form-data' \ -F 'message=sign' \ -F 'signers={ "name": "star", "emailAddress": "alexgayle@cubeflakes.com", "privateMessage": "sign", "authenticationType": "None", "deliveryMode": "Email", "signerType": "Signer", "allowFieldConfiguration": true, "formFields": [ { "id": "sign", "name": "string", "fieldType": "Signature", "pageNumber": 1, "bounds": { "x": 130, "y": 130, "width": 81, "height": 31 }, "isRequired": true } ], "locale": "EN" }' \ -F 'downloadFileName={title}_{signername}' \ -F 'Files=@{your file}' \ -F 'title=Testing file name'
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}"); var documentClient = new DocumentClient(apiClient); var documentFilePath = new DocumentFilePath { ContentType = "application/pdf", FilePath = "{Your file path}", // Replace with actual file path }; var filesToUpload = new List<IDocumentFile> { documentFilePath }; var signatureField = new FormField( id: "sign", isRequired: true, type: FieldType.Signature, pageNumber: 1, bounds: new Rectangle(x: 130, y: 130, width: 81, height: 31)); var formFieldCollections = new List<FormField> { signatureField }; var signer = new DocumentSigner( signerName: "star", signerType: SignerType.Signer, signerEmail: "alexgayle@cubeflakes.com", formFields: formFieldCollections, locale: Locales.EN); signer.DeliveryMode = DeliveryMode.Email; var documentSigners = new List<DocumentSigner> { signer }; var sendForSign = new SendForSign { Message = "please sign this", Title = "Testing file name", Signers = documentSigners, Files = filesToUpload }; var documentCreated = documentClient.SendDocument(sendForSign); Console.WriteLine(documentCreated);
import requests import json url = "https://api.boldsign.com/v1/document/send" signer_data = { "name": "star", "emailAddress": "alexgayle@cubeflakes.com", "privateMessage": "sign", "authenticationType": "None", "deliveryMode": "Email", "signerType": "Signer", "allowFieldConfiguration": True, "formFields": [ { "id": "sign", "name": "string", "fieldType": "Signature", "pageNumber": 1, "bounds": { "x": 130, "y": 130, "width": 81, "height": 31 }, "isRequired": True } ], "locale": "EN" } payload = { 'message': 'sign', 'signers': json.dumps(signer_data), 'downloadFileName': '{title}_{signername}', 'title': 'Testing file name' } files = [ ('Files', ( 'your_file_name.pdf', open('{your file path}', 'rb'), 'application/pdf' )) ] headers = { 'accept': 'application/json', 'X-API-KEY': '{YOUR API KEY}' } response = requests.post(url, headers=headers, data=payload, files=files) print(response.status_code) print(response.text)
const axios = require('axios'); const FormData = require('form-data'); const fs = require('fs'); const url = "https://api.boldsign.com/v1/document/send"; const formData = new FormData(); formData.append('message', 'sign'); formData.append('signers', JSON.stringify({ "name": "star", "emailAddress": "alexgayle@cubeflakes.com", "privateMessage": "sign", "authenticationType": "None", "deliveryMode": "Email", "signerType": "Signer", "allowFieldConfiguration": true, "formFields": [ { "id": "sign", "name": "string", "fieldType": "Signature", "pageNumber": 1, "bounds": { "x": 130, "y": 130, "width": 81, "height": 31 }, "isRequired": true } ], "locale": "EN" })); formData.append('downloadFileName', '{title}_{signername}'); formData.append('title', 'Testing file name'); formData.append('Files', fs.createReadStream('{your file path}')); const headers = { 'accept': 'application/json', 'X-API-KEY': '{YOUR API KEY}', ...formData.getHeaders() }; axios.post(url, formData, { headers }) .then(response => { console.log(response.status); console.log(response.data); }) .catch(error => { console.error(error.response ? error.response.data : error.message); });
In the provided code example, provide values for downloadFileName
using one of the prefered supported format from list. Replace the values for API KEY
with the correct value, File
with your correct file path. When the above codes are executed and the document is completed, the document will be updated and saved with the selected file name format.