This API allows you to upload multiple documents at once, by passing in links of each of the documents you want to upload.
Use the below API URL to upload the documents.
/api/v1/client/loan/<lead id>/upload-documents/
Sample request payload is given below:
{
"taskType": "<sync/async>",
"documents": [
{
"fileUrl": "<file url>",
"docReferenceID": "<a document id for your side / compulsory in case async mode is to be chosen>",
"docCategory": "<any free text string / optional>",
"docSubCategory": "<This must match the document ids which are given in the Document Ids page>",
"encryptionKey": "<for any password for the document / in case it is present>",
"comments": "<for any comments on your side / optional>",
"coApplicantId": "<co applicant id in case the document is for one of the co applicants>",
"docNumber": "<a document number, to be used in case of bank statement uploads>"
}
]
}
There are two kinds of document upload modes - sync & async. In case of sync mode, the entire response comes back synchronously, else you can use the async mode, where you would get the response of success / failure of document upload process asynchronously, via webhooks.
Sample Response in case of success for the sync mode:
{
"is_success": true,
"data": {
"processed": [
"<doc reference id passed above>"
],
"errors": []
}
}
Sample Response in case of any of the documents are not valid for the sync mode:
{
"is_success": true,
"data": {
"errors": [
{
"docReferenceID": "<doc reference id passed above>",
"errorReason": {
"link_to_document": [
"Enter a valid URL."
]
},
"errorCode": "RequestValidationError"
}
]
}
}
Sample response in case of certain document tags are valid, but the files fail while downloading for any reason:
{
"is_success": true,
"data": {
"processed": [],
"failed": [
{
"errorReason": "Html Content-Type not allowed",
"docReferenceID": "lendingkart-789056478",
"errorCode": "invalid_response_content_type",
"status_code": "400"
}
]
}
}
In case the mode passed is neither sync or async, or the documents key is not present a separate error will be thrown:
{
"is_success": false,
"error": {
"message": "A input or Combination of input is missing or invalid.",
"code": "request_validation_error"
}
}
In case the mode passed is async, the following response is returned. The documents which are accepted would be downloaded and stored in the system.
{
"is_success": true,
"data": {
"accepted": [
{
"docReferenceID": "12UIO-IU88IHJI-97HJHY6-98UJHGHP",
"ackId": "e497ddbc-2b33-4da8-8a12-4ef7e365eeb6"
}
],
"errors": [
{
"docReferenceID": "12UIO-IU88IHJI-97HJHY6-98UJHGH",
"errorReason": {
"document_tag": [
"Select a valid choice. PAN is not one of the available choices."
],
"link_to_document": [
"Enter a valid URL."
]
},
"errorCode": "RequestValidationError"
}
]
}
}