Skip to the page
Docs menu

Docs Tools and reference

Errors, idempotency and pagination

The error object and every error code, idempotency keys, rate limits, cursor pagination and request ids.

Reference for all three steps. Every call you make to Create, Scan and Sync follows these rules.

Availability#

TopicState
Error object and codesAvailable in the current build
Idempotency keysAvailable in the current build
Rate limitsAvailable in the current build
Cursor pagination, Request-IdAvailable in the current build
GET /models/detectorAvailable. Returns 503 model_unavailable where the environment does not hold the model file. Image uploads return 503 storage_unavailable where image storage is not configured.

Errors#

Every non-2xx response has the same body.

JSON
{
    "error": {
        "type": "invalid_request_error",
        "code": "group_not_empty",
        "message": "This group holds 12 logs, 1 scan and 2 groups, so it is kept as the record of them.",
        "param": null,
        "request_id": "req_...",
        "doc_url": "https://www.timbereye.com/docs/errors-idempotency-pagination/#error-codes"
    }
}
FieldMeaning
typeThe broad class
codeA stable, machine-readable code. Switch on this
messageA human explanation. Do not parse it
paramThe request field at fault, or null. Nested fields use dots, such as defaults.length
request_idThe value of the Request-Id response header
doc_urlA link to documentation for the code, or null

The message and request_id values above are examples. doc_url links to the error codes table on this page.

Types#

typeHTTP status
invalid_request_error400, 402, 404, 409, 412, 413, 422
authentication_error401
permission_error403
rate_limit_error429
api_error5xx, including 501 and 503

New codes may appear within v1. Treat an unknown code as the generic case for its type. Treat the HTTP status as the class and the code as the detail.

An object in another account is a 404 resource_missing, the same as an object that does not exist. Timbereye does not tell you that it exists elsewhere.

Error codes#

CodeStatusWhen it occurs
idempotency_key_missing400A POST that needs an Idempotency-Key has none
idempotency_key_reused409The same key was sent with a different request
idempotency_request_in_progress409A request with the same key is still running. Retry later
resource_missing404No such object, or it belongs to another account
resource_exists409A unique value is taken, for example a client_id or a species code
place_name_taken409Another active place of the account has this name. param is name
group_not_empty409The group holds or held logs, scans, groups or photos, or a phone may still capture into it: it is kept as the record. Correct or remove its logs instead
group_billed409A live group on the usage or billing ledger, or linked to a shipment, is kept for your records. Its logs can still be corrected or removed
place_in_use409Groups use the place as their origin, or shipping records refer to it
parameter_invalid400A field is malformed or out of range, such as an unknown volume rule
parameter_missing400A required field is absent
parameter_unknown400The request has a field the operation does not accept
unit_ambiguous422A bare ton was sent. Use t or short_ton
weight_inconsistent422Gross, tare and net disagree, or tare is above gross. param is net or tare
area_ha_not_allowed422area_ha was stated for a Polygon or MultiPolygon, whose area is computed. param is area_ha
invalid_cursor400starting_after is not a cursor this endpoint issued
test_mode_only403A test-mode operation (the simulator) was called with a live key
live_mode_not_enabled403Live mode is not on for the organisation. An owner turns it on under Billing in the console. See Going live
payment_overdue402An invoice is unpaid past its grace period. New live scans, groups, capture tokens and live keys are refused until it is paid
spend_cap_reached402This month reached the spend cap your organisation set to pause new live work. Raise the cap, or wait for the next month
group_cycle422A parent_id would put a group inside itself
group_depth_exceeded422Nesting would be deeper than 4
version_mismatch412If-Match does not equal the group's version. Nothing changed
payload_too_large413The body or upload is over the limit. Multipart images are at most 10 MB
invalid_api_key401The key is malformed, expired or revoked
authentication_required401There is no Authorization header
key_mode_mismatch400Timbereye-Mode disagrees with the key's mode
scope_missing403A restricted key lacks the scope the operation needs
secret_key_required403The operation, POST /capture_tokens, needs a secret key
capture_token_not_allowed403The operation is outside a capture token's reach
group_not_allowed403The group is outside the capture token's group_ids, or a publishable key with group_access: opened_only did not open it by reference
publishable_key_not_allowed403The operation is outside what a publishable key may call
installation_id_required400A publishable key request had no Timbereye-Installation-Id header (a lowercase UUID)
app_not_allowed403The publishable key is limited to certain apps and Timbereye-App-Id is missing or not one of them
daily_cap_reached429A publishable key hit a daily limit. param names it. Retry-After runs to 00:00 UTC
item_move_not_allowed409A scanned tag's log is in another group. A publishable key cannot move logs; a phone signed in to the app gets the group in details and sends allow_move: true once the worker confirms
spec_required400A scanned log has no species or no length, and its group's spec does not have them. param names the item's missing field. Set the spec, then retry
species_unknown400A species code is not on the account's species list, or was archived after a phone chose it. param names where it came from. Choose another, then retry
organisation_now_live403A test-mode device sign-in of an organisation that went live: it may upload what it captured (into test), not open or list groups. Sign in again
account_required403Dashboard sessions only: the session acts for no account, or its account is missing or not active. A key never gets it
shared_resource_read_only403You tried to change a shared resource, such as a shared port or a global species
permission_denied403The caller may not do this
state_conflict409The object's state does not allow the change
limit_exceeded400A limit was reached, such as 16 webhook endpoints or more than 500 items in one item write
assignment_required422Unknown tags on a qr_count add need a group spec with species, length and diameter class. Set it, then retry
upload_incomplete409POST /images/{id}/complete was called before all the bytes were uploaded
upload_hash_mismatch409The uploaded bytes do not match sha256
rate_limited429Too many requests. See Retry-After
not_implemented501The operation is in the contract but not built
isolation_unavailable503The resource's account isolation is not in place. Retry later
service_unavailable503A dependency is unavailable, such as image storage. Retry later
internal_error500A fault on our side. Quote the request id
client_id_conflict409A client_id already names a scan, image or item of yours with other identity fields. The same identity returns the existing record instead

