harbor0APIBeta

Beta. The harbor0 API is still in beta, so routes and responses may change before it is final. What beta means

API reference

Every route a personal access token can call, generated from harbor0's OpenAPI description. All routes live on https://api.harbor0.com and take Authorization: Bearer <token>; on end-to-end encrypted accounts, file routes also need X-Harbor-E2EE: h0e1. Field types are shown TypeScript-style: ? marks a field you may leave out. The same routes are available as an OpenAPI file for code generators.

Account

Guide: account.

GET /v1/users/me

Current account, quota, and the features turned on for it on this app.

Response (returns User, Storage):

{
  user: User
  storage: Storage
  flags?: { … }
}

GET /v1/e2ee

End-to-end encryption: whether it is on, the wrapped keys and unlocked devices.

Response (returns E2eeState):

{
  e2ee: E2eeState
}

Browsing

Guide: browsing.

GET /v1/drive/items/{id}

Read item metadata.

ParameterInType
idpathstring

Response (returns Item):

{
  item: Item
}

GET /v1/drive/folders/{id}/children

List a folder.

ParameterInType
idpathstring
cursor (optional)querystring
limit (optional)querynumber

Response (returns Item):

{
  items: Item[]
  nextCursor: string | null
}

GET /v1/drive/folders/{id}/lookup

Find the item with a name in a folder, compared the way names are kept unique.

ParameterInType
idpathstring
namequerystring

Response (returns Item):

{
  item: Item
}

GET /v1/search

Search file metadata.

ParameterInType
cursor (optional)querystring
limit (optional)querynumber
q (optional)querystring
type (optional)querystring
mimeType (optional)querystring
extension (optional)querystring
parentId (optional)querystring
createdAfter (optional)querystring
createdBefore (optional)querystring
updatedAfter (optional)querystring
updatedBefore (optional)querystring
favorite (optional)querystring
trash (optional)querystring
recent (optional)querystring

Response (returns Item):

{
  items: Item[]
  nextCursor: string | null
}

GET /v1/drive/items/{id}/versions

List file versions.

ParameterInType
idpathstring

Response (returns Version):

{
  items: Version[]
}

GET /v1/drive/usage

Read the storage used by folders, every stored version included.

ParameterInType
ids (optional)querystring

Response:

{
  items: {
    itemId: string  // up to 128 characters
    bytes: number
    files: number
    complete: boolean
  }[]
}

Changing items

Guide: changing items.

PATCH /v1/drive/items/{id}

Rename an item.

ParameterInType
idpathstring

Request body:

{
  operationId: string  // UUID
  baseRevision: number
  name: string  // up to 400 characters
}

Response (returns Item):

{
  item: Item
}

DELETE /v1/drive/items/{id}

Move to trash.

ParameterInType
idpathstring

Request body:

{
  operationId: string  // UUID
  baseRevision: number
}

Response (returns Item):

{
  item: Item
}

PATCH /v1/drive/items/{id}/modified

Set a file's modification time without changing its content or revision.

ParameterInType
idpathstring

Request body:

{
  baseRevision: number
  modifiedAt: string  // ISO 8601 time
}

Response (returns Item):

{
  item: Item
}

POST /v1/drive/folders

Create folder.

Request body:

{
  operationId: string  // UUID
  parentId?: string | null  // up to 128 characters
  name: string  // up to 400 characters
}

Response (returns Item):

{
  item: Item
}

POST /v1/drive/items/{id}/move

Move an item, renaming it on the way when a name is given.

ParameterInType
idpathstring

Request body:

{
  operationId: string  // UUID
  baseRevision: number
  parentId: string | null  // up to 128 characters
  name?: string  // up to 400 characters
}

Response (returns Item):

{
  item: Item
}

POST /v1/drive/items/{id}/restore

Restore from trash.

ParameterInType
idpathstring

Request body:

{
  operationId: string  // UUID
  baseRevision: number
}

Response (returns Item):

{
  item: Item
}

DELETE /v1/drive/items/{id}/permanent

Permanently delete a trashed item.

ParameterInType
idpathstring

Request body:

{
  operationId: string  // UUID
  baseRevision: number
}

Response:

{
  deleted: boolean
  jobId?: string
}

POST /v1/drive/trash/empty

Empty the trash at once; content is deleted in the background (cursor is ignored, nextCursor is always null).

Request body:

{
  operationId: string  // UUID
  cursor?: string
}

Response:

{
  count: number
  nextCursor: string | null
}

PUT /v1/drive/items/{id}/favorite

Change favorite.

ParameterInType
idpathstring

Request body:

