How to request a signature with Signer Authentication (Email, Access Code, or SMS) using BoldSign API?
Authentication is the process of verifying the identity of a user, adding an additional layer of security to the document signing process. BoldSign supports multiple authentication methods, including Email OTP, SMS OTP, and access code authentication, to verify the signers.
- AccessCode - A set of alphanumeric characters specified by the sender to the recipient for accessing the document. The sender needs to provide the secure code directly to the recipient.
- EmailOTP - A system-generated one-time password delivered to the recipient's mailbox, required to access the document.
- SMSOTP - A system-generated one-time password delivered to the recipient's phone number, required to access the document.
Code snippet
The following sample code snippet requests the EmailOTP authentication to be added to one of the document's recipients.
curl -X 'POST' \ 'https://api.boldsign.com/v1/document/send' \ -H 'accept: application/json' \ -H 'X-API-KEY: {your API key}' \ -H 'Content-Type: multipart/form-data' \ -F 'Signers={ "name": "hanky", "emailAddress": "hankyWhites@gmail.com", "signerType": "Signer", "signerRole": "Signer", "authenticationType": "EmailOTP", "formFields": [ { "id": "signid", "fieldType": "Signature", "pageNumber": 1, "bounds": { "x": 50, "y": 100, "width": 100, "height": 60 }, "isRequired": true } ] } ' \ -F 'Files=@{your file}'
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API key}"); var documentClient = new DocumentClient(apiClient); var documentFilePath = new DocumentFilePath { ContentType = "application/pdf", FilePath = "{Your File path}" }; var filesToUpload = new List<IDocumentFile> { documentFilePath, }; var signatureField = new FormField( id: "sign", isRequired: true, type:FieldType.Signature, pageNumber: 1, bounds: new Rectangle(x: 100, y: 100, width: 100, height: 50)); var formFieldCollections = new List<FormField>() { signatureField }; var signer = new DocumentSigner( signerName: "hanky", signerEmail: "hankyWhites@gmail.com", formFields: formFieldCollections, authenticationType: AuthenticationType.EmailOTP, locale: Locales.EN); var documentSigners = new List<DocumentSigner>() { signer }; var sendForSign = new SendForSign() { Signers = documentSigners, Files = filesToUpload }; var documentCreated = documentClient.SendDocument(sendForSign); Console.WriteLine(documentCreated.DocumentId);
import requests import json url = "https://api.boldsign.com/v1/document/send" signer_data = { "name": "hanky", "emailAddress": "hankyWhites@gmail.com", "signerType": "Signer", "signerRole": "Signer", "authenticationType": "EmailOTP", "formFields": [ { "id": "signid", "fieldType": "Signature", "pageNumber": 1, "bounds": { "x": 50, "y": 100, "width": 100, "height": 60 }, "isRequired": true } ], "locale": "EN" } payload = { 'Signers': json.dumps(signer_data) } files = [ ('Files', ('{Your file name}', open('{Your file path}', 'rb'), 'application/pdf')) ] headers = { 'accept': 'application/json', 'X-API-KEY': '{Your API key}' } response = requests.post(url, headers=headers, data=payload, files=files) print(response.text)
const axios = require('axios'); const fs = require('fs'); const FormData = require('form-data'); let formData = new FormData(); // Append Signers as an object, not a string formData.append('Signers', JSON.stringify({ name: "hanky", emailAddress: "hankyWhites@gmail.com", signerType: "Signer", signerRole: "Signer", authenticationType: "EmailOTP", formFields: [ { id: "signid", fieldType: "Signature", pageNumber: 1, bounds: { x: 50, y: 100, width: 100, height: 60 }, isRequired: true } ], locale: "EN" })); // Append the file using a specific filename for the 'Files' property formData.append('Files', fs.createReadStream("{Your file path}"), { filename: '{Your file name}' }); let config = { method: 'post', maxBodyLength: Infinity, url: 'https://api.boldsign.com/v1/document/send', headers: { 'accept': 'application/json', 'X-API-KEY': '{Your API Key}', 'Content-Type': 'multipart/form-data', ...formData.getHeaders() }, data: formData, }; axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.error(error); });
In the above code example, we have enabled EmailOTP authentication. Similarly, please refer to this link for SMS authentication, and use this link for Access code authentication.
Note: It's important to note that SMS authentication can be added to the document only for paid plans.