How to request eSignature via SMS (Text Messages) using BoldSign API?
BoldSign offers options to send the documents to signers via SMS. This article guides you on how to send a document for signing via SMS using the BoldSign API.
Send document to the signer via SMS(Text messages)
Below are example codes for sending a document to the signer via SMS:
Code snippet
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 'Message=Please sign this' \ -F 'Signers={ "name": "David", "deliveryMode":"SMS", "phoneNumber": { "countryCode": "{signer country code}", "number": "{signer phone number}" }, "signerType": "Signer", "signerRole": "Signer", "formFields": [ { "id": "signer", "fieldType": "Signature", "pageNumber": 1, "bounds": { "x": 50, "y": 100, "width": 100, "height": 60 }, "isRequired": true } ] }' \ -F 'Files=@{your file path}' \
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: "signature", isRequired: true, type: FieldType.Signature, pageNumber: 1, bounds: new BoldSign.Model.Rectangle(x: 100, y: 100, width: 125, height: 25)); var formFieldCollections = new List<FormField>() { signatureField }; var signer = new DocumentSigner( signerName: "David", phoneNumber: new PhoneNumber( countryCode: "{signer country code}", number: "{signer phone number}"), formFields: formFieldCollections, locale: Locales.EN); signer.DeliveryMode = DeliveryMode.SMS; var documentSigners = new List<DocumentSigner>() { signer }; var sendForSign = new SendForSign() { Signers = documentSigners, Title = "Sample Document", Message="Please sign this", Files = filesToUpload }; var documentCreated = documentClient.SendDocument(sendForSign); Console.WriteLine(documentCreated.DocumentId.ToString());
import requests import json url="https://api.boldsign.com/v1/document/send" signer_data = { "name": "David", "phoneNumber": { "countryCode": "{signer country code}", "number": "{signer phone number}" }, "signerType": "Signer", "deliveryMode": "SMS", "signerRole": "Signer", "formFields": [ { "id": "Signature", "type": "FieldType.Signature", "pageNumber": 1, "bounds": { "x": 100, "y": 100, "width": 200, "height": 100 }, "isRequired": True, } ], "locale": "EN" } headers = { 'accept': 'application/json', 'X-API-KEY': '{your API key}' } payload = { 'Signers': json.dumps(signer_data), 'Title': "Sample Document", 'Message': "Please sign this" } files = [ ('Files', ('{your file name}', open('your file path', 'rb'), 'application/pdf')) ] response = requests.post(url, headers=headers, data=payload, files=files) print(response.text)
const axios = require('axios'); const FormData = require('form-data'); const fs = require('fs'); const form = new FormData(); form.append('Message', 'Please sign this.'); form.append('Signers', '{\n "name": "David",\n "deliveryMode":"SMS",\n "phoneNumber":{"countryCode":"{signer country code}","number":"{signer phone number}"},\n "formFields": [\n {\n "fieldType": "Signature",\n "pageNumber": 1,\n "bounds": {\n "x": 100,\n "y": 100,\n "width": 100,\n "height": 50\n },\n "isRequired": true\n }\n ]\n}'); form.append('Files', fs.createReadStream('{your file path}')); form.append('Title', 'Sample document'); let config = { method: 'post', maxBodyLength: Infinity, url: 'https://api.boldsign.com/v1/document/send', headers: { 'accept': 'application/json', 'X-API-KEY': '{Your API key}', ...form.getHeaders() }, data : form }; axios.request(config) .then((response) => { console.log(JSON.stringify(response.data)); }) .catch((error) => { console.log(error); });
In the above examples, update the phonenumber
with the phone number(along with country code) of the signer. Update the deliveryMode
as SMS
. Additionally, replace the Files
and Title
properties with the appropriate document you want to send and its title. Also, provide form fields for the document in the formFields
array.
After executing the above code, the document will be created, and an SMS(Text Messages) will be sent to the signer. Now, the signer can sign the document by clicking the link in the SMS(Text Messages).