Upload a customer document. For best results, all documents should be in PDF format.
Bank statement data collected via Open Banking can be sent as a JSON file.
To send multiple bank statements as JSON, make a separate request for each statement.
(Do not combine multiple statements into one file).
See the bank_statements endpoint description for how the bank statement JSON can be formatted.
This endpoint requires a HTTP multipart form data POST request.
The document_type part indicates what kind of document is being uploaded (e.g. bank statement or VAT return).
The document part contains the file itself.
This is what the HTTP request body looks like when uploading a short text file called profit-and-loss.txt
for the customer id 823de4e0-c741-4fbe-b926-c6c04f5a7c35 using the v2.1 Lending API in the
stage.iwoca-dev.co.uk environment:
POST /api/lending/v2.1/document_upload/823de4e0-c741-4fbe-b926-c6c04f5a7c35/ HTTP/1.1
Authorization: Bearer 0000000000000000000000000000000000000000
Accept: */*
Cache-Control: no-cache
Host: stage.iwoca-dev.co.uk
Accept-Encoding: gzip, deflate, br
Content-Type: multipart/form-data; boundary=--------------------------630838601337119842678298
Content-Length: 373
----------------------------630838601337119842678298
Content-Disposition: form-data; name="document_type"
Content-Type: text/plain
profit and loss
----------------------------630838601337119842678298
Content-Disposition: form-data; name="document"; filename="profit-and-loss.txt"
Content-Type: text/plain
This is the Profit And Loss Statement for Example Company.
This year, we made...
----------------------------630838601337119842678298--
It is uploading the file as the document type 'profit and loss'. To send a PDF bank statement you would:
document_type part, replace profit and loss with bank statementdocument part, change the Content-Type to application/pdfAnd don't forget to:
Authorization, Content-Length, Host etc.)curl --request POST \
--url https://stage.iwoca-dev.co.uk/api/lending/v2.1/document_upload/823de4e0-c741-4fbe-b926-c6c04f5a7c35/ \
--header 'Accept: application/json' \
--header 'Authorization: Bearer 0000000000000000000000000000000000000000' \
--header 'Content-Type: multipart/form-data' \
--form document=@profit-and-loss.txt \
--form 'document_type=profit and loss'
#!/usr/bin/python3
import requests
api_token = "0000000000000000000000000000000000000000"
customer_id = "823de4e0-c741-4fbe-b926-c6c04f5a7c35"
filename = "profit-and-loss.txt"
url = f"https://stage.iwoca-dev.co.uk/api/lending/v2.1/document_upload/{customer_id}/"
headers = {"Authorization": f"Bearer {api_token}"}
with open(filename, "rb") as opened_file:
files_dict = {"document": (filename, opened_file)}
form_dict = {"document_type": "profit and loss"}
response = requests.post(url, files=files_dict, data=form_dict, headers=headers)
assert response.status_code == 201, response.content.decode()
/document_upload/{customer_id}/You must put the word
BearerorTokenin theAuthorizationheader before your token e.g:Authorization: Bearer <Your API token>Examples generated from this schema may be missing the word
Bearer.
The unique customer_id used to represent a customer.
Success
Unique identifier for an uploaded document.
Type of uploaded document.
| File type | Value |
|---|---|
| Bank statement | bank statement |
| Company Accounts | business accounts |
| VAT Return | vat return |
| Invoices | invoices |
| Personal ID | personal id |
| Customer's broker consent | customer broker consent |
| Balance Sheet | balance sheet |
| Profit and Loss | profit and loss |
| Company Bylaws | company bylaws |
| NIF Card | nif card |
| Modelo | modelo |
| Management Accounts | management accounts |
| Aged Debtor Report | aged debtor report |
| Business Plan | business plan |
| Self Assessment Tax Return | self assessment tax return |
| Personal Bank Statement | personal bank statement |
| Other | other |
| Cash Register | cash register |
| Cashflow Forecast | cashflow forecast |
| Outstanding debt information | outstanding debt information |
| List of shareholders | list of shareholders |
| Cbils Questionnaire | cbils questionnaire |
bank statementbusiness accountsvat returninvoicespersonal idcustomer broker consentbalance sheetprofit and losscompany bylawsnif cardmodelomanagement accountsaged debtor reportbusiness planself assessment tax returnpersonal bank statementothercash registercashflow forecastoutstanding debt informationlist of shareholderscbils questionnaireDate the document was uploaded