{
  operationId: string  // UUID
  baseRevision: number
}

Response (returns Item):

{
  item: Item
}

DELETE /v1/drive/items/{id}/favorite

Change favorite.

ParameterInType
idpathstring

Request body:

{
  operationId: string  // UUID
  baseRevision: number
}

Response (returns Item):

{
  item: Item
}

POST /v1/drive/items/{id}/versions/{versionId}/restore

Restore a version.

ParameterInType
idpathstring
versionIdpathstring

Request body:

{
  operationId: string  // UUID
  baseRevision: number
}

Response (returns Item):

{
  item: Item
}

Uploads

Guide: uploads.

POST /v1/uploads

Reserve quota and create upload.

Request body:

{
  operationId: string  // UUID
  parentId?: string | null  // up to 128 characters
  name: string  // up to 400 characters
  sizeBytes: number
  mimeType?: string  // up to 255 characters
  contentHash?: string | null  // SHA-256, hex
  driveItemId?: string  // up to 128 characters
  baseRevision?: number
  encrypted?: boolean
  modifiedAt?: string  // ISO 8601 time
  fileCreatedAt?: string  // ISO 8601 time
}

Response (returns Upload, Storage):

{
  upload: Upload
  storage: Storage
}

POST /v1/uploads/batch

Create several small uploads at once: each gets an upload and one storage part URL.

Request body:

{
  uploads: ({
    operationId: string  // UUID
    parentId?: string | null  // up to 128 characters
    name: string  // up to 400 characters
    sizeBytes: number
    mimeType?: string  // up to 255 characters
    contentHash?: string | null  // SHA-256, hex
    driveItemId?: string  // up to 128 characters
    baseRevision?: number
    encrypted?: boolean
    modifiedAt?: string  // ISO 8601 time
    fileCreatedAt?: string  // ISO 8601 time
  })[]
}

Response:

{
  results: { … }[]
}

POST /v1/uploads/batch/finish

Finish several small uploads at once.

Request body:

{
  files: {
    uploadId: string  // up to 128 characters
    etag: string  // up to 256 characters
    contentHash: string  // SHA-256, hex
  }[]
}

Response:

{
  results: { … }[]
}

GET /v1/uploads/{id}

Resume an upload.

ParameterInType
idpathstring

Response (returns Upload):

{
  upload: Upload
  parts: {
    partNumber: number  // 1–10000
    etag: string  // up to 256 characters
  }[]
}

DELETE /v1/uploads/{id}

Abort upload and release reservation.

ParameterInType
idpathstring

Response (returns Upload):

{
  upload: Upload
}

POST /v1/uploads/{id}/parts

Sign upload part URLs.

ParameterInType
idpathstring

Request body:

{
  partNumbers: number[]  // 1–10000
}

Response:

{
  parts: {
    partNumber: number
    uploadUrl: string
    expiresAt: string
  }[]
}

POST /v1/uploads/{id}/complete

Finalize upload atomically.

ParameterInType
idpathstring

Request body:

{
  parts: {
    partNumber: number  // 1–10000
    etag: string  // up to 256 characters
  }[]
  contentHash: string  // SHA-256, hex
}

Response (returns Item):

{
  item: Item
}

Downloads

Guide: downloads.

POST /v1/folder-downloads

Prepare one folder ZIP in the background.

Request body:

{
  operationId: string  // UUID
  driveItemId: string  // up to 128 characters
}

Response (returns FolderDownload):

GET /v1/folder-downloads/{id}

Read ZIP preparation progress.

ParameterInType
idpathstring

Response (returns FolderDownload):

DELETE /v1/folder-downloads/{id}

Cancel ZIP preparation.

ParameterInType
idpathstring

Response:

{
  cancelled: boolean
}

POST /v1/downloads

Authorize a short-lived download.

Request body:

{
  folderDownloadId?: string  // up to 128 characters
  driveItemId?: string  // up to 128 characters
  versionId?: string | null  // up to 128 characters
}

Response (returns DownloadLink):

Objects

The objects routes return. Object names in the code above link here, and each object lists the routes that return it.

User

Your account, as GET /v1/users/me returns it.

{
  id: string
  email: string
  emailVerified: boolean
  username: string
  displayName: string
  avatarUrl: string | null
  appearance?: {
    preference: "light" | "dark" | "system"
    preset: "default" | "ocean" | "forest" | "violet" | "sunset"
    palettes: {
      light: {
        primary?: string
        background?: string
        card?: string
        sidebar?: string
        border?: string
      }
      dark: {
        primary?: string
        background?: string
        card?: string
        sidebar?: string
        border?: string
      }
    }
  }
  emailPreferences?: {
    productUpdates: boolean
  }
  storageQuotaBytes: number
  storageUsedBytes: number
  storageReservedBytes: number
  e2ee?: {
    enabledAt: string
    decryptingSince?: string
  }
  createdAt: string
  updatedAt: string
}

