BoldSign AI Assistant
Chat with the BoldSign AI AssistantSend document on behalf of others using oauth
BoldSign enables performing actions on behalf of another user, thereby enhancing document management. This feature enables users to dispatch documents on behalf of other individuals.
To make use of this feature, it's necessary to obtain approval from an individual to use their email address to send documents on their behalf.
Follow these steps to send document on behalf of another individual
Create sender identity
Create a sender identity by using the name and email address of the individual to send documents on their behalf.
Here are example codes you can use to create a sender identity:
Code snippet
curl -X 'POST' \
'https://api.boldsign.com/v1/senderIdentities/create' \
-H 'accept: */*' \
-H 'X-API-KEY: {your API key}' \
-H 'Content-Type: application/json;' \
-d '{
"name": "Sender identity",
"email": "[email protected]"
}'
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");
var senderIdentityClient = new SenderIdentityClient(apiClient);
var senderIdentityRequest = new SenderIdentityRequest("Luther Cooper", "[email protected]",null);
var senderIdentityCreated = senderIdentityClient.CreateSenderIdentity(senderIdentityRequest);
import boldsign
configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key = "YOUR_API_KEY")
with boldsign.ApiClient(configuration) as api_client:
sender_identities_api = boldsign.SenderIdentitiesApi(api_client)
create_sender_identity_request = boldsign.CreateSenderIdentityRequest(
name = "Luther Cooper",
email = "[email protected]"
)
sender_identities_api.create_sender_identities(
create_sender_identity_request = create_sender_identity_request
)
<?php require_once "vendor/autoload.php";
use BoldSign\Configuration;
use BoldSign\Api\SenderIdentitiesApi;
use BoldSign\Model\CreateSenderIdentityRequest;
$config = new Configuration();
$config->setHost("https://api.boldsign.com");
$config->setApiKey('YOUR_API_KEY');
$sender_identities_api = new SenderIdentitiesApi($config);
$sender_identity_request = new CreateSenderIdentityRequest();
$sender_identity_request->setName('Luther Cooper');
$sender_identity_request->setEmail('[email protected]');
$sender_identities_api->createSenderIdentities($sender_identity_request);
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
SenderIdentitiesApi senderIdentitiesApi = new SenderIdentitiesApi(client);
CreateSenderIdentityRequest senderIdentityRequest = new CreateSenderIdentityRequest();
senderIdentityRequest.setName("Luther Cooper");
senderIdentityRequest.setEmail("[email protected]");
senderIdentitiesApi.createSenderIdentities(senderIdentityRequest);
import { SenderIdentitiesApi, CreateSenderIdentityRequest } from "boldsign";
const senderIdentitiesApi = new SenderIdentitiesApi("https://api.boldsign.com");
senderIdentitiesApi.setApiKey("YOUR_API_KEY");
const createSenderIdentityRequest = new CreateSenderIdentityRequest();
createSenderIdentityRequest.name = "Luther Cooper";
createSenderIdentityRequest.email = "[email protected]";
senderIdentitiesApi.createSenderIdentities(createSenderIdentityRequest);
In the above example, replace the name and email with the name and email of the individual that you want to send the documents on their behalf. Then, provide the notificationSettings to customize how sender identity should recieve email notification for the documents sent on behalf of them. For example, if viewed is set to true, an email will be automatically sent to the sender identity email address when the document is viewed by the signers.
After executing the above request, an approval email will be sent to the mentioned email address. Using the link within this email, the sender can assess the request and provide authorization for you to send documents using their email address. Once the sender grants approval, the requesting user gains the ability to send documents on behalf of the approving user.
Create OAuth app
To send a document using OAuth authorization, it's necessary to create an OAuth app. Subsequently, generate a Bearer token using the client ID and client secret ID obtained from the created OAuth app, which should then be employed for the purpose of authorization.
Follow these steps to create Oauth App:
Click on the
Oauth Appsoption under the API category from the left sidebar.
Click the
Create Appbutton on the right side of the page.Enter the application name and any other required details in the dialog box that appears. Then, click the
Savebutton to create the OAuth app.
Once created, client ID and client secret ID will be generated.
Use the client ID and client secret ID to generate a bearer token.
Send document on behalf of others using OAuth
Here are example codes that can be used to do this:
Code snippet
curl -X 'POST' \ 'https://api.boldsign.com/v1/document/send' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your bearer token}' \
-H 'Content-Type: multipart/form-data' \
-F 'OnBehalfOf=' \
-F 'Message=' \
-F 'Signers={
"name": "Hanky",
"emailAddress": "[email protected]",
"signerType": "Signer",
"formFields": [
{
"id": "string",
"name": "string",
"fieldType": "Signature",
"pageNumber": 1,
"bounds": {
"x": 50,
"y": 50,
"width": 1,
"height": 1
},
"isRequired": true
}
],
"locale": "EN"
}' \
-F 'Files={your file}' \
-F 'Title={title}' \
var configuration = new Configuration();
// set your OAuth2 Access Token for authentication.
configuration.SetBearerToken("your-oauth2-token");
var apiClient = new ApiClient(configuration);
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: "David",
signerType: SignerType.Signer,
signerEmail: "[email protected]",
formFields: formFieldCollections,
locale: Locales.EN);
var documentSigners = new List<DocumentSigner>()
{
signer
};
var sendForSign = new SendForSign()
{
Message = "please sign this",
Title = "Agreement",
OnBehalfOf = "",
Signers = documentSigners,
Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
import boldsign
configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key = "YOUR_API_KEY")
with boldsign.ApiClient(configuration) as api_client:
document_api = boldsign.DocumentApi(api_client)
send_for_sign = boldsign.SendForSign(
title = "Document SDK API",
document_title = "SDK Document Test case",
description = "Testing document from SDK integration test case",
files = ["YOUR_FILE_PATH"],
signers = [
boldsign.DocumentSigner(
name = "Hanky",
emailAddress = "[email protected]",
signerOrder = 1,
signerType = "Signer",
formFields = [
boldsign.FormField(
name = "Sign",
fieldType = "Signature",
font = "Helvetica",
pageNumber = 1,
isRequired = True,
bounds = boldsign.Rectangle(x = 50, y = 50, width = 100, height = 150)
)
],
privateMessage = "This is private message for signer"
)
],
onBehalfOf = "YOUR_BEHALF_EMAIL"
)
document_created = document_api.send_document(send_for_sign)
<?php require_once "vendor/autoload.php";
use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{FormField, Rectangle, DocumentSigner, SendForSign, DocumentInfo, FileInfo};
$config = new Configuration();
$config->setHost("https://api.boldsign.com");
$config->setApiKey('YOUR_API_KEY');
$document_api = new DocumentApi($config);
$form_field = new FormField();
$form_field->setName('Sign');
$form_field->setFieldType('Signature');
$form_field->setPageNumber(1);
$form_field->setFont('Helvetica');
$form_field->setIsRequired(true);
$bounds = new Rectangle([50, 50, 100, 150]);
$form_field->setBounds($bounds);
$document_signer = new DocumentSigner();
$document_signer->setName('Hanky');
$document_signer->setEmailAddress('[email protected]');
$document_signer->setSignerOrder(1);
$document_signer->setSignerType('Signer');
$document_signer->setFormFields([$form_field]);
$document_signer->setPrivateMessage('This is private message for signer');
$send_for_sign = new SendForSign();
$documentInfo = new DocumentInfo();
$documentInfo->setTitle('Document SDK API');
$documentInfo->setDescription('Testing document from SDK integration test case');
$send_for_sign->setDocumentInfo([$documentInfo]);
$files = new FileInfo();
$files = 'YOUR_FILE_PATH';
$send_for_sign->setFiles([$files]);
$send_for_sign->setTitle('SDK Document Test case');
$send_for_sign->setSigners([$document_signer]);
$send_for_sign->setOnBehalfOf('ON_BEHALF_OF_EMAIL');
$document_created = $document_api->sendDocument($send_for_sign);
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");
DocumentApi documentApi = new DocumentApi(client);
FormField formField = new FormField();
formField.setName("Sign");
formField.setFieldType(FormField.FieldTypeEnum.SIGNATURE);
formField.setPageNumber(1);
formField.setFont(FormField.FontEnum.HELVETICA);
formField.setIsRequired(true);
Rectangle bounds = new Rectangle().x(100f).y(100f).width(100f).height(50f);
formField.setBounds(bounds);
DocumentSigner signer = new DocumentSigner();
signer.setName("Hanky");
signer.setEmailAddress("[email protected]");
signer.setSignerOrder(1);
signer.setSignerType(DocumentSigner.SignerTypeEnum.SIGNER);
signer.setFormFields(Arrays.asList(formField));
signer.setPrivateMessage("This is private message for signer");
SendForSign sendForSign = new SendForSign();
File file = new File("YOUR_FILE_PATH");
sendForSign.setFiles(Arrays.asList(file));
sendForSign.setSigners(Arrays.asList(signer));
sendForSign.setTitle("Document SDK API");
sendForSign.setOnBehalfOf("ON_BEHALF_OF_EMAIL");
DocumentCreated documentCreated = documentApi.sendDocument(sendForSign);
import { DocumentApi, DocumentSigner, DocumentInfo, FormField, Rectangle, SendForSign } from "boldsign";
import * as fs from 'fs';
const documentApi = new DocumentApi("https://api.boldsign.com");
documentApi.setApiKey("YOUR_API_KEY");
const bounds = new Rectangle();
bounds.x = 100;
bounds.y = 50;
bounds.width = 100;
bounds.height = 100;
const formField = new FormField();
formField.name = "Sign";
formField.fieldType = FormField.FieldTypeEnum.Signature;
formField.font = FormField.FontEnum.Helvetica;
formField.pageNumber = 1;
formField.isRequired = true;
formField.bounds = bounds;
const documentSigner = new DocumentSigner();
documentSigner.name = "David";
documentSigner.emailAddress = "[email protected]";
documentSigner.signerOrder = 1;
documentSigner.signerType = DocumentSigner.SignerTypeEnum.Signer;
documentSigner.formFields = [formField];
documentSigner.privateMessage = "This is private message for signer";
const files = fs.createReadStream("YOUR_FILE_PATH");
const sendForSign = new SendForSign();
const documentInfo = new DocumentInfo();
documentInfo.title = "SDK Document Test case";
documentInfo.description = "Testing document from SDK integration test case";
sendForSign.documentInfo = [documentInfo];
sendForSign.title = "Document SDK API";
sendForSign.signers = [documentSigner];
sendForSign.files = [files];
sendForSign.onBehalfOf = "ON_BEHALF_OF_EMAIL";
const documentCreated = documentApi.sendDocument(sendForSign);
In the above example, Authorize the API request with the bearer token generated from the above-mentioned steps, prefixed with the word Bearer. Replace Files, Title, and Signers with necessary details.
In the OnBehalfOf field, include only the email ID of the user who has been set as the sender identity. Once the required fields are filled, execute the above codes and document will be created if the fields filled are in required format.
By following these steps, a document can be sent on behalf of another user using Oauth in BoldSign successfully.