Send Document Links via Email

This tutorial explains how to send links to your documents via email using our eSignature API (Application Programming Interface). These links can lead to documents on our website or to documents embedded in your own web page.

If you don't want to send emails but instead need to display documents to the people who are already on your website, then you should use the other tutorial Embed Documents On Your Website.

Your Sample Workflow

We assume here that you need to implement the following workflow or a similar one:

  1. You need to get a document filled out and signed by a user who is not right now on your website.

  2. Your system generates a custom PDF document (you can use also a static template here).

  3. You send your user an email with the link to the document.

  4. Your users open, fill out and submit the document, after that your system will receive the completed copy.

The document that your users see can be displayed as part of your website or on our web domain. The general idea is that the users open their documents by clicking on the link that you send to them via email.

Send Users To DigiSigner For Signing

In our tutorial we assume that you want to send out a document that you generated yourself. If you send each time one and the same document for signing (except for maybe the user's data), you can consider using templates (see Send Out Templates For Signing). You won't have to generate documents on the fly, but you will still be able to dynamically insert user's data in the template fields.

Now we assume that you generated your document yourself, but the difference to the template scenario is minimal.

In the next step you need to execute the following signature request.

# upload document.pdf            
curl -u YOUR_API_KEY: -F file=@document.pdf https://api.digisigner.com/v1/documents

# got response: {"document_id":"5be88823-3ff5-4ec4-8175-459dee50f7fb"}

# send signature request            
curl -u YOUR_API_KEY: https://api.digisigner.com/v1/signature_requests \
-H 'Content-Type: application/json' \
-d '{"documents" : [ \
      {"document_id": "5be88823-3ff5-4ec4-8175-459dee50f7fb", \
       "signers": [{"email": "invited_signer@email.com"}] \
      }] \
    }'    
            
$client = new DigiSignerClient('YOUR_API_KEY'); 
$request = new SignatureRequest;
  
$document = new Document('document.pdf');
$request->addDocument($document);

$signer = new Signer('invited_signer@email.com');
$document->addSigner($signer);

$response = $client->sendSignatureRequest($request);
            
DigiSignerClient client = new DigiSignerClient("YOUR_API_KEY");
SignatureRequest request = new SignatureRequest();
 
Document document = new Document(new File("document.pdf")); 
request.addDocument(document);

Signer signer = new Signer("invited_signer@email.com");
document.addSigner(signer);

SignatureRequest response = client.sendSignatureRequest(request);
            
DigiSignerClient client = new DigiSignerClient("YOUR_API_KEY");
SignatureRequest request = new SignatureRequest();
Document document = new Document("document.pdf");

Signer signer = new Signer("invited_signer@email.com");
document.Signers.Add(signer);
request.Documents.Add(document);

SignatureRequest response = client.SendSignatureRequest(request);
            

The input parameters include the path to the document and the email address of the invited signer. Optionally you can also specify your own custom subject and message for the email that will be sent. For more information see the list of Signature Request Parameters.

In our signature request we also haven't specified any fields for the signer. If you need to do this, please see Send Out Documents With Fields.

As a result of your signature request an email with the link to the document will be sent to the recipient. The recipient will click on the link which will lead to our web domain.

After the signer will submit the document your system will be notified about the completion of the signature request via a callback. In your callback handler code you will be able to download the completed document from our system. See here for more information about callback Signature Request Callback.

Send Users To Your Website For Signing

In this scenario the document will be displayed as part of your own web page.

You will need to execute the following signature request.

# upload document.pdf            
curl -u YOUR_API_KEY: -F file=@document.pdf https://api.digisigner.com/v1/documents

# got response: {"document_id":"5be88823-3ff5-4ec4-8175-459dee50f7fb"}

# send signature request            
curl -u YOUR_API_KEY: https://api.digisigner.com/v1/signature_requests \
-H 'Content-Type: application/json' \
-d '{"embedded": true, \
     "redirect_for_signing_to_url": "http://you-website-url/signing-page", \
     "documents" : [ \
      {"document_id": "5be88823-3ff5-4ec4-8175-459dee50f7fb", \
       "signers": [{"email": "invited_signer@email.com"}] \
      }] \
    }'    
            
$client = new DigiSignerClient('YOUR_API_KEY');
 
$request = new SignatureRequest;
$request->setEmbedded(true);
$request->setRedirectForSigningToUrl('http://you-website-url/signing-page');
  
$document = new Document('document.pdf');
$request->addDocument($document);

$signer = new Signer('invited_signer@email.com');
$document->addSigner($signer);

$response = $client->sendSignatureRequest($request);
            
DigiSignerClient client = new DigiSignerClient("YOUR_API_KEY");

SignatureRequest request = new SignatureRequest();
request.setEmbedded(true);
request.setRedirectForSigningToUrl("http://you-website-url/signing-page");
 
Document document = new Document(new File("document.pdf")); 
request.addDocument(document);

Signer signer = new Signer("invited_signer@email.com");
document.addSigner(signer);

SignatureRequest response = client.sendSignatureRequest(request);
            
DigiSignerClient client = new DigiSignerClient("YOUR_API_KEY");

SignatureRequest request = new SignatureRequest();
request.Embedded = true;
request.RedirectForSigningToUrl = "http://you-website-url/signing-page";
 
Document document = new Document("document.pdf");

Signer signer = new Signer("invited_signer@email.com");
document.Signers.Add(signer);
request.Documents.Add(document);

SignatureRequest response = client.SendSignatureRequest(request);
            

Please note the following two parameters: embedded and redirect_for_signing_to_url.

The parameter embedded, when set to true, forces the design of the embedded document to be more neutral (grey navigation bar, no background etc.) to ensure a better fit with your page design.

The parameter redirect_for_signing_to_url specifies the URL of the page on your web site to which the signer will be redirected for signing the document. This is your own page so you can design it as you like, however it must contain the iframe element with the document to be signed.

What URL should you use for the src attribute of the iframe to display the desired document on your signature page?

This URL is passed as a parameter by opening your signature page when the signer clicks on the 'Open Document' button in the received email. The name of this parameter is signDocumentUrlBase64Encoded and it contains the base64 encoded URL of the DigiSigner document.

The easiest way to set the src attribute of the iframe is to use our library digisigner.js, which decodes the request parameter signDocumentUrlBase64Encoded, finds the first iframe with the digiSignerFrame id and initializes its src attribute with the DigiSigner document URL.

Here is an example of how a minimal signature page might appear:

<script type="application/javascript" src="http://www.digisigner.com/js/digisigner.js"></script>
<iframe id="digiSignerFrame" style="text-align: center" width="820px" height="880px"></iframe>

After clicking on the 'Open Document' button in the email, the signer will be redirected to your signature page with the document displayed in the iframe.

Document in iFrame

The signer will be able to fill out and sign the document. The signer will then click on the 'DONE' button to complete the process.


More tutorials and documentation

Signature Request Parameters - all signature request parameters

How to Send Signature Requests - code samples for sending signature requests

How to Embed Documents - how to embed documents on your web site to get them filled out and signed

How to Use Templates Via API - how to configure templates in GUI mode and use them via our eSignature API

How to Get Data Submitted By Signers - how to retrieve data signers entered while filling out your form


Don't hesitate to contact us in case you have any questions or suggestions about using our eSignature API.