harbor0APIBeta

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

Authentication

Every request carries a personal access token in the Authorization header:

GET /v1/users/me HTTP/1.1
Host: api.harbor0.com
Authorization: Bearer h0_pat_Wq3…
User-Agent: my-backup-script/1.2

Creating a token

Create tokens in the web app under Settings → harbor0 API → Create API key. The app calls them API keys; they are the same tokens rclone uses, and each one works with any tool. Each token has:

  • A name, shown in Settings and in your device list, so you can tell your tokens apart.
  • Access: Read and write (FULL) or Read-only (READ). A read-only token can list, search and download. Any other write is refused with TOKEN_SCOPE.
  • An expiry, or none. An expired token is refused with AUTH_INVALID.

The token is shown once, when you create it. harbor0 keeps only a SHA-256 of it, so a lost token cannot be shown again: revoke it and create another. You can have up to 20 tokens at a time.

How a token appears in your account

Each token is a device of its own, with the platform CLI. It is listed under Devices, and signing that device out or revoking the token in Settings stops it at once. Requests after that get 401 AUTH_INVALID.

Send a User-Agent of the form name/version (for example my-backup-script/1.2). harbor0 shows it as the token's app version, which helps you see which tool last used a token.

What a token can reach

Tokens can call My Drive routes, and nothing else:

RoutesMethods
/v1/drive/…all
/v1/uploads/…all
/v1/folder-downloads/…all
/v1/downloads, /v1/searchas documented
/v1/users/me, /v1/e2eeGET only

Everything else, such as signing in, changing account settings, sharing, transfers, devices, backups and creating tokens, is refused with 403 TOKEN_NOT_ALLOWED. That keeps a leaked token from taking over the account; the worst it can do is what its scope allows inside My Drive.

End-to-end encrypted accounts

On an account with end-to-end encryption, the file routes (/v1/drive, /v1/uploads, /v1/downloads, /v1/folder-downloads, /v1/search) refuse a token unless the request also says it handles the encryption format itself:

X-Harbor-E2EE: h0e1

Without it, those routes answer 403 E2EE_UNSUPPORTED. The header is a promise that your code decrypts names and contents it reads and encrypts names and contents it writes, as described in the encryption guides. A tool that does not keep that promise would show ciphertext as if it were your files and could store unencrypted files in an encrypted account, which is why the header is required.

GET /v1/users/me and GET /v1/e2ee work without the header, so a tool can find out whether an account is encrypted before it decides what to send.

Keeping tokens safe

  • Store tokens in environment variables or a secrets manager, never in source code.
  • Give each tool its own token, so you can revoke one without breaking the others.
  • Use Read-only for anything that only needs to download, such as a restore script or a mirror.
  • Set an expiry for tokens used by short projects.
  • Never put a token in a URL. Send it only in the Authorization header.
  • Download and upload URLs returned by the API are already signed. Do not send your token to them.