Add Customer Document

This request allows you to upload a customer 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 customer 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 Uploading a Customer Document.

Step 1

The first step to adding a customer 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/Customers({ID})/document/upload

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

{
  "sectionId": 1,
  "fileName": "test.jpg",
  "size": 160000,
  "customFileName": "customFileName.jpg"
}

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

{
  "d": {
    "id": "9",
    "fileName": "test_5fa319d2069f32562c8664e12dde5cbacac86faabdade.jpg",
    "uploadUrl": "https://autopal-fandora.s3.amazonaws.com/tenants/5200243/fileAttachments/CustomerDocuments/9/python_5fa319d2069f32562c8664e12dde5cbacac86faabdade.jpg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEIX%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCICNfcrl2MHJRCdi5k5HlgwzKDsc08VadT5b%2BIfKaRvjQAiAQJl4Bm7ds%2BXh%2FY1KdU8GyWgaX8S%2BU1Ta7r2BJasId1iq9Awje%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDA2MzcxMjg3OTQ4NSIMtPFKW0U0KYF%2BtqEPKpEDo8gTv%2BheKM8Ae4l7eW6HM5bkze%2B7xFS7MeBQ3rKBFr1OCGFR%2BDlDeWoy8r3OHu4mFK4W8kGtMJIkP2UErRbp98KhYW36spnysu0vUqm12ArERFsuCM70e3c0BHfSE60t0PF1dS2psxOtGbcvkUYkykIduQEg%2FPL1VmQbXHV0kiTupnbyNb8JC%2Bxc3bvHLmd3QyTJA68gMa5x5bKwaWNqtM78m2tHFt7v2JGnDSFb43UQqDAbuQrfiYyIG%2BZVTRZFWt4TFpb%2B8v9LgC0q32IJuc1enKmPi2LdGFYA54PS5f1e8RlCBk3ORzacTwS%2FpUgWLyJT%2FPpaFXUg%2BCMjqotPrgaJ2Si6XRHOtEZicZH8U%2BjOr%2B9x7bYypv67VWpV%2BgyY4rddo1fD2B7ynYgDrxjqobfvhUQNO9U19dRTtk9Waw6epdxr5SpmdpaROUGvJL%2FCK%2FfoLL0HLOUimD%2Fo7ehOGPQAYIdzZAfdX3XsSkWwClTsfRIPI3CObysxa%2Fz4Ust3goewAuL1rnnl687Q5BWEgkMwm6qM%2FQU67AENk3%2BqvhG28Pv7asRKB8UK1FO8NJhZP1uNgwHm%2FwslO9J45m4JGnggRTyac%2FTB1KhygRZv%2BA2X3xbpbbo0bppmFAPSy5ldCrSp7xL6PFqCaAR3CoqQbv%2FU2ykslyIYO%2ByWLbCCjSG8SJstZteCN6Oj8BvlqFFeJM9fUB2bt904pY0xeX61qwhCMHGqUCPcoOrtpo%2FflPrDye%2F1EfiTsANo91EWlYiOmulNlm4VeAQ0pl7VxXeYt695xE3LzY0LY9X%2Fbulpdp%2F7neRjBrGivXxFLUJoIeHMz96xSDH%2BCqaAbBQoxVtJGFJmkJdykQ%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQ5VMVMN6QNWU5QQQ%2F20201104%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201104T211458Z&X-Amz-SignedHeaders=host&X-Amz-Expires=2700&X-Amz-Signature=181bc0ae135f0eaf116f5667d2486ba0d511df047f858cec784e9012b2f221a0",
    "customFileName": "customFileName.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\customer_document.pdf" 

"https://autopal-fandora.s3.amazonaws.com/tenants/5200243/fileAttachments/CustomerDocuments/9/python_5fa319d2069f32562c8664e12dde5cbacac86faabdade.jpg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEIX%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCICNfcrl2MHJRCdi5k5HlgwzKDsc08VadT5b%2BIfKaRvjQAiAQJl4Bm7ds%2BXh%2FY1KdU8GyWgaX8S%2BU1Ta7r2BJasId1iq9Awje%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDA2MzcxMjg3OTQ4NSIMtPFKW0U0KYF%2BtqEPKpEDo8gTv%2BheKM8Ae4l7eW6HM5bkze%2B7xFS7MeBQ3rKBFr1OCGFR%2BDlDeWoy8r3OHu4mFK4W8kGtMJIkP2UErRbp98KhYW36spnysu0vUqm12ArERFsuCM70e3c0BHfSE60t0PF1dS2psxOtGbcvkUYkykIduQEg%2FPL1VmQbXHV0kiTupnbyNb8JC%2Bxc3bvHLmd3QyTJA68gMa5x5bKwaWNqtM78m2tHFt7v2JGnDSFb43UQqDAbuQrfiYyIG%2BZVTRZFWt4TFpb%2B8v9LgC0q32IJuc1enKmPi2LdGFYA54PS5f1e8RlCBk3ORzacTwS%2FpUgWLyJT%2FPpaFXUg%2BCMjqotPrgaJ2Si6XRHOtEZicZH8U%2BjOr%2B9x7bYypv67VWpV%2BgyY4rddo1fD2B7ynYgDrxjqobfvhUQNO9U19dRTtk9Waw6epdxr5SpmdpaROUGvJL%2FCK%2FfoLL0HLOUimD%2Fo7ehOGPQAYIdzZAfdX3XsSkWwClTsfRIPI3CObysxa%2Fz4Ust3goewAuL1rnnl687Q5BWEgkMwm6qM%2FQU67AENk3%2BqvhG28Pv7asRKB8UK1FO8NJhZP1uNgwHm%2FwslO9J45m4JGnggRTyac%2FTB1KhygRZv%2BA2X3xbpbbo0bppmFAPSy5ldCrSp7xL6PFqCaAR3CoqQbv%2FU2ykslyIYO%2ByWLbCCjSG8SJstZteCN6Oj8BvlqFFeJM9fUB2bt904pY0xeX61qwhCMHGqUCPcoOrtpo%2FflPrDye%2F1EfiTsANo91EWlYiOmulNlm4VeAQ0pl7VxXeYt695xE3LzY0LY9X%2Fbulpdp%2F7neRjBrGivXxFLUJoIeHMz96xSDH%2BCqaAbBQoxVtJGFJmkJdykQ%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQ5VMVMN6QNWU5QQQ%2F20201104%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201104T211458Z&X-Amz-SignedHeaders=host&X-Amz-Expires=2700&X-Amz-Signature=181bc0ae135f0eaf116f5667d2486ba0d511df047f858cec784e9012b2f221a0"
import requests

url = "https://autopal-fandora.s3.amazonaws.com/tenants/5200243/fileAttachments/CustomerDocuments/9/python_5fa319d2069f32562c8664e12dde5cbacac86faabdade.jpg?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEIX%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJGMEQCICNfcrl2MHJRCdi5k5HlgwzKDsc08VadT5b%2BIfKaRvjQAiAQJl4Bm7ds%2BXh%2FY1KdU8GyWgaX8S%2BU1Ta7r2BJasId1iq9Awje%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAAaDDA2MzcxMjg3OTQ4NSIMtPFKW0U0KYF%2BtqEPKpEDo8gTv%2BheKM8Ae4l7eW6HM5bkze%2B7xFS7MeBQ3rKBFr1OCGFR%2BDlDeWoy8r3OHu4mFK4W8kGtMJIkP2UErRbp98KhYW36spnysu0vUqm12ArERFsuCM70e3c0BHfSE60t0PF1dS2psxOtGbcvkUYkykIduQEg%2FPL1VmQbXHV0kiTupnbyNb8JC%2Bxc3bvHLmd3QyTJA68gMa5x5bKwaWNqtM78m2tHFt7v2JGnDSFb43UQqDAbuQrfiYyIG%2BZVTRZFWt4TFpb%2B8v9LgC0q32IJuc1enKmPi2LdGFYA54PS5f1e8RlCBk3ORzacTwS%2FpUgWLyJT%2FPpaFXUg%2BCMjqotPrgaJ2Si6XRHOtEZicZH8U%2BjOr%2B9x7bYypv67VWpV%2BgyY4rddo1fD2B7ynYgDrxjqobfvhUQNO9U19dRTtk9Waw6epdxr5SpmdpaROUGvJL%2FCK%2FfoLL0HLOUimD%2Fo7ehOGPQAYIdzZAfdX3XsSkWwClTsfRIPI3CObysxa%2Fz4Ust3goewAuL1rnnl687Q5BWEgkMwm6qM%2FQU67AENk3%2BqvhG28Pv7asRKB8UK1FO8NJhZP1uNgwHm%2FwslO9J45m4JGnggRTyac%2FTB1KhygRZv%2BA2X3xbpbbo0bppmFAPSy5ldCrSp7xL6PFqCaAR3CoqQbv%2FU2ykslyIYO%2ByWLbCCjSG8SJstZteCN6Oj8BvlqFFeJM9fUB2bt904pY0xeX61qwhCMHGqUCPcoOrtpo%2FflPrDye%2F1EfiTsANo91EWlYiOmulNlm4VeAQ0pl7VxXeYt695xE3LzY0LY9X%2Fbulpdp%2F7neRjBrGivXxFLUJoIeHMz96xSDH%2BCqaAbBQoxVtJGFJmkJdykQ%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQ5VMVMN6QNWU5QQQ%2F20201104%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201104T211458Z&X-Amz-SignedHeaders=host&X-Amz-Expires=2700&X-Amz-Signature=181bc0ae135f0eaf116f5667d2486ba0d511df047f858cec784e9012b2f221a0"

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

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

print(response.text)