Handling errors#

  • Retry on 429, 500, 503 and network errors. Use backoff. Wait for Retry-After when it is sent.
  • Retry on idempotency_request_in_progress.
  • Do not retry other 4xx errors. Fix the request.
  • A 402 is billing, not your request: new live work is paused until an owner pays or raises the cap (Pricing and billing). Reads keep working and scans already started still upload, so a phone never has to drop what it captured. Retry the refused call once billing is sorted.
  • A 5xx is safe to retry with the same Idempotency-Key. A replayed response carries the header Idempotent-Replayed: true.
  • A 501 is not transient: the route is not built. No route answers it.
  • A 503 model_unavailable from GET /models/detector means this environment has no detector file: run without on-device detection and ask again later (the SDKs do this at the next launch).
  • A 409 upload_incomplete or upload_hash_mismatch is repairable: call POST /images/{id}/session, upload the bytes again and call POST /images/{id}/complete with a new Idempotency-Key (see Idempotency below).

The TypeScript SDK retries network errors, timeouts, 409 idempotency_request_in_progress, 429 and 5xx, and never other 4xx. See TypeScript SDK.

When a scan or a log fails#

What you seeWhyWhat to do
A capture call refused with a 4xxThe error's code and message say what was wrong (Error codes); 402 is billingFix the request, or sort billing. Quote request_id to support
item.refinement_failed, the log's refinement.status failedThe server could not refine the log in five attemptsNothing breaks: the log keeps its device estimate and the scan still ends refined
scan.failed, the scan's status failedThe sitting could not be processed. Its logs stayScan the group again in a new scan
The scan stays estimatedA photo_count scan ends there by design; any other is waiting for refinementWait for scan.refined: the refinement queue is picked up every minute

The console's Events page lists scan.failed and item.refinement_failed for each mode, and its Support page sends support the ids of the requests that failed.

Idempotency#

An idempotency key makes a retry safe. If a connection drops, you do not know whether the request ran. Send it again with the same key. You get the first result, not a second object.

TypeScript
const group = await timbereye.groups.create(
    { kind: "container", externalRef: "ctr_4821", name: "MSKU1234567" },
    { idempotencyKey: "group-ctr_4821" },
)
curl
curl https://api.timbereye.com/v1/groups \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: group-ctr_4821" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "container", "external_ref": "ctr_4821", "name": "MSKU1234567" }'
CLI
timbereye groups create --kind container --external-ref ctr_4821 --name MSKU1234567 \
  --idempotency-key group-ctr_4821 --json
JSON
{ "id": "grp_7QxV3m", "object": "group", "external_ref": "ctr_4821" }

The same call again within 24 hours answers the same group, with the header Idempotent-Replayed: true.

MethodKey
POST that creates or changes stateRequired. Missing gives 400 idempotency_key_missing
PUT, PATCH, DELETEOptional
POST /places/validateIgnored. It only computes

