# How to Extend Expiry Date for Documents

In cases where a signer is unable to complete the signing process within the initial expiry date, BoldSign provides the flexibility to extend the expiry date of the document. This extension can only be performed by the sender and account admins. It's important to note that this action cannot be used to reduce the expiry date of a document, and it can only be applied to documents that have not been signed yet.

Follow these steps to extend the expiry date of a document using the BoldSign API

## Check expiry type and date
Before extending the expiry date, you need to retrieve the existing expiry type and expiry date of the document from the document properties.

The following code snippets demonstrate how to obtain the document properties using the API

**Code snippet**

{% codetab id="codetab1" %}

cURL

```shell 
curl -X 'GET' \ 'https://api.boldsign.com/v1/document/properties?documentId={documentId}' \
     -H 'accept: application/json' \
     -H 'X-API-KEY: {your-api-key}'
```

C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");
var documentClient = new DocumentClient(apiClient);
var documentProperties = documentClient.GetProperties("{documentId}");
```

Python

```python
import requests

url = "https://api.boldsign.com/v1/document/properties?documentId={documentId}"

payload={}
headers = {
  'accept': 'application/json',
  'X-API-KEY': '{your-api-key}'
}

response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
```

NodeJS

```js
const axios = require('axios');
const response = axios.get('https://api.boldsign.com/v1/document/properties', {
    params: {
        'documentId': '{documentId}'
    },
    headers: {
        'accept': 'application/json',
        'X-API-KEY': '{your API key}'
    }
});
```

{% /codetab %}

In the provided examples, replace `documentId` with the actual ID of the document for which you need to extend the expiry time. Once executed, the document properties will be retrieved in JSON, including `expiryDateType` and `expiryValue`.

Here, `expiryDateType` could be `Days`, `Hours`, or `SpecificDateTime`, while `expiryValue` will be a timestamp. You can convert this timestamp into a human-readable DateTime format.

## Extending the document expiry
The following code snippets demonstrate how to extend the document's expiry using the API:

**Code snippet**

{% codetab id="codetab2" %}

cURL

```shell
curl -X PATCH "https://api.boldsign.com/v1/document/extendExpiry?documentId={documentId}"
     -H 'X-API-KEY: {your API key}'
     -H "Content-Type: application/json"
     -d "{\"newExpiryValue\": \"2022-12-15\", \"warnPrior\": true}"
```

C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "{apikey}");
var documentclient = new DocumentClient(apiClient);
await documentclient.ExtendExpiryAsync("{documentId}", "2022-12-15", true).ConfigureAwait(false);
```

Python

```python
import requests 
import json 
url = "https://api.boldsign.com/v1/document/extendExpiry?documentId={documentId}" 
payload = json.dumps({ 

  "newExpiryValue": "2022-12-15", 
  "warnPrior": True 

}) 

headers = { 

  'X-API-KEY': '{your API key}', 
  'Content-Type': 'application/json' 

} 
response = requests.request("PATCH", url, headers=headers, data=payload) 
print(response.text) 
```

NodeJS

```js
const axios = require('axios'); 
axios.patch( 

    'https://api.boldsign.com/v1/document/extendExpiry', 

    { 
        newExpiryValue: '2022-12-15', 
        warnPrior: true 
    }, 

    { 
        params: { documentId: '{documentId}' }, 
        headers: { 
            'X-API-KEY': '{Your API key}', 
            'Content-Type': 'application/json' 
        } 
    } 
); 
```

{% /codetab %}

In the provided examples, replace `documentId` with the ID of the document that requires an extended expiry date. Adjust `newExpiryValue` based on the `expiryDateType` you obtained from the document properties. If the `expiryDateType` is `Days`, set the value in "yyyy-MM-dd" format (e.g., "2023-12-20"). If it is `Hours`, use an integer (e.g., "12"). For `SpecificDateTime`, use an ISO date-time format (e.g., "2023-12-20T01:30:00.000-05:00"). Ensure that `newExpiryValue` is greater than the original expiryValue.

Replace `warnPrior` with `true` or `false` to enable or disable sending a reminder one day before the new expiration date.

Upon executing the code, the document's expiry date will be successfully extended to the specified date.
