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
Property | Type | Description |
---|---|---|
LinkRequests | List<DocumentFileLinkRequestModel> | Collection of link request objects |
DocumentFileLinkRequestModel
Property | Type | Required | Description |
---|---|---|---|
TransactionID | long? | Conditional* | ID of the transaction containing the documents |
DocumentID | long? | Conditional* | ID of a specific document to retrieve |
ParticipantID | long? | Conditional* | ID of participant to filter documents by their involvement |
ExpiresInSeconds | int | Yes | Number of seconds until the link expires (e.g., 11300 for ~3 hours) |
DownloadFileName | string | Yes | Custom filename for the downloaded file (e.g., "MyTestFile.pdf") |
DisplayPdfAsHtmlFormat | bool | No | If true, displays documents in HTML viewer; if false, provides direct PDF download |
Includes | object | No | { "IncludeNonWatermarkedVersion": bool, "IncludePdfStampedWithCopyWatermark": bool } |
*At least one ID (TransactionID, DocumentID, or ParticipantID) must be provided.
Response Model
DocumentFileLinksResponseModel
Property | Type | Description |
---|---|---|
IsSuccessful | bool | Indicates if the request was processed successfully |
Message | string | Error message if IsSuccessful is false, otherwise null |
DocumentFileLinks | List<DocumentFileLinkModel> | Collection of generated file links |
ProcessingTime | TimeSpan | Time taken to process the request |
TimeZoneUtcOffset | double | UTC offset for timestamp calculations |
DocumentFileLinkModel
Property | Type | Description |
---|---|---|
Url | string | The 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
}
Multiple Link Requests in One Call
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
Retrieving Your Documents
Once all participants have successfully signed your document, you may want to retrieve this document to be saved in your own document repository server. To do this, you will use the GetDocumentFiles() API method. The main parameter in this method is the DocumentFileDetailsRequestModel. For more details, reference the API Reference documentation.
Document Retention and Deletion
By default, documents are retained within AlphaTrust® e-Sign. There are several ways to control document deletion.