How to change the access code for a signer to access the document via the API?

BoldSign provides various authentication methods to verify a signer's identity, including Email OTP (One-Time Password), SMS OTP (One-Time Password), Access Code, and ID verification. These methods can be applied to signers during the document creation process. If you have configured access code authentication and sent the document, you might need to update the access code for the signer after the document has been dispatched. BoldSign allows for updating the access code even after the document has been sent. Please note that only the sender has the authority to modify the access code for the document.

Below is an example code snippet demonstrating how to update the access code for a specific recipient of a document.

Code snippet

curl -X PATCH "https://api.boldsign.com/v1/document/changeAccessCode?documentId={Your document id}&[email protected]" 
    -H 'X-API-KEY:{Your API Key}' 
    -H "Content-Type: application/json" 
    -d "{\"accessCode\": \"123456\"}"


using BoldSign.Api;

var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}");
var documentclient = new DocumentClient(apiClient);
await documentclient.ChangeAccessCodeAsync("{Your document id}", "[email protected]","56789").ConfigureAwait(false;

import requests
import json

url = "https://api.boldsign.com/v1/document/changeAccessCode?documentId={Your document id}&[email protected]"

payload = json.dumps({
  "accessCode": "78996"
})
headers = {
  'X-API-KEY': '{Your API Key}',
  'Content-Type': 'application/json'
}

response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
 
const axios = require('axios'); 
async function ChangeAccessCode() {
    try {
   const response = await axios.patch( 
        'https://api.boldsign.com/v1/document/changeAccessCode?documentId={Your document id}&[email protected]', 

    { 
        accessCode:"124410"
    }, 

    { 
        
        headers: { 
          'X-API-KEY': '{Your API Key}', 
          'Content-Type': 'application/json' 
        } 
    } 
); 
return response;   
    }
    catch (error)
     {
        console.error('Error:', error.message);
        throw error;
     }
}

ChangeAccessCode(); 
<?php

require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client([
    'verify' => false
]);

$documentId = '{Your document id}'; // Replace with your document ID
$apiKey = '{Your API Key}'; // Replace with your API key
$emailId = '[email protected]';

$url = "https://api.boldsign.com/v1/document/changeAccessCode?documentId={$documentId}&emailId={$emailId}";

$payload = json_encode([
    'accessCode' => '88356'
]);

$response = $client->request('PATCH', $url, [
    'headers' => [
        'X-API-KEY' => $apiKey,
        'Content-Type' => 'application/json'
    ],
    'body' => $payload
]);

echo $response->getBody();


In the provided code examples, make sure to update the documentId with the actual ID of the document you created and the emailId with the signer's email address. After executing the code, the access code for the signature request document will be updated. The recipient will need to provide the latest access code to access the document.