# Extend document expiry

{% patch /%}
{% path text="/v1/document/extendExpiry" /%}

The sender and its admin can only extend the expiration date of a document. Additionally, you can also notify the recipient one day prior to the expiry date.

You cannot perform this action to reduce the expiry date of a document, and this action can only be performed on documents that have not been signed yet.

## Code snippet

{% codetab %}

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", "Your_API_Key");

var documentClient = new DocumentClient(apiClient);
documentClient.ExtendExpiry("YOUR_DOCUMENT_ID", "YOUR_EXPIRY_DATE");
```

Python

```python
import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:
    
    document_api = boldsign.DocumentApi(api_client)
	
    extend_expiry = boldsign.ExtendExpiry(newExpiryValue="YOUR_EXPIRY_DATE")

    document_api.extend_expiry(document_id="YOUR_DOCUMENT_ID", extend_expiry=extend_expiry)
```

PHP

```php
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\ExtendExpiry;

$config = new Configuration();
$config->setHost('https://api.boldsign.com');
$config->setApiKey('YOUR_API_KEY');

$document_api = new DocumentApi($config);

$extend_expiry = new ExtendExpiry(); 
$extend_expiry->setNewExpiryValue('YOUR_EXPIRY_DATE');

$document_api->extendExpiry($document_id = 'YOUR_DOCUMENT_ID', $extend_expiry);
```

Java

```java
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
			
DocumentApi documentApi = new DocumentApi(client);

ExtendExpiry extendExpiry = new ExtendExpiry();
extendExpiry.setNewExpiryValue("YOUR_EXPIRY_DATE");

documentApi.extendExpiry("YOUR_DOCUMENT_ID", extendExpiry);
```

NodeJS

```js
import { DocumentApi, ExtendExpiry } from "boldsign";

const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");

const extendExpiry = new ExtendExpiry();
extendExpiry.newExpiryValue = "YOUR_EXPIRY_DATE";

documentApi.extendExpiry("YOUR_DOCUMENT_ID", extendExpiry);
```

{% /codetab %}

## Query parameters

{% nestedtable %}

- {% arguments name="documentId" /%}{% batch datatype="string" /%}{% required /%}
- ID of the requested document

{% /nestedtable %}

## Request body

{% nestedtable %}

- {% arguments name="NewExpiryValue" /%}{% batch datatype="string($date)" /%}{% required /%}
- New expiry date of the document. The expiration date must not exceed 180 days from the document creation date. If the document’s default expiry date type is specified as **Days,** set the new extended expiry value in yyyy-MM-dd format (‘2022-12-15’). If the document’s default expiry date type is specified as **Hours,** set the new extended expiry value in integer format (‘12’). If the document’s default expiry date type is specified as **Specific Date and Time,** set the new extended expiry value in ISO date time format (‘2022-12-15T10:58:04.863Z’). 

---

- {% arguments name="OnBehalfOf" /%}{% batch datatype="string" /%}
- If the document is created on behalf of the sender, the sender's identity email address must be specified.

---

- {% arguments name="WarnPrior" /%}{% batch datatype="Boolean" /%}
- If the value is null, the existing document configuration will be used. If the value is true, a signing notification mail will be sent one day before the expiration date. If the value is false, one day before signing notification mail will not be sent.

{% /nestedtable %}

## Example response

***200 Success***
