Documentation index for AI agents (llms.txt)

Append .md to any page URL for its markdown source, or fetch llms-full.txt for the complete corpus.

Documents

Upload a document

Upload a customer document. Send PDFs rather than images or word processor files, which take longer for iwoca to process.

Better still, if you have bank statement data collected via Open Banking, send it 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.

Request example

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:

  • In the document_type part, replace profit and loss with bank statement
  • In the document part, change the Content-Type to application/pdf

And don't forget to:

  • Change the customer ID in the URL to the appropriate customer ID
  • Set the headers as appropriate (with the correct Authorization, Content-Length, Host etc.)

curl example

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'

python3 example

#!/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()
POST/document_upload/{customer_id}/

Authorizations

Authorizationstringheaderrequired

You must put the word Bearer or Token in the Authorization header before your token e.g:

Authorization: Bearer <Your API token>

Examples generated from this schema may be missing the word Bearer.

Path parameters

customer_idstringrequired

The unique customer_id used to represent a customer.

Responses

Success

document_idstring<hash>required

Unique identifier for an uploaded document.

document_namestringrequired
<= 255 characters
document_typestringrequired

Type of uploaded document.

File typeValue
Kontoauszugbank statement
Jahresberichtbusiness accounts
Umsatzsteuererklärungvat return
Rechnungeninvoices
Personalausweispersonal id
Broker Einverständniscustomer broker consent
Bilanzbalance sheet
Gewinn-und-Verlust-Rechnungprofit and loss
Satzung der Gesellschaftcompany bylaws
NIF Kartenif card
Modelomodelo
Unterjährige BWAmanagement accounts
Liste aller offenen Postenaged debtor report
Businessplanbusiness plan
Privater Kontoauszugpersonal bank statement
Andereother
BWA zum Jahresendeyear end management accounts
Unterjährige BWA und SuSamanagement and balance accounts
BWA und SuSa zum Jahresendeyear end management and balance accounts
ID Beschränkt haftende Teilhaberlimited partner id
Anteilsregistershare registry
Gesellschaftsvertragarticles of association
ID Anteilseignershareholder id
Gewerbescheintrade certificate
Kassecash register
Gesellschafterlistelist of shareholders
CBILS Fragebogencbils questionnaire
Allowed values:bank statementbusiness accountsvat returninvoicespersonal idcustomer broker consentbalance sheetprofit and losscompany bylawsnif cardmodelomanagement accountsaged debtor reportbusiness planpersonal bank statementotheryear end management accountsmanagement and balance accountsyear end management and balance accountslimited partner idshare registryarticles of associationshareholder idtrade certificatecash registerlist of shareholderscbils questionnaire
<= 40 characters
upload_datestring<date-time>required

Date the document was uploaded