Returned by:

E2eeState

Whether end-to-end encryption is on, and the wrapped master key. See Unlocking the account key.

{
  enabled: boolean
  enabledAt: string | null
  passphrase: {
    v: 1
    kdf: "argon2id"
    salt: string  // up to 2048 characters
    memoryKiB: number  // 19456–1048576
    iterations: number  // 2–20
    parallelism: number  // 1–8
    iv: string  // up to 2048 characters
    ciphertext: string  // up to 2048 characters
  } | null
  recovery: {
    v: 1
    kdf: "hkdf"
    salt: string  // up to 2048 characters
    iv: string  // up to 2048 characters
    ciphertext: string  // up to 2048 characters
  } | null
  recoveryCreatedAt: string | null
  passphraseChangedAt: string | null
  devices: {
    id: string
    name: string
    platform: string
    remember: boolean
    createdAt: string
    lastUsedAt: string
  }[]
  migration: {
    totalFiles: number
    doneFiles: number
    totalBytes: number
    doneBytes: number
    skippedFiles: number
    complete: boolean
    deviceName: string | null
    updatedAt: string | null
  } | null
  decryptingSince: string | null
  decryption: {
    totalFiles: number
    doneFiles: number
    totalBytes: number
    doneBytes: number
    skippedFiles: number
    complete: boolean
    deviceName: string | null
    updatedAt: string | null
  } | null
}

Returned by:

Item

A file or folder. See Requests and responses for what each field means.

{
  backupRootId?: string
  access?: "EDITOR" | "VIEWER"
  syncRemovedAt?: string | null
  cloudState?: "AVAILABLE" | "RELEASED" | "REQUESTED"
  id: string
  ownerUserId: string
  parentId: string | null
  type: "FILE" | "FOLDER"
  name: string
  normalizedName: string
  mimeType: string | null
  sizeBytes: number
  currentVersionId: string | null
  revision: number
  favorite: boolean
  createdAt: string
  updatedAt: string
  deletedAt: string | null
  encrypted?: boolean
  contentHash?: string | null  // SHA-256, hex
  uploadMismatch?: boolean
  modifiedAt?: string | null
  fileCreatedAt?: string | null
}

Returned by:

Also part of Upload.

Upload

An upload in progress. See Uploading files.

{
  id: string
  state: "CREATED" | "UPLOADING" | "COMPLETING" | "COMPLETED" | "FAILED" | "ABORTED" | "EXPIRED"
  multipart: boolean
  partSizeBytes: number
  expectedSizeBytes: number
  expiresAt: string
  failure?: string
  item?: Item
}

Returned by:

Storage

The account's storage, in bytes.

{
  quotaBytes: number
  usedBytes: number
  reservedBytes: number
  availableBytes: number
  trashBytes?: number
  freeing?: {
    bytes: number
    estimatedBytes: number | null
  }
}

Returned by:

Version

One stored version of a file. See Versions of a file.

{
  cloudState?: "AVAILABLE" | "RELEASED"
  id: string
  driveItemId: string
  versionNumber: number
  sizeBytes: number
  contentHash: string  // SHA-256, hex
  contentHashAlgorithm: "SHA256"
  uploadMismatch?: boolean
  storedContentHash?: string  // SHA-256, hex
  sourceDeviceId: string | null
  encrypted?: boolean
  keyHeader?: string
  modifiedAt?: string | null
  fileCreatedAt?: string | null
  createdAt: string
}

Returned by:

A short-lived link to a file's stored bytes. See Downloading files.

{
  downloadUrl: string
  expiresAt: string
  sizeBytes: number
  contentHash: string  // SHA-256, hex
  contentHashAlgorithm: "SHA256"
  encrypted?: boolean
  uploadMismatch?: boolean
}

Returned by:

FolderDownload

A folder ZIP being prepared. See Downloading a folder as a ZIP.

{
  id: string
  name: string
  state: "QUEUED" | "LISTING" | "BUILDING" | "FINALIZING" | "READY" | "FAILED" | "CANCELLED" | "EXPIRED"
  files: number
  bytes: number
  totalFiles: number
  totalBytes: number | null
  currentFile: string | null
  error: string | null
  expiresAt: string
  downloadUrl?: string
  sizeBytes?: number
  contentHash?: string
}

Returned by: