Skip to main content

Files

List files stored in a workspace. Requires the files scope and a workspace_id.

GET/v1/filesfiles scope

List files in a workspace. Returns metadata only.

ParameterTypeDescription
workspace_id *stringWorkspace to list files from.
prefixstringFilter by path prefix, e.g. results/.
limitintegerMax results (default 100).
files = client.files.list(workspace_id="ws_abc123")
for f in files:
    print(f"{f['name']} — {f['size'] / 1024:.1f} KB  key={f['key']}")
POST/v1/files/uploadfiles scope

Upload a file via multipart/form-data. Max 500 MB. For larger files use the presigned URL flow.

Form fieldTypeDescription
file *binaryFile bytes.
workspace_id *stringDestination workspace.
pathstringOptional folder path, e.g. raw/.
descriptionstringOptional description.
result = client.files.upload(
    "sample.vcf",
    workspace_id="ws_abc123",
    path="raw/",
)
file_key = result["key"]   # pass this to query or download
GET/v1/files/downloadfiles scope

Returns a presigned S3 download URL valid for ~1 hour. Fetch that URL directly to get the file bytes.

ParameterTypeDescription
workspace_id *stringWorkspace the file belongs to.
key *stringS3 key of the file.
# Download directly to disk (one-liner)
local_path = client.files.download(
    result["key"], workspace_id="ws_abc123", dest="./output/"
)
print(f"Saved to {local_path}")
DELETE/v1/filesfiles scope

Delete a file. Requires workspace_id and key as query parameters.

client.files.delete(result["key"], workspace_id="ws_abc123")

Large file upload (>500 MB)

Use a two-step presigned URL flow to upload large files directly to S3.

1. POST /v1/files/upload-url
2. PUT to S3
3. POST /v1/files/upload-confirm
import requests, os

path = "large_genome.bam"
size = os.path.getsize(path)

# 1. Request presigned URL
info = client.files.upload_large(
    filename=os.path.basename(path),
    workspace_id="ws_abc123",
    content_type="application/octet-stream",
    size=size,
    path="bam/",
)

# 2. PUT bytes directly to S3
with open(path, "rb") as f:
    requests.put(info["uploadUrl"], data=f,
                 headers={"Content-Type": "application/octet-stream"})

# 3. Confirm
result = client.files.upload_confirm(
    file_key=info["fileKey"],
    workspace_id="ws_abc123",
    filename=os.path.basename(path),
    size=size,
)
print(result["key"])