Add Loan Document

This request allows you to upload a loan document.

General

This request is a bit different from our others listed here in our documentation. Here's what you need to know about uploading loan documents:

  • This request requires two steps (pretty exciting, right?). The first step is acquiring a URL to send the upload file to. Then, the second step is actually uploading the file to your account through the URL.
  • Most of our requests on this site allow you to try them yourself; however, this one doesn't quite work that way. We'll provide you the information for trying this yourself in your own REST client, though.

For more information on uploading customer documents, take a look at our API – Document Upload article.

And for an example of how uploading documents in the UI works, see Loan Documents.

Step 1

The first step to adding a loan document is acquiring a URL to send it to. Here, you'll send a POST request to the following URL:

https://loanpro.simnang.com/api/public/api/1/Loans({ID})/document/upload

This step requires a JSON payload, and here is an example of the payload you will need to send:

{
  "sectionId": 1, // This is the ID of the "section"——or category——that the document is filed under. You can create your own sections.
  "fileName": "test.jpg",
  "size": 160000,
  "customFileName": "customFileName.jpg"
}

If your request is successful, your response will look something like this:

{
  "d": {
    "id": "89",
    "fileName": "test_1572647511.jpg",
    "uploadUrl": "https://autopal-fandora.s3.amazonaws.com/tenants/5200243/fileAttachments/LoanDocuments/257/python_5fa1c4014f0fa0667c8c0f3c633fab28724aed68f76ed.jpg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEG0aCXVzLWVhc3QtMSJIMEYCIQDx4%2FYC02ty1IzFW4IlEP8Bu1tJirLA8phWjeXx27xn1wIhAOCnvWzL5PfaVwIkEtHnO9aJKqtP8MVz55GgK%2B792gj8Kr0DCMb%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQABoMMDYzNzEyODc5NDg1Igxu9QkHJnsJgukhpssqkQPxaa%2F6VNsu%2FjB4ggmZmTwnrkC7evvKyzDjKGwhpDFRIJDCjCuFHin49nb1P47wyg%2F1DsY1KPyYxH29LCZKWBMoUMfyVV4ofmlddzsf914UW3vA%2BJiF7VtBtPDs2HY%2FO4kbVPsRHBwm0QJD4BE0BzZLyHMTuRfPSxKnQ62oDI7X7GBIQhq7Bgcjnj%2BjUyFvdtrrmJGXcXhXanCOjPYx1H6ATxpmDQjgXXp106vexaF8AssE2St%2BZZVT5pqGpoXYbdPZTSDlH9RMYc0wMwtx%2FJ1yJR6YmqF339TTwFl2Is5%2FMeJH80wmGsF95AU0q1kNWjZUU%2BJaAR0r9m%2F0jH6xqrebhJEMa%2F1vx4u9RFecgYOQpVtzQlf9%2FFc2%2FzPrcSohJf%2BkvV6it%2B0hYwKTLck9%2BwKMS1iA88ic98SgKOX3p7i3lnzYI9lV2tzsXtC16EwIW2mqFDmyN2rr63IVwiYwIVd50cUjOpMGBTKk61rkk2OUF%2Fn5exTT1OKXmhT5DoodcJnEg3B7ran1SImQrIdxH6An1zC2%2FIb9BTrqAV21t919ebTVEKOvCdxd5xKHCa%2FfALkOursakednppYWvCPrIDXK0j2Tak89UYugXjbFD0Hl134RkkiL%2BzpjQwEbPkTbxN8ex9Vvyx%2FygL7FeP2SJjTy%2BYM69un61am8f%2FRYsAYPsgqxaBU6FlrGkiLY3Kb52FqfgiwA2lGgVJ9GHbjwXiZ%2BOk3hbj1dUckK84nXRr9AbyyKjdD%2BwmFBl%2Bn0klDq%2FvQm2wG9qbnzwnMZ3kuVdHswitT06WWSN6CjEBbKx2gqme2uLKB0e%2FBLJGdRzAt8HqyxEnI7TRzpqWpTlStoThZXzPrP9A%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQ5VMVMN6RKBGKS25%2F20201103%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201103T205633Z&X-Amz-SignedHeaders=host&X-Amz-Expires=2700&X-Amz-Signature=39d7fe294efa180f695f3e2cdf074ca81b659c2d21e7ee551514527a826da998",
    "customFileName": "test.jpg",
    "mime": "image/jpeg"
  }
}

In this response, you'll notice there is a uploadUrl field. This is important, because you'll need to use the URL provided in the next step.

Step 2

This step is where you'll actually upload the document to your account.

To upload the document, you will need to send a PUT request to the 'uploadUrl' returned by the request in the step above. Here are examples of the payload you will need in both cURL and Python:

curl

--upload-file "C:\Users\UserName\Documents\send\test.jpg" 

