Restrict Send and Allow Save to Drafts

If you want to restrict users of your application to sending documents and instead only allow them to save the document in the Draft state, BoldSign provides the capability to customize toolbars for embedded requests. This enables you to hide the Send button and display only the Save button.

Follow these steps to seamlessly restrict sending and allow saving documents in drafts for embedded requests

In your application, create a user interface (UI) that allows users to input relevant information for the embedded document request. This information will be used to create the document.

For instance, collect user inputs for the following parameters:

  • Title
  • Message
  • Signers and more

However, when it comes to the parameters of the embedded send toolbars (e.g., ShowToolbar, ShowSaveButton, SendViewOption, etc.), it's important not to gather information from users. Instead, these parameters should already be predetermined within your application to restrict sending and to permit the saving of documents as drafts.

Here are example codes that demonstrate how to create an embedded document

curl -X POST 'https://api.boldsign.com/v1/document/createEmbeddedRequestUrl' \
    -H 'X-API-KEY: {your API key}' \
    -F 'Title=Sent from API Curl' \
    -F 'ShowToolbar=true' \
    -F 'ShowNavigationButtons=true' \
    -F 'ShowPreviewButton=true' \
    -F 'ShowSendButton=false' \
    -F 'ShowSaveButton=true' \
    -F 'SendViewOption=PreparePage' \
    -F 'ShowTooltip=false' \
    -F 'Locale=EN' \
    -F 'Message=This is document message sent from API Curl' \
    -F 'EnableSigningOrder=false' \
    -F 'Signers[0][Name]=Signer Name 1' \
    -F 'Signers[0][EmailAddress][email protected]' \
    -F 'Files=@{Your file Path};type=application/pdf'
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");

var documentClient = new DocumentClient(apiClient);

var documentRequest = new EmbeddedDocumentRequest
{
    Title = "Sent from API SDK",
    Message = "This is document message sent from API SDK",
    Signers = new List<DocumentSigner>
    {
        new DocumentSigner(
            signerName: "David",
            signerType: SignerType.Signer,
            signerEmail: "[email protected]",
            locale: Locales.EN),
    },
    Files = new List<IDocumentFile>
    {
        new DocumentFilePath
        {
            ContentType = "application/pdf",

            // directly provide file path
            FilePath = "{Your file path}",
        },
    },

    // customize page options
    SendViewOption = PageViewOption.PreparePage,
    Locale = Locales.EN,
    ShowToolbar = true,
    ShowNavigationButtons = true,
    ShowSaveButton = true,
    ShowPreviewButton = true,
    ShowSendButton = false,
    ShowTooltip = false,
};

var documentCreated = await documentClient.CreateEmbeddedRequestUrlAsync(documentRequest);

// url to send the document from your web application
var documentSendUrl = documentCreated.SendUrl;
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)
    
    form_fields = [
        boldsign.FormField(
            id = "Sign",
            fieldType = "Signature",
            pageNumber = 1,
            font = "Helvetica",
            bounds = boldsign.Rectangle(x = 50, y = 50, width = 200, height = 30),
            isRequired = True
        )
    ] 

    document_signer = boldsign.DocumentSigner(
        name = "Signer Name 1",
        emailAddress = "[email protected]",
        signerOrder = 1,
        signerType = "Signer",
        authenticationCode = "1123",
        privateMessage = "This is private message for signer",
        formFields = form_fields,
        locale = "EN"
    )

    embedded_document_request = boldsign.EmbeddedDocumentRequest(
        title = "Sent from API Python SDK",
        showToolbar = True,
        showNavigationButtons = True,
        showPreviewButton = True,
        showSendButton = False,
        showSaveButton = True,
        sendViewOption = "FillingPage",
        locale = "EN",
        showTooltip = False,
        redirectUrl = "https://boldsign.dev/sign/redirect",
        message = "This is document message sent from API Python SDK",
        enableSigningOrder = False,
        signers = [document_signer],
        files = ["YOUR_FILE_PATH"],           
    )

    embedded_send_created = document_api.create_embedded_request_url_document(
        embedded_document_request = embedded_document_request
    )
<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\DocumentApi;
use BoldSign\Model\{FormField, Rectangle, DocumentSigner, EmbeddedDocumentRequest};

$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('Signer Name 1');
$document_signer->setEmailAddress('[email protected]');
$document_signer->setSignerType('Signer');
$document_signer->setSignerOrder(1);
$document_signer->setFormFields([$form_field]);
$document_signer->setAuthenticationCode('123');
$document_signer->setPrivateMessage('This is private message for signer');
$document_signer->setLocale('EN');

$embedded_document_request = new EmbeddedDocumentRequest();
$embedded_document_request->setTitle('Sent from API PHP SDK');
$embedded_document_request->setShowToolbar(true);
$embedded_document_request->setShowNavigationButtons(true);
$embedded_document_request->setShowPreviewButton(true);
$embedded_document_request->setShowSendButton(false);
$embedded_document_request->setShowSaveButton(true);
$embedded_document_request->setSendViewOption('FillingPage');
$embedded_document_request->setLocale('EN');
$embedded_document_request->setShowTooltip(false);
$embedded_document_request->setRedirectUrl('https://boldsign.dev/');
$embedded_document_request->setMessage('This is document message sent from API PHP SDK');
$embedded_document_request->setEnableSigningOrder(false);
$embedded_document_request->setSigners([$document_signer]);
$embedded_document_request->setFiles(['YOUR_FILE_PATH']);

