The BoldSign mobile app is now available. Visitthis link for more details and give it a try!

The BoldSign mobile app is now available. Visitthis link for more details and give it a try!

Request Demo
BoldSign Logo Small

Features

Explore the BoldSign features that make eSigning easier.

how-to-apply-expiration-dates-for-esignature-requests-through-api-banner-image

How to Apply Expiration Date for eSignature Requests Through API

Ensuring documents are signed on time is essential. Setting an expiration date adds a layer of security to the document, ensuring it is only valid for a specified period.

You can configure an expiration date for your document through the BoldSign API by specifying the expiration value with the expiration date type. Once the expiration date is reached, the document will no longer be available for signing.

Code snippets

Let’s see how to add expiration date via the BoldSign API in various programming languages.

Curl

    
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={document message}' \
  -F 'Signers={
  "name": "alexgayle",
  "emailAddress": "alexgayle@boldsign.dev",
  "signerType": "Signer",
  "formFields": [
    {
      "id": "textbox1",
      "name": "textbox1",
      "filetype": "Textbox",
      "pageNumber": 1,
      "bounds": {
        "x": 140,
        "y": 140,
        "width": 82,
        "height": 32
      },
      "isRequired": true
    }
  ]
}' \
  -F 'ExpiryDays={The number of days after which the document expires}' \
  -F 'Files=@{your file}' \
  -F 'Title={title}' \
  -F 'ExpiryDateType={set the expirydatetype}' \
  -F 'ExpiryValue={expiryvalue}' \

C#

    
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}"
};
var filesToUpload = new List<IDocumentFile>
{
documentFilePath,
};
var signatureField = new FormField(
id: "sign",
isRequired: true,
type: FieldType.Signature,
pageNumber: 1,
bounds: new Rectangle(x: 200, y: 200, width: 125, height: 25));
var formFieldCollections = new List<FormField>()
{
signatureField
};
var signer = new DocumentSigner(
signerName: "David",
signerEmail: "starvritsabuhungi@boldsign.dev",
signerType: SignerType.Signer,
formFields: formFieldCollections,
locale: Locales.EN);
var documentSigners = new List<DocumentSigner>()
{
signer
};
var sendForSign = new SendForSign()
{
Signers = documentSigners,
Title = "Expiration date",
ExpiryValue = {expiry value},
ExpiryDateType = ExpiryDateType.Days,
Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
Console.WriteLine(documentCreated.DocumentId);

Python

    
import requests # type: ignore.
import json.

url = "https://api.boldsign.com/v1/document/send"
signer_data = {
    "name": "starvritsa",
    "emailAddress": "starvritsabuhungi@boldsign.dev",
    "signerType": "Signer",
    "signerRole": "Signer",
    "formFields": [
        {
            "id": "signature",
            "name": "signature",
            "fieldType": "Signature",
            "pageNumber": 1,
            "bounds": {
                "x": 100,
                "y": 100,
                "width": 125,
                "height": 25
            },
            "isRequired": True,
        }
    ],
    "locale": "EN"
}
payload = {
    'Signers': json.dumps(signer_data),
    'Title': "Expiration date",
    'ExpiryValue':'10',
    'ExpiryDateType':'Days',
}

files = [
    ('Files', ('{your file name}, 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.text)

Node.js

    
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('Signers', '{\r\n        "name": "starvritsa",\r\n        "emailAddress": "starvritsabuhungi@boldsign.dev",\r\n        "signerType": "Signer", \r\n        "signerRole": "Signer",\r\n        "formFields": [\r\n           {\r\n                "id": "signature",\r\n                "name": "signature",\r\n                "fieldType": "Signature",\r\n                "pageNumber": 1,\r\n                "bounds": {\r\n                  "x": 100,\r\n                  "y": 100,\r\n                  "width": 125,\r\n                  "height": 25\r\n                   },\r\n      "isRequired": true\r\n    }\r\n  ],\r\n  "locale": "EN",\r\n  "ExpiryValue": "10",\r\n  "ExpiryDateType": "Days"\r\n}');
data.append('Files', fs.createReadStream('{your file path}'));
data.append('Title', 'Expiration date);
let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.boldsign.com/v1/document/send',
  headers: { 
    'accept': 'application/json', 
    'X-API-KEY': '{Your API key}', 
    ...data.getHeaders()
  },
  data : data
};
axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

PHP

    
<?php
require_once "vendor/autoload.php";
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use \GuzzleHttp\Psr7\Utils;
$client = new GuzzleHttp\Client([     'verify' => false, ]);
$headers = [
  'accept' => 'application/json',
  'X-API-KEY' => '{your api key}'
];
$options = [
  'multipart' => [
    [
      'name' => 'DisableExpiryAlert',
      'contents' => 'false'
    ],

    [
      'name' => 'Message',
      'contents' => 'please sign the document'
    ],
    [
      'name' => 'Signers',
      'contents' => '{
        "name": "starvritsa",
        "emailAddress": "starvritsabuhungi@boldsign.dev",
        "signerType": "Signer",
        "formFields": [
           {
                "id": "string",
                "name": "string",
                "fieldType": "Signature",
                "pageNumber": 1,
                "bounds": {
                  "x": 50,
                  "y": 50,
                  "width": 1,
                  "height": 1
                   },
      "isRequired": true
    }
  ],
  "locale": "EN"
}'
    ],
    [
      'name' => 'ExpiryDays',
      'contents' => '10'
    ],
   
    [
      'name' => 'Files',
      'contents' => Utils::tryFopen('{your file path}', 'r'),
      'filename' => '{your file name}',
      'headers'  => [
        'Content-Type' => 'application/pdf'
      ]
    ],
    [
      'name' => 'Title',
      'contents' => 'Expiration date'
    ],
    [
      'name' => 'ExpiryDateType',
      'contents' => 'Days'
    ],
    [
      'name' => 'ExpiryValue',
      'contents' => '10'
    ],
]];
$request = new Request('POST', 'https://api.boldsign.com/v1/document/send', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();

Conclusion

Incorporating expiration date into document workflows is a strategic move towards ensuring efficiency, compliance, and security. Organizations may enhance productivity, reduce wait times, and retain document control by utilizing solutions such as BoldSign’s API.

Begin your 30-day BoldSign Free trial today and unlock its full potential. We value your feedback, so please share your thoughts below. 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.

Picture of Starvritsa Buhungi

Starvritsa Buhungi

Starvritsa is a Technical Assistant at BoldSign, channelling her passion into crafting top-tier content for users through meticulous documentation. She creates content across various formats, including API tutorials, help articles, and comprehensive guides.

Share this blog

Picture of Starvritsa Buhungi

Starvritsa Buhungi

Starvritsa is a Technical Assistant at BoldSign, channelling her passion into crafting top-tier content for users through meticulous documentation. She creates content across various formats, including API tutorials, help articles, and comprehensive guides.

Subscribe RSS feed

Leave a Reply

Your email address will not be published. Required fields are marked *