---
title: "Downloading Documents"
slug: "downloading-documents"
updated: 2025-01-06T19:22:30Z
published: 2025-01-06T19:22:30Z
canonical: "docs.onespan.com/downloading-documents"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onespan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Downloading Documents

[Java SDK](/v1/docs/downloading-documents#java-sdk) [.NET SDK](/v1/docs/downloading-documents#net-sdk) [REST API](/v1/docs/downloading-documents#rest-api) [APEX SDK](/v1/docs/downloading-documents#apex-sdk)

## Java SDK

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-documents-java-sdk/) site. For extra tips on how to bulk download transactions, see our [blog](https://www.onespan.com/blog/onespan-sign-developer-transaction-export-download-tool) post.

Any documents uploaded during the creation of a document package can be downloaded at any given time.

### Downloading Documents

The EslClient.downloadDocument() method can be called both before and after the package's completion. If called before, the documents will be flattened, removing all pending signatures and fields.

```java
FileOutputStream stream1 = new FileOutputStream("C:/Users/hhaidary/Desktop/Example/signed_document.pdf");
				// Retrieve the bytes of the document (with fields)
				byte[] pdfDocumentBytes = eslClient.downloadDocument(packageId, documentId);
	    
				try{
				stream1.write(pdfDocumentBytes);
				} finally {
				stream1.close();
			}
```

### Downloading the Original Documents

The EslClient.downloadOriginalDocument() method can be called both before and after the package's completion. It retrieves the original document that was uploaded by the sender, without any signatures and fields.

```java
FileOutputStream stream2 = new FileOutputStream("C:/Users/hhaidary/Desktop/Example/original_document.pdf");
				// Retrieve the bytes of the original document (without fields)
				byte[] originalPdfDocumentBytes = eslClient.downloadOriginalDocument(packageId, documentId);
	    
				try{
				stream2.write(originalPdfDocumentBytes);
				} finally {
				stream2.close();
			}
```

### Downloading Signed Documents

The EslClient.downloadZippedDocuments() method can only be called after all signing has been completed. Once called, the method will deliver an archive containing all signed documents.

```java
FileOutputStream stream3 = new FileOutputStream("C:/Users/hhaidary/Desktop/Example/signed_documents.zip");
				// Retrieve the bytes of the zipped file containing all the documents in the package
				byte[] zippedDocumentsBytes = eslClient.downloadZippedDocuments(packageId);
	    
				try{
				stream3.write(zippedDocumentsBytes);
				} finally {
				stream3.close();
			}
```

### Downloading an Audit Trails

The EslClient.downloadEvidenceSummary() method can be called both before and after the package's completion. It retrieves the current audit trail activity for the package.

```java
FileOutputStream stream4 = new FileOutputStream("C:/Users/hhaidary/Desktop/Example/evidence_summary.pdf");
				//Retrieve the bytes of the evidence summary
				byte[] evidenceBytes = eslClient.downloadEvidenceSummary(packageId);
	    
				try{
				stream4.write(evidenceBytes);
				} finally {
				stream4.close();
			}
```

### Results

Once you have run your code, you will find your files in the location where you chose to save your files.

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/capture-1-300x75.png)

## .NET SDK

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-documents-java-sdk/) site. For extra tips on how to bulk download transactions, see our [blog](https://www.onespan.com/blog/onespan-sign-developer-transaction-export-download-tool) post.

Any documents uploaded during the creation of a document package can be downloaded at any given time.

### Downloading Documents

The EslClient.DownloadDocument() method can be called both before and after the package's completion. If called before, the documents will be flattened, removing all pending signatures and fields.

```csharp
// Retrieve the bytes of the document (with fields)
				byte[] pdfDocumentBytes = eslClient.DownloadDocument(packageId, documentId);
			File.WriteAllBytes("C:/Users/hhaidary/Desktop/Example/signed_document.pdf", pdfDocumentBytes);
```

### Downloading the Original Documents

The EslClient.DownloadOriginalDocument() method can be called both before and after the package's completion. It retrieves the original document that was uploaded by the sender, without any signatures and fields.

```csharp
// Retrieve the bytes of the original document (without fields)
				byte[] originalPdfDocumentBytes = eslClient.DownloadOriginalDocument(packageId, documentId);
			File.WriteAllBytes("C:/Users/hhaidary/Desktop/Example/original_document.pdf", originalPdfDocumentBytes);
```

### Downloading Signed Documents

The EslClient.DownloadZippedDocuments() method can only be called after all signing has been completed. Once called, the method will deliver an archive containing all signed documents.

```csharp
// Retrieve the bytes of the zipped file containing all the documents in the package
				byte[] zippedDocumentsBytes = eslClient.DownloadZippedDocuments(packageId);
			File.WriteAllBytes("C:/Users/hhaidary/Desktop/Example/signed_documents.zip", zippedDocumentsBytes);
```

### Downloading an Audit Trail

The EslClient.DownloadEvidenceSummary() method can be called both before and after the package's completion. It retrieves the current audit trail activity for the package.

```csharp
//Retrieve the bytes of the evidence summary
				byte[] evidenceBytes = eslClient.PackageService.DownloadEvidenceSummary(packageId);
			File.WriteAllBytes("C:/Users/hhaidary/Desktop/Example/evidence_summary.pdf", evidenceBytes);
```

### Results

Once you have run your code, you will find your files in the location where you chose to save your files.

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/capture-1-300x75.png)

