The Files API allows you to upload, download, and delete files from the Tensorlake platform.

The File IDs are accepted by Document Ingestion APIs to begin document processing on the uploaded file.

All the code examples on this page use the official Tensorlake Python SDK. For other languages, please consult our API Reference.

Interacting with the Files API through the Python SDK

The following code snippets show how to upload, list, and delete files using the Python SDK.

Uploading a file

from tensorlake.documentai import DocumentAI

doc_ai = DocumentAI(api_key="xxxx")
file_id = doc_ai.upload(path="/path/to/finance_stock_report.pdf")

The file_id is returned with a tensorlake- id.

Listing Uploaded Files

You can list all the documents in a project using the following API call:

from tensorlake.documentai import DocumentAI, FileInfo
doc_ai = DocumentAI(api_key="xxxx")

files_page = doc_ai.files()

Files are exposed using cursor-based pagination.

Deleting Uploaded Files

from tensorlake.documentai import DocumentAI
doc_ai = DocumentAI(api_key="xxxx")
doc_ai.delete_file(file_id="tensorlake-XXX")