DEV Community

Cover image for How to Change the Recipient of an eSignature Document via API
Vijay Amalan for BoldSign

Posted on • Originally published at boldsign.com

How to Change the Recipient of an eSignature Document via API

Sending a document to the wrong signer can be stressful. BoldSign provides a straightforward option to change the recipient if the signer has yet to sign. This guide outlines the steps to do that.

Editing the recipient via BoldSign API

BoldSign provides an API that allows you to programmatically change the recipient of a document by providing the following details:

  • Document ID
  • New signer details
  • Old signer email
  • Reason for changing the signer

The recipients of the document cannot be changed if the signing process is in any one of the following states:

  • Signed
  • Declined
  • Revoked
  • Expired

If the document had two or more recipients and either of the recipients has signed, you can still edit the recipients that have yet to sign the document. The old recipient will receive an email notification regarding the changes made.

Code snippets

The following are the code examples in different programming languages to assist you in achieving this task.

Curl

    curl -X 'PATCH' \ 'https://api.boldsign.com/v1/document/changeRecipient?documentId={Your document Id}' \
         -H 'X-API-KEY: {your API key}' \
         -H 'Content-Type: application/json' \
         -d '{
      "newSignerName": "{New signer name}",
      "reason": "{Reason to change signer}",
      "newSignerEmail": "{Old signer email}",
      "oldSignerEmail": "{New signer email}"
    }'
Enter fullscreen mode Exit fullscreen mode

C#

    var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");
    var documentClient = new DocumentClient(apiClient);
    documentClient.ChangeRecipient("{Your document Id}",    "{Old signer email}", "{Reason to change signer}", "{New signer name}", "{New signer email}");
Enter fullscreen mode Exit fullscreen mode

Python

    import requests
    import json
    url = "https://api.boldsign.com/v1/document/changeRecipient?documentId={Your document Id}"
    payload = json.dumps({
      "newSignerName": "{New signer name}",
      "reason": "{Reason to change signer}",
      "newSignerEmail": "{New signer email}",
      "oldSignerEmail": "{Old signer email}"
    })
    headers = {
      'X-API-KEY': '{your API key}',
      'Content-Type': 'application/json'
    }
Enter fullscreen mode Exit fullscreen mode

Node js

    const axios = require('axios');
    let data = JSON.stringify({
      "newSignerName": "{New signer name}",
      "reason": "{Reason to change signer}",
      "newSignerEmail": "{New signer email}",
      "oldSignerEmail": "{Old signer email}"
    });
    let config = {
      method: 'patch',
      maxBodyLength: Infinity,
      url: 'https://api.boldsign.com/v1/document/changeRecipient?documentId={Your document Id}',
      headers: { 
        'X-API-KEY': '{your API key}', 
        'Content-Type': 'application/json'
      },
      data : data
    };
    axios.request(config)
    .then((response) => {
      console.log(JSON.stringify(response.data));
    })
    .catch((error) => {
      console.log(error);
    }); 
Enter fullscreen mode Exit fullscreen mode

PHP

    <?php
    require_once "vendor/autoload.php";
    use GuzzleHttp\Client;
    use GuzzleHttp\Psr7\Request;
    $documentId = '{Your document Id}';
    $apiKey = '{your API key}';
    $newSignerName = '{New signer name}';
    $reason = '{Reason to change signer}';
    $newSignerEmail = '{New signer email}';
    $oldSignerEmail = '{Old signer email}';
    $client = new Client();
    $headers = [
        'accept' => 'application/json',
        'X-API-KEY' => $apiKey,
        'Content-Type' => 'application/json'
    ];
Enter fullscreen mode Exit fullscreen mode

Conclusion

Fixing errors when you send documents for signature doesn’t need to be difficult. Using BoldSign’s API, you can easily change the recipient of an unsigned document, making sure it gets to the right person. Start your 30-day free BoldSign trial today and see how easy is to change your document recipients for yourself.

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.

Related blogs

Note: This blog was originally published at boldsign.com

Top comments (0)