"https://autopal-fandora.s3.amazonaws.com/tenants/5200243/fileAttachments/LoanDocuments/257/python_5fa1c4014f0fa0667c8c0f3c633fab28724aed68f76ed.jpg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEG0aCXVzLWVhc3QtMSJIMEYCIQDx4%2FYC02ty1IzFW4IlEP8Bu1tJirLA8phWjeXx27xn1wIhAOCnvWzL5PfaVwIkEtHnO9aJKqtP8MVz55GgK%2B792gj8Kr0DCMb%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQABoMMDYzNzEyODc5NDg1Igxu9QkHJnsJgukhpssqkQPxaa%2F6VNsu%2FjB4ggmZmTwnrkC7evvKyzDjKGwhpDFRIJDCjCuFHin49nb1P47wyg%2F1DsY1KPyYxH29LCZKWBMoUMfyVV4ofmlddzsf914UW3vA%2BJiF7VtBtPDs2HY%2FO4kbVPsRHBwm0QJD4BE0BzZLyHMTuRfPSxKnQ62oDI7X7GBIQhq7Bgcjnj%2BjUyFvdtrrmJGXcXhXanCOjPYx1H6ATxpmDQjgXXp106vexaF8AssE2St%2BZZVT5pqGpoXYbdPZTSDlH9RMYc0wMwtx%2FJ1yJR6YmqF339TTwFl2Is5%2FMeJH80wmGsF95AU0q1kNWjZUU%2BJaAR0r9m%2F0jH6xqrebhJEMa%2F1vx4u9RFecgYOQpVtzQlf9%2FFc2%2FzPrcSohJf%2BkvV6it%2B0hYwKTLck9%2BwKMS1iA88ic98SgKOX3p7i3lnzYI9lV2tzsXtC16EwIW2mqFDmyN2rr63IVwiYwIVd50cUjOpMGBTKk61rkk2OUF%2Fn5exTT1OKXmhT5DoodcJnEg3B7ran1SImQrIdxH6An1zC2%2FIb9BTrqAV21t919ebTVEKOvCdxd5xKHCa%2FfALkOursakednppYWvCPrIDXK0j2Tak89UYugXjbFD0Hl134RkkiL%2BzpjQwEbPkTbxN8ex9Vvyx%2FygL7FeP2SJjTy%2BYM69un61am8f%2FRYsAYPsgqxaBU6FlrGkiLY3Kb52FqfgiwA2lGgVJ9GHbjwXiZ%2BOk3hbj1dUckK84nXRr9AbyyKjdD%2BwmFBl%2Bn0klDq%2FvQm2wG9qbnzwnMZ3kuVdHswitT06WWSN6CjEBbKx2gqme2uLKB0e%2FBLJGdRzAt8HqyxEnI7TRzpqWpTlStoThZXzPrP9A%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQ5VMVMN6RKBGKS25%2F20201103%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201103T205633Z&X-Amz-SignedHeaders=host&X-Amz-Expires=2700&X-Amz-Signature=39d7fe294efa180f695f3e2cdf074ca81b659c2d21e7ee551514527a826da998"
import requests

url = "https://autopal-fandora.s3.amazonaws.com/tenants/5200243/fileAttachments/LoanDocuments/257/python_5fa1c4014f0fa0667c8c0f3c633fab28724aed68f76ed.jpg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEG0aCXVzLWVhc3QtMSJIMEYCIQDx4%2FYC02ty1IzFW4IlEP8Bu1tJirLA8phWjeXx27xn1wIhAOCnvWzL5PfaVwIkEtHnO9aJKqtP8MVz55GgK%2B792gj8Kr0DCMb%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQABoMMDYzNzEyODc5NDg1Igxu9QkHJnsJgukhpssqkQPxaa%2F6VNsu%2FjB4ggmZmTwnrkC7evvKyzDjKGwhpDFRIJDCjCuFHin49nb1P47wyg%2F1DsY1KPyYxH29LCZKWBMoUMfyVV4ofmlddzsf914UW3vA%2BJiF7VtBtPDs2HY%2FO4kbVPsRHBwm0QJD4BE0BzZLyHMTuRfPSxKnQ62oDI7X7GBIQhq7Bgcjnj%2BjUyFvdtrrmJGXcXhXanCOjPYx1H6ATxpmDQjgXXp106vexaF8AssE2St%2BZZVT5pqGpoXYbdPZTSDlH9RMYc0wMwtx%2FJ1yJR6YmqF339TTwFl2Is5%2FMeJH80wmGsF95AU0q1kNWjZUU%2BJaAR0r9m%2F0jH6xqrebhJEMa%2F1vx4u9RFecgYOQpVtzQlf9%2FFc2%2FzPrcSohJf%2BkvV6it%2B0hYwKTLck9%2BwKMS1iA88ic98SgKOX3p7i3lnzYI9lV2tzsXtC16EwIW2mqFDmyN2rr63IVwiYwIVd50cUjOpMGBTKk61rkk2OUF%2Fn5exTT1OKXmhT5DoodcJnEg3B7ran1SImQrIdxH6An1zC2%2FIb9BTrqAV21t919ebTVEKOvCdxd5xKHCa%2FfALkOursakednppYWvCPrIDXK0j2Tak89UYugXjbFD0Hl134RkkiL%2BzpjQwEbPkTbxN8ex9Vvyx%2FygL7FeP2SJjTy%2BYM69un61am8f%2FRYsAYPsgqxaBU6FlrGkiLY3Kb52FqfgiwA2lGgVJ9GHbjwXiZ%2BOk3hbj1dUckK84nXRr9AbyyKjdD%2BwmFBl%2Bn0klDq%2FvQm2wG9qbnzwnMZ3kuVdHswitT06WWSN6CjEBbKx2gqme2uLKB0e%2FBLJGdRzAt8HqyxEnI7TRzpqWpTlStoThZXzPrP9A%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQ5VMVMN6RKBGKS25%2F20201103%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201103T205633Z&X-Amz-SignedHeaders=host&X-Amz-Expires=2700&X-Amz-Signature=39d7fe294efa180f695f3e2cdf074ca81b659c2d21e7ee551514527a826da998"

file = open('C:/Users/UserName/Documents/send/test.jpg', 'rb')

response = requests.put(url, data=file)

print(response.text)