Files

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

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

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

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")