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 -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": "[email protected]",
"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}' \
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: "[email protected]",
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);
import requests # type: ignore.
import json.
url = "https://api.boldsign.com/v1/document/send"
signer_data = {
"name": "starvritsa",
"emailAddress": "[email protected]",
"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)
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": "[email protected]",\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
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": "[email protected]",
"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.
