How to add access code authentication for the signer after sending the document?

BoldSign allows you to add access code authentication even after a document has been sent for signature.

To authenticate signers using an access code via the BoldSign API, set the AuthenticationType to AccessCode and specify a unique code (e.g., “1234”) in the AccessCode property. This access code will be required when the sender wishes to verify the signer's identity using a specific code. The access code should be communicated to the signer personally in advance.

The following sample code snippets demonstrate how to add access code authentication for one of a document's recipients.

Code snippet

curl -X PATCH "https://api.boldsign.com/v1/document/addAuthentication?documentId={Your document id}"
      -H -H 'X-API-KEY: {Your API Key}'
-H "Content-Type: application/json"
      -d "{\"accessCode\": \"345678\", \"authenticationType\": \"AccessCode\", \"emailId\": \"alexgayle@cubeflakes.com\"}"

using BoldSign.Api;
using BoldSign.Model;

var apiClient = new ApiClient("https://api.boldsign.com", "{Your API Key}");
var documentclient = new DocumentClient(apiClient);
await documentclient.AddAuthenticationAsync("{Your document id}", "alexgayle@cubeflakes.com", AuthenticationType.AccessCode, null, "45678").ConfigureAwait(false);
import requests
import json
url = "https://api.boldsign.com/v1/document/addAuthentication?documentId={Your document id}"
payload = json.dumps({
  "accessCode": "j9089",
  "authenticationType": "AccessCode",
  "emailId": "alexgayle@cubeflakes.com"
})
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 addAuthentication() {
  try {
    const response = await axios.patch(
      'https://api.boldsign.com/v1/document/addAuthentication',
      {
        accessCode: '823456',
        authenticationType: 'AccessCode',
        emailId: 'alexgayle@cubeflakes.com' 
      },
      {
        params: { documentId: '{Your document id}' },
        headers: {
          'X-API-KEY': '{Your API Key}',
          'Content-Type': 'application/json'
        }
      }
    );
    console.log(JSON.stringify(response.data));
    return response;
  } catch (error) {
    console.error('Error:', error.message);
    throw error;
  }
}

addAuthentication(); 
<?php
require_once "vendor/autoload.php";
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;

$client = new Client([   'verify' => false]);
$headers = [
  'X-API-KEY' => '{Your API Key}',
  'Content-Type' => 'application/json'
];
$body = '{
  "accessCode": "456234",
  "authenticationType": "AccessCode",
  "emailId": "alexgayle@cubeflakes.com"
}';
$request = new Request('PATCH', 'https://api.boldsign.com/v1/document/addAuthentication?documentId={Your document id}', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
 

In the provided code examples, make sure to update the authenticationType to AccessCode and specify the unique value to the accessCode. Replace the documentId with the actual ID of the document you created and update SignerEmail with the signer's email address.

After executing the code, the document will be secured with access code authentication, and the signer will only be able to access the document by providing the correct access code.