Rules:

  • The key is a string you choose, 1 to 255 characters. A UUID works.
  • Keys are remembered for 24 hours.
  • Every response below 500, 4xx included, is stored and replayed under its key. A retry that must not replay a refusal (the second POST /images/{id}/complete after a re-upload, or any retry after you fixed the cause of a 4xx) needs a new key. A 5xx and a 429 are not stored.
  • A retry with the same key and the same request returns the original response.
  • The same key with a different request returns 409 idempotency_key_reused.
  • A retry while the first request is still running returns 409 idempotency_request_in_progress.
  • Derive keys from your own records, such as group-ctr_4821, so that a whole workflow step is safe to repeat. The SDK makes a fresh UUID per call if you do not give one.

Scans (the record of a sitting of scanning), images and scanned logs (items) also take a client_id: your durable id for the record, which the SDKs set so that records created offline reconcile when they sync. It has no time limit, unlike the key. Creating a scan or an image again with the same client_id returns the existing record (200) when its identity fields match (a scan's method, intent, group_id and replaces_scan_id; an image's subject, kind, scan, group or item, sha256 and content_length), and is 409 client_id_conflict when one differs. A capture token can find a scan again with GET /scans?client_id= (within its groups). Items and measurements in POST /scans/{id}/items are identified by the scan and the item's client_id, so a batch posted again under a new key adds no second measurement, and observations are idempotent by tag. Submitting a scan that was submitted already returns it (200). The full recovery rules are in the sync protocol.

Five refusals are not stored, because the same request will succeed once something else changes: 409 photos_required (a tally sent before a photo its group requires), 403 product_not_enabled (a bundle or unit opened while the product is off), 400 spec_required (logs sent with no species or length to a group whose spec has none) and 422 assignment_required (counted tags new to the account, in a group whose spec has no diameter class) and 400 species_unknown (a species taken off the account's list after a phone chose it; the phone chooses another and sends the request again under a new key). Send the same request with the same key again later; it runs again.

What is never replayed#

Secrets. These operations return a secret once:

OperationSecret
POST /capture_tokensThe capture token
POST /webhook_endpointsThe signing secret
POST /webhook_endpoints/{id}/roll_secretThe new signing secret

Timbereye never stores a secret for replay. A replay returns the object with secret: null. If you lost the secret, mint a new token or roll the signing secret.

Rate limits#

Limits are per account, per second.

ModeReads per secondWrites per second
Live5020
Test1010

Every authenticated response carries RateLimit-Limit, the limit for that kind of request, and RateLimit-Remaining, what is left in the current one-second window. Over the limit, you get 429 rate_limited with a Retry-After header. Wait for that long. POST /places/validate counts as a read, although it is a POST. Refinement has a separate fair-share queue, so it is not part of these limits.

Pagination#

List endpoints are cursor-paginated.

ParameterMeaning
limitPage size, 1 to 100. Default 25
starting_afterThe next_cursor of the previous page

The first page, then the next one from its next_cursor:

TypeScript
const page = await timbereye.groups.list({ kind: "container", limit: 50 })
const next = await timbereye.groups.list({ kind: "container", limit: 50, startingAfter: page.nextCursor! })
curl
curl "https://api.timbereye.com/v1/groups?kind=container&limit=50" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
curl "https://api.timbereye.com/v1/groups?kind=container&limit=50&starting_after=CURSOR" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye groups list --kind container --limit 50 --json
timbereye groups list --kind container --limit 50 --starting-after CURSOR --json
JSON
{
    "object": "list",
    "data": [{ "id": "grp_7QxV3m", "object": "group", "external_ref": "ctr_4821" }],
    "has_more": true,
    "next_cursor": "..."
}

data is shortened here. Pass next_cursor as starting_after (replace CURSOR) for the next page. next_cursor is null on the last page. Cursors are opaque. Do not build or parse them. An invalid cursor returns 400 invalid_cursor.

Two lists are not paginated: GET /volume_rules and the response of POST /scans/{id}/items. They return one page with has_more: false.

List endpoints have no date filters. Filters are listed per endpoint in the OpenAPI document.

With the TypeScript SDK, a list is also an async iterator that pages for you:

TypeScript
for await (const group of timbereye.groups.list({ kind: "container" })) {
    await db.containers.update(group.externalRef!, { timbereyeGroupId: group.id })
}

Request ids#

Every response has a Request-Id header. Errors repeat it as error.request_id. Log it. Quote it when you contact support. Request logs are kept without bodies for 30 days.