$embedded_send_created = $document_api->createEmbeddedRequestUrlDocument($embedded_document_request);
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");

DocumentApi documentApi = new DocumentApi(client);

FormField signatureField = new FormField();
signatureField.setId("Sign");
signatureField.setFieldType(FormField.FieldTypeEnum.SIGNATURE);
signatureField.setPageNumber(1);
signatureField.setFont(FormField.FontEnum.HELVETICA);
signatureField.setIsRequired(true);
Rectangle bounds = new Rectangle().x(100f).y(100f).width(100f).height(50f);
signatureField.setBounds(bounds);

DocumentSigner signer = new DocumentSigner();
signer.setName("Signer Name 1");
signer.setEmailAddress("[email protected]");
signer.setSignerOrder(1);
signer.setSignerType(DocumentSigner.SignerTypeEnum.SIGNER);
signer.setPrivateMessage("This is private message for signer");
signer.setAuthenticationCode("1234");
signer.setLocale(DocumentSigner.LocaleEnum.EN);
signer.setFormFields(Arrays.asList(signatureField));

EmbeddedDocumentRequest embeddedDocumentRequest = new EmbeddedDocumentRequest();

File file = new File("YOUR_FILE_PATH");  
embeddedDocumentRequest.setFiles(Arrays.asList(file));

embeddedDocumentRequest.setShowTooltip(false);
embeddedDocumentRequest.setMessage("This is document message sent from API java SDK");
embeddedDocumentRequest.setSigners(Arrays.asList(signer));
embeddedDocumentRequest.setLocale(EmbeddedDocumentRequest.LocaleEnum.EN);
embeddedDocumentRequest.setSendViewOption(EmbeddedDocumentRequest.SendViewOptionEnum.FILLING_PAGE);
embeddedDocumentRequest.setShowSaveButton(true);
embeddedDocumentRequest.setShowSendButton(true);
embeddedDocumentRequest.setShowPreviewButton(true);
embeddedDocumentRequest.setShowToolbar(true);
embeddedDocumentRequest.setShowNavigationButtons(true);
URI redirectUrl = URI.create("https://boldsign.dev/"); 
embeddedDocumentRequest.setRedirectUrl(redirectUrl);
embeddedDocumentRequest.setEnableSigningOrder(false);
embeddedDocumentRequest.setTitle("Sent from API java SDK");

EmbeddedSendCreated embeddedSendCreated = documentApi.createEmbeddedRequestUrlDocument(embeddedDocumentRequest);
import { DocumentApi, DocumentSigner, EmbeddedDocumentRequest, FormField, Rectangle } 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.id = "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 = "Signer Name 1";
documentSigner.emailAddress = "[email protected]";
documentSigner.signerOrder = 1;
documentSigner.signerType = DocumentSigner.SignerTypeEnum.Signer;
documentSigner.authenticationCode = "1234";
documentSigner.locale = DocumentSigner.LocaleEnum.En;
documentSigner.privateMessage = "This is private message for signer";
documentSigner.formFields = [formField];

const files = fs.createReadStream("YOUR_FILE_PATH");

const embeddedDocumentRequest = new EmbeddedDocumentRequest();
embeddedDocumentRequest.title = "Sent from API Node SDK";
embeddedDocumentRequest.showToolbar = true;
embeddedDocumentRequest.showTooltip = false;
embeddedDocumentRequest.showSaveButton = true;
embeddedDocumentRequest.showSendButton = true;
embeddedDocumentRequest.showPreviewButton = true;
embeddedDocumentRequest.locale = EmbeddedDocumentRequest.LocaleEnum.En;
embeddedDocumentRequest.message = "This is document message sent from API node SDK";
embeddedDocumentRequest.sendViewOption = EmbeddedDocumentRequest.SendViewOptionEnum.FillingPage;
embeddedDocumentRequest.showNavigationButtons = true;
embeddedDocumentRequest.redirectUrl = "https://boldsign.dev/sign/redirect";
embeddedDocumentRequest.enableSigningOrder = false;
embeddedDocumentRequest.files = [files];
embeddedDocumentRequest.signers = [documentSigner];

const embeddedSendCreated = documentApi.createEmbeddedRequestUrlDocument(embeddedDocumentRequest);

In the provided example, replace placeholders (Title, Message, etc.) with actual input values gathered from your application's UI. If your application supports multiple signers, tailor the UI accordingly. Adjust values within the Signers array to match your custom signers.

To restrict users from sending and allow them to save documents in drafts, set the button options (ShowSaveButton to true and ShowSendButton to false) in the cURL request.

Executing the provided code will generate an embed link, and the document will be saved in draft status within your BoldSign account.

Once the embed link is generated, integrate it into an iFrame within your application. This iFrame enables your application users to:

  • Add extra signers
  • Upload additional documents
  • Configure form fields

However, users will not be able to send the document to the signer; they can only save the document in draft status.