Downloading files
Get a download link
POST /v1/downloads
{ "driveItemId": "c41f0a8e-…" }{
"downloadUrl": "https://…",
"expiresAt": "2026-12-03T10:20:00.000Z",
"sizeBytes": 734003200,
"contentHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"contentHashAlgorithm": "SHA256",
"encrypted": false
}Fetch downloadUrl with a plain GET. It is a signed storage URL, so send no Authorization header. The link works for 5 minutes; a download that has already started may run past that, but a new request (such as the next range of a large file) needs a new link once it expires.
LINK=$(curl -s https://api.harbor0.com/v1/downloads \
-H "Authorization: Bearer $HARBOR0_TOKEN" -H 'Content-Type: application/json' \
-d '{"driveItemId":"c41f0a8e-…"}' | jq -r .downloadUrl)
curl -s -o holiday.mp4 "$LINK"Check what you got against contentHash, the SHA-256 of the stored bytes:
shasum -a 256 holiday.mp4If encrypted is true, the bytes are the encrypted file, and contentHash and sizeBytes describe those encrypted bytes. Check the hash first, then decrypt as shown in Decrypting files.
Ranges and resuming
The link supports HTTP Range requests, so you can resume a broken download or read part of a file:
curl -s -H 'Range: bytes=1048576-2097151' -o part.bin "$LINK"For a long download, ask for a fresh link before the old one expires and continue with a Range from where you stopped.
Earlier versions
Pass a versionId from GET /v1/drive/items/{id}/versions to download that version instead of the current one:
{ "driveItemId": "c41f0a8e-…", "versionId": "1d2e…" }Downloading a folder as a ZIP
harbor0 can pack a folder into one ZIP file for you. It runs in the background:
POST /v1/folder-downloads
{ "operationId": "…", "driveItemId": "9b7d…" }{ "id": "fd_17a…", "name": "Taxes.zip", "state": "QUEUED", "files": 0, "totalFiles": 0, "bytes": 0, "totalBytes": null, "expiresAt": "…" }Check on it every few seconds:
GET /v1/folder-downloads/{id}state moves through QUEUED, LISTING, BUILDING and FINALIZING to READY, while files, bytes, totalFiles and totalBytes show progress. Once READY, the response includes a downloadUrl, or you can get a fresh link at any time with:
POST /v1/downloads
{ "folderDownloadId": "fd_17a…" }If something goes wrong, state is FAILED and error says why. Cancel one you no longer need with DELETE /v1/folder-downloads/{id}. A finished ZIP is kept until its expiresAt.
Folder ZIPs are built on harbor0's servers, so they aren't available for end-to-end encrypted accounts (403 E2EE_UNSUPPORTED). Download and decrypt each file instead.