API – Downloading Loan Documents


This article covers how to download the contents of an uploaded document. To learn about how to upload, update, or create documents please see the article API – Document Upload.

Finding the Document

To download a loan document, you will first need to identify which loan document you wish to download. This can be achieved by querying the associated loan for its documents while expanding the associated FileAttachment entity (see API – Expanding Objects for more information). To do so, send a GET request to the following endpoint:

GET https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(987)/Documents?all&$expand=FileAttachment

Remember to replace "987" with the ID of the associated loan you are using.

The response would look similar to the following:

"d": {
"results": [
"__metadata": {
"uri": "http://loanpro.simnang.com/api/public/api/1/odata.svc/LoanDocuments(id=1)",
"type": "Entity.Document"
"Loan": {
"__deferred": {
"uri": "LoanDocuments(id=1)/Loan"
"User": {
"__deferred": {
"uri": "LoanDocuments(id=1)/User"
"DocSection": {
"__deferred": {
"uri": "LoanDocuments(id=1)/DocSection"
"FileAttachment": {
"__metadata": {
"uri": "http://loanpro.simnang.com/api/public/api/1/odata.svc/FileAttachments(id=451)",
"type": "Entity.FileAttachment"
"id": 451,
"parentType": "Entity.LoanDocument",
"parentId": 418,
"fileName": "API_Help_1474483773.pdf",
"fileOriginalName": "API Help",
"fileSize": 11386,
"fileMime": "application/octet-stream"
"id": 418,
"loanId": 4,
"userId": 5,
"sectionId": 3,
"fileAttachmentId": 451,
"userName": "API Helpsystem",
"remoteAddress": "",
"fileName": "API Help",
"description": null,
"ip": 0,
"size": 11386,
"active": 1,
"created": "/Date(1474483773)/",
"archived": 0,
"customerVisible": 0
"summary": {
"start": 0,
"pageSize": 1,
"total": 1

There are two fields of interest in each results object:

  1. The “id” field, or the ID of the LoanDocument entity.
  2. The “fileName” of the nested fileAttachment object.

You will need both of these fields to download the document. In this case, the id is 418 and the file name is API_Help_1474483773.pdf.

Downloading the Document

Once you have the “id” and “fileName” field values, you will be able to download the document. To do so, you will need to send another GET request. The URL for the GET request will be formatted as follows:

GET https://loanpro.simnang.com/api/public/api/1/files/<tenant_id>/LoanDocuments(<id>)/<filename>

In this request, <tenant_id> is your tenant’s ID, <id> is the ID of the loan document, and <filename> is the filename of the loan document. For this example, we’ll use the tenant id of 0, and we’ll use the loan document id and filename used in the above section, which is 418 and API_Help_1474483773.pdf respectively.

With those variables in place, our final GET request will be:

GET https://loanpro.simnang.com/api/public/api/1/files/0/LoanDocuments(418)/API_Help_1474483773.pdf

The response you receive will be in binary. This is because the request will be sending the raw file data. Please make sure you receive, process, and store the data appropriately.

How did we do?

Powered by HelpDocs (opens in a new tab)