## REST API

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-documents-rest-api/) site. For extra tips on how to bulk download transactions, see our [blog](https://www.onespan.com/blog/onespan-sign-developer-transaction-export-download-tool) post.

Any documents uploaded during the creation of a document package can be downloaded at any given time.

### Downloading Documents

The DownloadDocument() call can be called both before and after the package's completion. If called before, the documents will be flattened, removing all pending signatures and fields.

#### HTTP Request

```http
 GET https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/pdf
```

#### HTTP Headers

```http
Accept: application/pdf
Content-Type: application/json   
Authorization: Basic api_key
```

### Downloading the Original Documents

The DownloadOriginalDocument() call can be called both before and after the package's completion. It retrieves the original document that was uploaded by the sender, without any signatures and fields.

#### HTTP Request

```http
 GET https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/original
```

#### HTTP Headers

```http
Accept: application/pdf
Content-Type: application/json   
Authorization: Basic api_key
```

### Downloading Signed Documents

The DownloadZippedDocuments() call can only be called after all signing has been completed. Once called, the method will deliver an archive containing all signed documents.

#### HTTP Request

```http
 GET https://sandbox.esignlive.com/api/packages/{packageId}/documents/zip
```

#### HTTP Headers

```http
Accept: application/pdf
Content-Type: application/json   
Authorization: Basic api_key
```

### Downloading an Audit Trail

The DownloadEvidenceSummary() call can be called both before and after the package's completion. It retrieves the current audit trail activity for the package.

#### HTTP Request

```http
 GET https://sandbox.esignlive.com/api/packages/{packageId}/evidence/summary
```

#### HTTP Headers

```http
Accept: application/pdf
Content-Type: application/json   
Authorization: Basic api_key
```

### Downloading Signed Documents and the Audit Trail

The following API call can only be called after all signing has been completed. It retrieves the current audit trail as well as all the signed documents.

#### HTTP Request

```http
 GET https://sandbox.esignlive.com/api/packages/{packageID}/download?evidenceSummary=true&documents=true
```

#### HTTP Headers

```http
Content-Type: application/zip
Authorization: Basic api_key
```

### Results

Once you have run your code, you will find your files in the location where you chose to save your files.

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/capture-1-300x75.png)

## APEX SDK

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/retrieve-documents-apex-sdk/) site. For extra tips on how to bulk download transactions, see our [blog](https://www.onespan.com/blog/onespan-sign-developer-transaction-export-download-tool) post.

Any documents uploaded during the creation of a document package can be downloaded at any given time.

### Downloading Documents

The sdk.downloadDocument() method can be called both before and after the package’s completion. If called before, the documents will be flattened, removing all pending signatures and fields.

```plaintext
    	//download signed document
				Blob signedDocument = sdk.downloadDocument(packageId, documentId);
				Document doc1 = new Document();
				doc1.Body = signedDocument;
				doc1.FolderId = folder.id;
				doc1.Name = 'test retrieving document - sigend document';
				doc1.Type = 'pdf';
			insert doc1;
```

### Downloading the Original Documents

The downloadOriginalDocument() method can be called both before and after the package’s completion. It retrieves the original document that was uploaded by the sender, without any signatures and fields.

```plaintext
    	//download original document
				Blob originalDocument = downloadOriginalDocument(packageId, documentId);
				Document doc2 = new Document();
				doc2.Body = originalDocument;
				doc2.FolderId = folder.id;
				doc2.Name = 'test retrieving document - original document';
				doc2.Type = 'pdf';
			insert doc2;
```

### Downloading Signed Documents

The downloadZippedDocuments() method can only be called after all signing has been completed. Once called, the method will deliver an archive containing all signed documents.

```plaintext
    	//download zipped document
				Blob zippedDocuments = downloadZippedDocuments(packageId);
				Document doc3 = new Document();
				doc3.Body = zippedDocuments;
				doc3.FolderId = folder.id;
				doc3.Name = 'test retrieving document - zipped documents';
				doc3.Type = 'zip';
			insert doc3;
```

The sdk.getAudit() method can be called both before and after the package’s completion. It retrieves the current audit trail activity for the package.

```plaintext
    	//download evidence summary
				String auditString= sdk.getAudit(packageId);
				Document doc4 = new Document();
				doc4.Body = EncodingUtil.base64Decode(auditString);
				doc4.FolderId = folder.id;
				doc4.Name = 'test retrieving document - evidence summary';
				doc4.Type = 'pdf';
			insert doc4;
```

### Results

Once you have run your code, you will find your files in the location where you chose to save your fileS.

![](https://cdn.document360.io/038f59a7-abd0-4c14-9de7-3434d28b49fd/Images/Documentation/retrieving-documents-1(1).png)
