API Reference

Upload Document API

Once a lead is created, use this API to upload documnts. The content type should be multipart/form-data. One document should be uploaded at a time. Use the lead id received in the loan booking API to construct the URL for upload document API. The required documents must be passed here, then the disburse API can be called.

You can use the lead ID or you can also pass the Partner Load ID.

POST /api/v1/client/loan/<lead_id>/upload-document/

📘

Note the content type

Note that unlike other APIs, this API does not have a Content Type of "application/json", instead it is a usual form data upload, with Content Type of "multipart/form-data; boundary="

Due to the documentation system only supporting the rest APIs the panel on the right side does not have accurate code samples. Please see below code samples for correct implementations.

response = requests.post(
    'https://demo.onefin.in/api/v1/client/loan/{lead_id}/upload-document/',
    data=MultipartEncoder(
        fields={
            'file': (
                'filename.pdf',
                open('path to file', 'rb'),
                'application/pdf'
            ),
            'request': json.dumps({
                'document_id': '<insert document id>'
            })
        }
    ),
    auth=requests.auth.HTTPBasicAuth(client_id, client_secret)
)
curl --location --request POST 'https://demo.onefin.in/api/v1/client/loan/<lead id>/upload-document/' \
--header 'Authorization: Basic <authorization token>' \
--form 'document=@"<path to file>"' \
--form 'document_id="<document id>"'

The payload should contain the file as the file name and the same file name should be uploaded in the API.

🚧

Please note that the API checks for file sizes for certain extensions: '.pdf', '.jpg', '.jpeg', '.png', '.xlsx', '.xls'. For these extensions minimum file size must be 1 kb. This is done to avoid any corrupt file uploads.

📘

Bulk Upload Document API

This API is useful for uploading documents one by one, there is an alternate API to upload documents in bulk which is also available, please refer to Bulk Document Upload API for the same.

Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!