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"
}
}codeis stable. Branch on it in your code.messageis written for people and may change. Show it, but don't parse it.requestIdidentifies the request in harbor0's logs. Include it if you contact support.- Some errors add a
detailsobject with more information. AREVISION_CONFLICTincludes the item as it is now (serverItem) and itsserverRevision, andSTORAGE_QUOTA_EXCEEDEDincludesrequiredBytesandavailableBytes.
Common codes
| Status | Code | What it means | What to do |
|---|---|---|---|
| 400 | VALIDATION_ERROR | The request body or query is not valid. | Fix the request. The message names the problem. |
| 401 | AUTH_REQUIRED | No Authorization header. | Send the token. |
| 401 | AUTH_INVALID | The token is wrong, expired or revoked. | Create a new token. |
| 403 | TOKEN_NOT_ALLOWED | Tokens cannot call this route. | Use the harbor0 apps for this. |
| 403 | TOKEN_SCOPE | A read-only token tried to change something. | Use a read and write token. |
| 403 | E2EE_UNSUPPORTED | The 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. |
| 404 | ITEM_NOT_FOUND | No item with that ID, or not yours. | |
| 404 | PARENT_NOT_FOUND | The folder you named does not exist. | |
| 404 | UPLOAD_NOT_FOUND | No upload with that ID. | |
| 409 | NAME_CONFLICT | Something with that name is already in the folder. | Pick another name, or update the existing file. |
| 409 | REVISION_CONFLICT | The item changed since you read it. | Read it again and retry with the new revision. |
| 409 | IDEMPOTENCY_KEY_REUSED | You reused an operation ID for a different request. | Use a new operation ID. |
| 409 | CONCURRENT_UPDATE | Another change to the same data was in progress. | Retry the same request with the same operation ID. |
| 409 | STORAGE_QUOTA_EXCEEDED | The account has no room for this file. | Free up space or get more storage. |
| 400 | HASH_MISMATCH | The 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. |
| 410 | UPLOAD_EXPIRED | The upload was not completed in time. | Start a new upload. |
| 429 | RATE_LIMITED | Too many requests. | Wait for Retry-After seconds, then retry. |
| 500 | INTERNAL_ERROR | Something 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
| Limit | Applies to |
|---|---|
| 600 requests a minute | Each account, across all of its apps and tokens. |
| 300 requests a minute | Each token, within the account's limit. |
| 1,800 requests a minute | Upload routes, counted separately so a large upload never starves the rest. |
| 20,000 uploads a day | Uploads 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.