harbor0APIBeta

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

Errors and rate limits

The error format

Any request that fails returns an HTTP status of 400 or above and a body like this:

{
  "error": {
    "code": "REVISION_CONFLICT",
    "message": "This item changed on another device.",
    "requestId": "8cc13486-7459-437b-9551-23f0e5a2a1c0"
  }
}
  • code is stable. Branch on it in your code.
  • message is written for people and may change. Show it, but don't parse it.
  • requestId identifies the request in harbor0's logs. Include it if you contact support.
  • Some errors add a details object with more information. A REVISION_CONFLICT includes the item as it is now (serverItem) and its serverRevision, and STORAGE_QUOTA_EXCEEDED includes requiredBytes and availableBytes.

Common codes

StatusCodeWhat it meansWhat to do
400VALIDATION_ERRORThe request body or query is not valid.Fix the request. The message names the problem.
401AUTH_REQUIREDNo Authorization header.Send the token.
401AUTH_INVALIDThe token is wrong, expired or revoked.Create a new token.
403TOKEN_NOT_ALLOWEDTokens cannot call this route.Use the harbor0 apps for this.
403TOKEN_SCOPEA read-only token tried to change something.Use a read and write token.
403E2EE_UNSUPPORTEDThe account is end-to-end encrypted and the request did not send X-Harbor-E2EE: h0e1, or the feature is not available for encrypted accounts.See Authentication.
404ITEM_NOT_FOUNDNo item with that ID, or not yours.
404PARENT_NOT_FOUNDThe folder you named does not exist.
404UPLOAD_NOT_FOUNDNo upload with that ID.
409NAME_CONFLICTSomething with that name is already in the folder.Pick another name, or update the existing file.
409REVISION_CONFLICTThe item changed since you read it.Read it again and retry with the new revision.
409IDEMPOTENCY_KEY_REUSEDYou reused an operation ID for a different request.Use a new operation ID.
409CONCURRENT_UPDATEAnother change to the same data was in progress.Retry the same request with the same operation ID.
409STORAGE_QUOTA_EXCEEDEDThe account has no room for this file.Free up space or get more storage.
400HASH_MISMATCHThe contentHash sent to complete an upload differs from the one given when it was created.Check the file did not change while uploading, then upload again.
410UPLOAD_EXPIREDThe upload was not completed in time.Start a new upload.
429RATE_LIMITEDToo many requests.Wait for Retry-After seconds, then retry.
500INTERNAL_ERRORSomething went wrong on harbor0's side.Retry with the same operation ID.

Retrying safely

Retry a request when it fails with a network error, a 5xx status, 429 RATE_LIMITED or 409 CONCURRENT_UPDATE. Use exponential backoff with some jitter, and send the same operation ID each time, so a write that already went through is not repeated. Do not retry other 4xx errors without changing the request.

Rate limits

LimitApplies to
600 requests a minuteEach account, across all of its apps and tokens.
300 requests a minuteEach token, within the account's limit.
1,800 requests a minuteUpload routes, counted separately so a large upload never starves the rest.
20,000 uploads a dayUploads started with tokens, per account.

When you go over a limit, the response is 429 RATE_LIMITED with a Retry-After header giving the number of seconds until the limit resets:

HTTP/1.1 429 Too Many Requests
Retry-After: 23
Content-Type: application/json

{"error":{"code":"RATE_LIMITED","message":"Too many requests. Please try again shortly.","requestId":"…"}}

Wait that long before sending more requests. Once a request succeeds, carry on at full speed: the limits are counted per minute, so there is nothing to back off from once the minute has turned over.

Limits are counted per minute, so spreading work evenly is better than sending bursts. Lists of up to 500 items per page and signing several upload parts per request both help keep request counts down.