Articles in this section
Category / Section

How to set hyperlink form fields while making an electronic signature request via API?

Published:
8 mins read

BoldSign supports including a hyperlink when sending the document for a signing request. When signers click the hyperlink, they will be directed to the specified webpage or file. This is useful for providing additional information or resources related to the document being signed.

Sending a document to the signer with hyperlink form fields:

Specify the fieldType as Hyperlink, and provide the hyperlinkText (Text to Display) along with the Hyperlink URL within the value property.

Please note that it is mandatory that you need to add any other form fields, other than dateSigned and label for a signing request while setting the hyperlink form field.

Code snippet

cURL

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 'Title="Sample Document"' \
  -F 'Signers={
  "name": "hanky",
  "emailAddress": "hankyWhites@gmail.com",
  "signerType": "Signer",
  "signerRole": "Signer",
  "formFields": [
      {
        "id": "HyperLink",
        "name": "HyperLink",
        "fieldType": "HyperLink",
        "pageNumber": 1,
        "bounds": {
            "x": 50,
            "y": 600,
            "width": 150,
            "height": 50
        },
        "hyperlinkText": "hyperlinkText",
        "value": "https://www.google.com"
    },
     {
      "id": "Attachment",
      "name": "Attachment",
      "fieldType": "Attachment",
      "pageNumber": 1,
      "bounds": {
        "x": 100,
        "y": 100,
        "width": 125,
        "height": 25
      },
      "attachmentInfo": {
        "title": "Attachment title",
        "description": "Please attach the proof",
        "acceptedFileTypes": ["PDF", "DOCUMENT", "IMAGE"]
      }
    }
  ],
  "locale": "EN"
}' \
  -F 'Files=@{your file}' \

C#

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 hyperlinkField = new FormField(
    id: "Hyperlink",
    isRequired: true,
    type: FieldType.Hyperlink,
    pageNumber: 1,
    hyperlinkText: "Click here",
    value: "https://www.google.com",
    bounds: new Rectangle(x: 400, y: 200, width: 125, height: 25));

var attachmentField = new FormField(
    id: "Attachment",
    isRequired: true,
    type: FieldType.Attachment,
    pageNumber: 1,
    attachmentInfo: new AttachmentInfo(title: "Attachment title", description: "Please attach the proof", acceptedFileTypes: ["PDF", "DOCUMENT", "IMAGE"]),
    bounds: new Rectangle(x: 400, y: 100, width: 125, height: 25));

var formFieldCollections = new List<FormField>()
{
    hyperlinkField,
    attachmentField
};

var signer = new DocumentSigner(
    signerName: "David",
    signerEmail: "david@cubeflakes.com",
    formFields: formFieldCollections,
    locale: Locales.EN);

var documentSigners = new List<DocumentSigner>()
{
    signer
};

var sendForSign = new SendForSign()
{
    Signers = documentSigners,
    Title = "Sample Document",
    Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);

Python

import boldsign

configuration = boldsign.Configuration(
    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="hankyWhites@cubeflakes.com",
                      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)
                            ),
                            boldsign.FormField(
                                name="HyperLink",
                                fieldType="Hyperlink",
                                font="Helvetica",
                                pageNumber=1,
                                isRequired=True,
                                bounds=boldsign.Rectangle(x=50, y=50, width=100, height=150),
                                hyperlinkText= "hyperlinkText",
                                value= "https://www.google.com"
                            )
                    ],
                    privateMessage="This is private message for signer"
                )
            ]
    )
    
    send_document_response = document_api.send_document(send_for_sign)

NodeJS

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const url = "https://api.boldsign.com/v1/document/send";
const signer_data = {
  "name": "David",
  "emailAddress": "david@cubeflakes.com",
  "signerType": "Signer",
  "formFields": [
         {
        "id": "HyperLink",
        "name": "HyperLink",
        "fieldType": "HyperLink",
        "pageNumber": 1,
        "bounds": {
            "x": 50,
            "y": 600,
            "width": 150,
            "height": 50
        },
        "hyperlinkText": "hyperlinkText",
        "value": "https://www.google.com"
    },
    {
      "id": "Attachment",
      "name": "Attachment",
      "fieldType": "Attachment",
      "pageNumber": 1,
      "bounds": {
        "x": 100,
        "y": 100,
        "width": 125,
        "height": 25
      },
      "attachmentInfo": {
        "title": "Attachment title",
        "description": "Please attach the proof",
        "acceptedFileTypes": ["PDF", "DOCUMENT", "IMAGE"]
      }
    }
  ],
  "locale": "EN",
};

const formData = new FormData();
formData.append('Signers', JSON.stringify(signer_data));
formData.append('Title', 'Sample Document');
formData.append('Files', fs.createReadStream('{Your file path}'));

const headers = {
  ...formData.getHeaders(),
  'X-API-KEY': '{Your API}'
};

axios.post(url, formData, { headers })
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.error(error);
  });

In the above examples, set the values for value, hyperlinkText, Title, Files, name, and emailAddress. After executing the above code, the document will be created with a hyperlink form field, and an email will be sent to the signer for signing.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied