Files

The public API supports uploading files up to 2 GB. If you would like to upload files larger than this, they must be uploaded using the website.

To upload a file, use the following endpoint:

Upload file

POST https://app.biodock.ai/api/external/filesystem-items/upload-file

Headers

NameTypeDescription

X-API-KEY*

String

API key.

Request Body

NameTypeDescription

fileName*

String

Desired name of file in the Biodock filesystem.

destinationFolder

String

Desired parent folder of file in the Biodock filesystem. Will create folders if they do not exist. Defaults to the root folder.

upload*

file

File to upload.

{
    id: "0123456789",
    __t: "File"
}

To view items in the Biodock filesystem, use the following endpoint:

List filesystem items

GET https://app.biodock.ai/api/external/filesystem-items

Query Parameters

NameTypeDescription

limit

Number

Maximum number of results to show.

startingAfter

String

Pagination cursor id.

folderId

String

Parent folder id. Will default to root folder.

Headers

NameTypeDescription

X-API-KEY*

String

API key.

{
    results: [{
        id: "0123456789",
        name: "my_file.png",
        createdAt: "2000-01-01T00:00:00.001Z",
        __t: "File"
    }, 
    {
        id: "1234567890",
        name: "my_folder",
        createdAt: "2000-01-01T00:00:00.001Z",
        __t: "Folder"
    }],
    count: 2
}

Sample Usage

Upload a file

import requests

API_KEY = "" # Replace with your api key
FILE_TO_UPLOAD = "" # Replace with your file path
DESIRED_FILENAME = "" # Replace with your desired filename
DESIRED_FOLDER = "" # Replace with your desired folder

URL = "https://app.biodock.ai/api/external/filesystem-items/upload-file"

with open(FILE_TO_UPLOAD, "rb") as file_to_upload:
    data = {"fileName": DESIRED_FILENAME, "destinationFolder": DESIRED_FOLDER}
    headers = {"X-API-KEY": API_KEY}
    files = {"upload": file_to_upload}
    response = requests.post(URL, data=data, headers=headers, files=files)
    print(response.text)

List filesystem items in the root folder

import requests

API_KEY = "" # Replace with your api key

URL = "https://app.biodock.ai/api/external/filesystem-items"
headers = {"X-API-KEY": API_KEY, "Content-Type": "application/json"}

response = requests.get(URL, headers=headers)
print(response.text)

List filesystem items in a different folder

import requests

API_KEY = "" # Replace with your api key
FOLDER_ID = "" # Replace with your folder id

URL = f"https://app.biodock.ai/api/external/filesystem-items?folderId={FOLDER_ID}"
headers = {"X-API-KEY": API_KEY, "Content-Type": "application/json"}

response = requests.get(URL, headers=headers)
print(response.text)

Last updated