Documents

Providing a Link to the Documents for End Customers

The GetDocumentFileLinks() method generates secure, time-limited download links for documents within a transaction. This method provides flexible access to documents by allowing you to specify different ID types to control which documents are included in the response.

Access Patterns

You can use any of the following IDs to access documents:

  • TransactionID: Returns all documents in the transaction combined into a single PDF or HTML viewer
  • DocumentID: Returns only the specified document
  • ParticipantID: Returns only the documents that the specified participant was involved in for the transaction (subset of transaction documents)

Response Format

The returned link will provide access to either:

  • Single PDF: All requested documents combined into one downloadable PDF file
  • HTML Viewer: An HTML page displaying each document with a selection box to switch between documents

Request Model

DocumentFileLinksRequestModel

PropertyTypeDescription
LinkRequestsList<DocumentFileLinkRequestModel>Collection of link request objects

DocumentFileLinkRequestModel

PropertyTypeRequiredDescription
TransactionIDlong?Conditional*ID of the transaction containing the documents
DocumentIDlong?Conditional*ID of a specific document to retrieve
ParticipantIDlong?Conditional*ID of participant to filter documents by their involvement
ExpiresInSecondsintYesNumber of seconds until the link expires (e.g., 11300 for ~3 hours)
DownloadFileNamestringYesCustom filename for the downloaded file (e.g., "MyTestFile.pdf")
DisplayPdfAsHtmlFormatboolNoIf true, displays documents in HTML viewer; if false, provides direct PDF download
IncludesobjectNo{ "IncludeNonWatermarkedVersion": bool, "IncludePdfStampedWithCopyWatermark": bool }

*At least one ID (TransactionID, DocumentID, or ParticipantID) must be provided.

Response Model

DocumentFileLinksResponseModel

PropertyTypeDescription
IsSuccessfulboolIndicates if the request was processed successfully
MessagestringError message if IsSuccessful is false, otherwise null
DocumentFileLinksList<DocumentFileLinkModel>Collection of generated file links
ProcessingTimeTimeSpanTime taken to process the request
TimeZoneUtcOffsetdoubleUTC offset for timestamp calculations

DocumentFileLinkModel

PropertyTypeDescription
UrlstringThe secure download/view URL for the document(s)

Code Examples

Get All Documents in a Transaction

var req = new DocumentFileLinksRequestModel()
{
    LinkRequests = new List<DocumentFileLinkRequestModel>
    {
        new DocumentFileLinkRequestModel()
        {
            TransactionID = 1000242814,
            ExpiresInSeconds = 11300,
            DownloadFileName = "TransactionDocuments.pdf",
            DisplayPdfAsHtmlFormat = false
        }
    }
};

var api = new DocumentsApi(myRestEndpointUrl);
var results = api.GetDocumentFileLinks(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    string downloadUrl = results.DocumentFileLinks[0].Url;
    // Use the download URL to provide access to the document(s)
    // do work...
}
else
{
    //handle error
    string errorMessage = results.Message;
}

Get a Specific Document

var req = new DocumentFileLinksRequestModel()
{
    LinkRequests = new List<DocumentFileLinkRequestModel>
    {
        new DocumentFileLinkRequestModel()
        {
            DocumentID = 1234567890,
            ExpiresInSeconds = 7200, // 2 hours
            DownloadFileName = "SpecificDocument.pdf",
            DisplayPdfAsHtmlFormat = false
        }
    }
};

var api = new DocumentsApi(myRestEndpointUrl);
var results = api.GetDocumentFileLinks(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    string downloadUrl = results.DocumentFileLinks[0].Url;
    // do work...
}
else
{
    //handle error
}

Get Documents for a Specific Participant with HTML Viewer

var req = new DocumentFileLinksRequestModel()
{
    LinkRequests = new List<DocumentFileLinkRequestModel>
    {
        new DocumentFileLinkRequestModel()
        {
            ParticipantID = 1987654321,
            ExpiresInSeconds = 3600, // 1 hour
            DisplayPdfAsHtmlFormat = true // Display in HTML viewer
        }
    }
};

var api = new DocumentsApi(myRestEndpointUrl);
var results = api.GetDocumentFileLinks(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    string viewerUrl = results.DocumentFileLinks[0].Url;
    // Redirect user to the HTML viewer URL
    // do work...
}
else
{
    //handle error
}
var req = new DocumentFileLinksRequestModel()
{
    LinkRequests = new List<DocumentFileLinkRequestModel>
    {
        new DocumentFileLinkRequestModel()
        {
            TransactionID = 1000242814,
            ExpiresInSeconds = 11300,
            DownloadFileName = "AllDocuments.pdf",
            DisplayPdfAsHtmlFormat = false
        },
        new DocumentFileLinkRequestModel()
        {
            DocumentID = 1234567890,
            ExpiresInSeconds = 7200,
            DownloadFileName = "SingleDocument.pdf",
            DisplayPdfAsHtmlFormat = false
        }
    }
};

var api = new DocumentsApi(myRestEndpointUrl);
var results = api.GetDocumentFileLinks(req, apiKey, apiSecret, apiUsername, apiPassword);
if (results.IsSuccessful.Value)
{
    foreach (var link in results.DocumentFileLinks)
    {
        string downloadUrl = link.Url;
        // Process each link
    }
    // do work...
}
else
{
    //handle error
}

Example Response JSON

{
    "IsSuccessful": true,
    "Message": null,
    "DocumentFileLinks": [
        {
            "Url": "https://q1.alphatrust.com/SignApi/api/DocumentLinks/f61a5847b8d0443b/inline"
        }
    ],
    "ProcessingTime": "00:00:00.7079863",
    "TimeZoneUtcOffset": 0.0
}

Important Notes

  • Security: Generated links are time-limited and expire based on the ExpiresInSeconds parameter
  • File Format: When DisplayPdfAsHtmlFormat is false, documents are combined into a single PDF for download
  • HTML Viewer: When DisplayPdfAsHtmlFormat is true, an interactive HTML page is provided with document navigation
  • Multiple Documents: Multiple link requests can be processed in a single API call
  • Custom Filenames: Use DownloadFileName to specify a custom name for downloaded files
  • Access Control: Different ID types (Transaction, Document, Participant) provide different levels of document access