This is a Multi-part file upload, it consists of a json body with metadata and the file contents in the "file" key.

❗️

This endpoint differs from all the others because this is a Multi-part file upload instead of application/json

This is an example code that can be used to upload a file to this endpoint

import requests

def upload_file(url, file_name):
    data = {
        "document_type": "id_front",
        "file_length": 1024,
        "file_type": "image/png"
    }

    files = {
        "file": open(file_name, 'rb'),
    }

    resp = requests.post(url, files=files, data=data)

Please note that the example call generated by this page is not currently working, you need to add the "filename" field to the request, which is not added by the automatic call generator.

This is a valid request:

curl 'https://api.lirium-sandbox.com/v1/customers/{customer id}/documents' \
-H 'authorization: Bearer {JWT Token}'  \
-H 'content-type: multipart/form-data; boundary=----EXAMPLEMULTIPARTLIRIUMTEST--------'  \
 --data-raw $'------EXAMPLEMULTIPARTLIRIUMTEST--------\r\nContent-Disposition: form-data; name="document_type"\r\n\r\n{document type}\r\n------EXAMPLEMULTIPARTLIRIUMTEST--------\r\nContent-Disposition: form-data; name="file_type"\r\n\r\n{file type}\r\n------EXAMPLEMULTIPARTLIRIUMTEST--------\r\nContent-Disposition: form-data; name="file"; filename="sample1.jpg\r\n\r\n{file binary content}\r\n------EXAMPLEMULTIPARTLIRIUMTEST----------\r\n'

❗️

Content-Type

Supported file types:

  • application/pdf
  • image/png
  • image/jpeg
  • image/gif

We currently have a maximum upload size of 2MB, sending a file larger than this will result in an error (with http_code 413)

Language
Authorization
Header
Click Try It! to start a request and see the response here!