Skip to the page
Docs menu

Docs API reference

Images

Group images, item images and uploads.

The image object#

An image, either a group image or an item image. Check subject.

FieldDescription
JSON
{
  "id": "img_K3s9",
  "object": "image",
  "livemode": true,
  "client_id": null,
  "subject": "item",
  "scan_id": "scn_9a2Lk",
  "width": 1024,
  "height": 1024,
  "sha256": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d",
  "content_type": "image/jpeg",
  "content_length": 482113,
  "location": null,
  "captured_at": "2027-02-03T14:12:31Z",
  "status": "uploaded",
  "download_url": "https://files.timbereye.com/img_K3s9.jpg?expires=1801234567&signature=4d0c9a",
  "created_at": "2027-02-03T14:12:44Z",
  "kind": "log_end",
  "item_id": "itm_5Lw2Nc",
  "group_id": "grp_7QxV3m",
  "source_image_id": "img_Wd7Z",
  "region": { "x": 0.41, "y": 0.37, "width": 0.12, "height": 0.12 },
  "upload_session": { "open": false, "expires_at": null }
}

List a group's images#

GET/v1/groups/{id}/images

Returns the group's photos and scan frames (whole-scene images), oldest first by when they were added, with their kind, caption, who added them and a 15-minute download_url. width and height are the original's; there is no thumbnail rendition, so scale the original down for a gallery. Removed photos are left out unless include_removed=true (secret and restricted keys, the console).

Keys: secret key; restricted key with images:read; capture token (Allowed for the token's groups); publishable key (Allowed for a group the device may capture into, so the app can show the group's photos, whoever took them. Detections are included; nothing else about the group is).

Parameters

FieldDescription
id requiredstring, pathGroup id.
kindenum (frame, load_face, container_door, pile, seal, other, bundle_end, bundle_far_end, label, tally_sheet, unit_edge, overview, weigh_ticket, damage), queryOnly images of this kind.
include_removedboolean, queryInclude removed photos (with removed_at and removed_by). Secret and restricted keys and the console only.
include_childrenboolean, queryAlso the photos of the bundles and units in the group (its GET /groups/{id}/packing_list rows), after the group's own, child by child; each image's group_id says whose it is. A phone gets those of the children it may capture into; a capture token those of its groups.
limitinteger, queryPage size, 1 to 100.
starting_afterstring, queryOpaque cursor: pass the next_cursor of the previous page. Results are ordered by (created_at, id).
expand[]array of string, queryReplace an id field with the full object, e.g. expand[]=origin_place. Allowed values are listed on each resource.

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
for await (const image of timbereye.groups.listImages("grp_7QxV3m")) {
    // every page, one at a time
}
curl
curl https://api.timbereye.com/v1/groups/grp_7QxV3m/images \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye groups images list grp_7QxV3m --json

Response

JSON
// 200
{
  "object": "list",
  "data": [
    {
      "id": "img_Wd7Z",
      "object": "image",
      "livemode": true,
      "client_id": null,
      "subject": "group",
      "scan_id": "scn_9a2Lk",
      "width": 4032,
      "height": 3024,
      "sha256": "3b7e9d1f5a2c4e6081a3c5e7f9b1d3a5c7e9f1b3d5a7c9e1f3b5d7a9c1e3f5b7",
      "content_type": "image/jpeg",
      "content_length": 2841177,
      "location": null,
      "captured_at": "2027-02-03T14:11:58Z",
      "status": "uploaded",
      "download_url": "https://files.timbereye.com/img_Wd7Z.jpg?expires=1801234567&signature=a71e3f",
      "created_at": "2027-02-03T14:12:03Z",
      "kind": "frame",
      "group_id": "grp_7QxV3m",
      "detections": [
        {
          "box": {
            "x": 0.41,
            "y": 0.37,
            "width": 0.12,
            "height": 0.12
          },
          "item_id": "itm_5Lw2Nc",
          "confidence": 0.97
        }
      ],
      "upload_session": { "open": false, "expires_at": null }
    }
  ],
  "has_more": false,
  "next_cursor": null
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.

List an item's images#

GET/v1/items/{id}/images

Returns the item's images.

Keys: secret key; restricted key with images:read.

Parameters

FieldDescription
id requiredstring, pathItem id.
limitinteger, queryPage size, 1 to 100.
starting_afterstring, queryOpaque cursor: pass the next_cursor of the previous page. Results are ordered by (created_at, id).
expand[]array of string, queryReplace an id field with the full object, e.g. expand[]=origin_place. Allowed values are listed on each resource.

Request

TypeScript
for await (const image of timbereye.items.listImages("itm_5Lw2Nc")) {
    // every page, one at a time
}
curl
curl https://api.timbereye.com/v1/items/itm_5Lw2Nc/images \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye items images itm_5Lw2Nc --json

Response

JSON
// 200
{
  "object": "list",
  "data": [
    {
      "id": "img_K3s9",
      "object": "image",
      "livemode": true,
      "client_id": null,
      "subject": "item",
      "scan_id": "scn_9a2Lk",
      "width": 1024,
      "height": 1024,
      "sha256": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d",
      "content_type": "image/jpeg",
      "content_length": 482113,
      "location": null,
      "captured_at": "2027-02-03T14:12:31Z",
      "status": "uploaded",
      "download_url": "https://files.timbereye.com/img_K3s9.jpg?expires=1801234567&signature=4d0c9a",
      "created_at": "2027-02-03T14:12:44Z",
      "kind": "log_end",
      "item_id": "itm_5Lw2Nc",
      "group_id": "grp_7QxV3m",
      "source_image_id": "img_Wd7Z",
      "region": {
        "x": 0.41,
        "y": 0.37,
        "width": 0.12,
        "height": 0.12
      },
      "upload_session": { "open": false, "expires_at": null }
    }
  ],
  "has_more": false,
  "next_cursor": null
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.

Upload an image (multipart)#

POST/v1/scans/{id}/images

The one-request upload: a multipart body of at most 10 MB that carries the JPEG and its metadata, so a small image with its GPS fix takes one request instead of three (POST /images, the PUT, POST /images/{id}/complete). Text parts: subject, kind, client_id, captured_at, sha256 (lowercase hex; the server computes the hash of the bytes it received and refuses a difference with 409 upload_hash_mismatch before storing anything), width, height, source_image_id, and for an item image item_id or item_client_id (exactly one; item_client_id is the client_id the item was sent with in this scan, which finds the item even when the tag already existed). JSON text parts: location (a Location), region (a NormalizedBox, item images) and detections (an array of { box, item_id, confidence }, group images). For a group image the group is the scan's group. The image is uploaded when the response arrives. client_id is the image's durable identity: an image with the same client_id and the same subject, kind, scan, group or item and sha256 returns the existing image (an image that is already uploaded is returned as it is; one still pending_upload, for example from a session, takes these bytes); a difference is 409 client_id_conflict. Use POST /images for resumable uploads on flaky networks or large files.

Keys: secret key; restricted key with images:write; capture token (Allowed); publishable key (Allowed on the device's own scans, for items those scans measured. Counts against image_bytes_per_day).

Parameters

FieldDescription
id requiredstring, pathScan id.

Body

FieldDescription

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
import { readFile } from "node:fs/promises"

const image = await timbereye.scans.uploadImage("scn_9a2Lk", {
    subject: "item",
    kind: "log_end",
    itemId: "itm_5Lw2Nc",
    file: await readFile("log-end.jpg"),
})
curl
curl -X POST https://api.timbereye.com/v1/scans/scn_9a2Lk/images \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F subject=item -F kind=log_end -F item_id=itm_5Lw2Nc \
  -F file=@log-end.jpg
CLI
timbereye scans upload-image scn_9a2Lk \
  --subject item \
  --kind log_end \
  --item-id itm_5Lw2Nc \
  --file log-end.jpg \
  --json

Response

JSON
// 200
{
  "id": "img_Wd7Z",
  "object": "image",
  "livemode": true,
  "client_id": null,
  "subject": "group",
  "scan_id": "scn_9a2Lk",
  "width": 4032,
  "height": 3024,
  "sha256": "3b7e9d1f5a2c4e6081a3c5e7f9b1d3a5c7e9f1b3d5a7c9e1f3b5d7a9c1e3f5b7",
  "content_type": "image/jpeg",
  "content_length": 2841177,
  "location": null,
  "captured_at": "2027-02-03T14:11:58Z",
  "status": "uploaded",
  "download_url": "https://files.timbereye.com/img_Wd7Z.jpg?expires=1801234567&signature=a71e3f",
  "created_at": "2027-02-03T14:12:03Z",
  "kind": "frame",
  "group_id": "grp_7QxV3m",
  "detections": [
    {
      "box": {
        "x": 0.41,
        "y": 0.37,
        "width": 0.12,
        "height": 0.12
      },
      "item_id": "itm_5Lw2Nc",
      "confidence": 0.97
    }
  ],
  "upload_session": { "open": false, "expires_at": null }
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_request_error: idempotency_key_reused, idempotency_request_in_progress, group_not_empty, group_billed, place_in_use, resource_exists, place_name_taken or another state conflict.
413invalid_request_error, payload_too_large: the upload is over the size limit (10 MB for multipart).
422invalid_request_error: the request was well formed but cannot be applied. Codes: group_cycle, group_depth_exceeded, unit_ambiguous, weight_inconsistent, area_ha_not_allowed, assignment_required.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.

Start a resumable image upload#

POST/v1/images

Creates a pending_upload image and returns a resumable session URI. PUT the bytes to the URI (resume with Content-Range after a drop), then call POST /images/{id}/complete. State the subject and the matching group_id or item_id; an item image needs its item, so it comes after the item batch that creates the item. This is the path the SDKs use for large images. In the cloud environment session_uri is a Google Cloud Storage resumable session created by the server for exactly this image: it accepts one object of content_type and exactly content_length bytes (at most 25 MB unless the environment sets another limit; a larger content_length is 413 payload_too_large), and its object name is chosen by the server, never by the client. Send no Authorization header to it. The session is offered until expires_at (one hour after it is created by default); storage itself keeps a session open for up to a week, and completion does not depend on it, but a client must not rely on a session past expires_at. The session URI is a write capability: it is returned in this response only (and replayed for the same Idempotency-Key for 24 hours), never stored by the API, and a client should not persist it. client_id is the image's durable identity: posting an image whose client_id already names an image of the account, with the same subject, kind, scan, group or item, sha256 and content_length, returns that image instead of creating one, with 200: when it is still pending_upload the response carries a new session for it (a session starts at byte 0; it does not continue an earlier one), and when it is already uploaded the response carries upload: null and there is nothing to send. A difference is 409 client_id_conflict. To continue an interrupted upload, query the same session URI for its offset (PUT with an empty body and Content-Range: bytes */<content_length>: 308 with Range: bytes=0-<last> means continue after <last>, 308 without Range means from the start, 200 or 201 means the object is complete); to get a session when the old one is gone, call POST /images/{id}/session. Image storage answers 503 storage_unavailable only when the environment has no storage configured. In local development (STORAGE_MODE=local) session_uri is http://<host>/v1/_local_uploads/<session>, an endpoint of the API itself that speaks the same protocol (PUT with Content-Range, a status query with bytes */N, 308 with Range, 200 when complete, 404 once the session is gone or expired); sessions there live in the server process's memory, so a restart ends them and POST /images/{id}/session opens a new one.

Keys: secret key; restricted key with images:write; capture token (Allowed); publishable key (Allowed: an item image with scan_id of the device's own scan, for an item it measured; a group image with scan_id of the device's own scan for that scan's group, or without a scan for any group the device may capture into (photos can be added to a group at any time). Counts content_length against image_bytes_per_day).

Body

FieldDescription

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
const result = await timbereye.images.createUploadSession({
    subject: "item",
    itemId: "itm_5Lw2Nc",
    kind: "log_end",
    scanId: "scn_9a2Lk",
    sourceImageId: "img_Wd7Z",
    region: { x: 0.41, y: 0.37, width: 0.12, height: 0.12 },
    sha256: "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d",
    contentLength: 482113,
    contentType: "image/jpeg",
    width: 1024,
    height: 1024,
    capturedAt: "2027-02-03T14:12:31Z",
})
curl
curl -X POST https://api.timbereye.com/v1/images \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "item",
    "item_id": "itm_5Lw2Nc",
    "kind": "log_end",
    "scan_id": "scn_9a2Lk",
    "source_image_id": "img_Wd7Z",
    "region": { "x": 0.41, "y": 0.37, "width": 0.12, "height": 0.12 },
    "sha256": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d",
    "content_length": 482113,
    "content_type": "image/jpeg",
    "width": 1024,
    "height": 1024,
    "captured_at": "2027-02-03T14:12:31Z"
  }'
CLI
timbereye images create \
  --subject item \
  --item-id itm_5Lw2Nc \
  --kind log_end \
  --scan scn_9a2Lk \
  --sha256 9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d \
  --content-length 482113 \
  --content-type image/jpeg \
  --width 1024 \
  --height 1024 \
  --captured-at 2027-02-03T14:12:31Z \
  --data '{"source_image_id":"img_Wd7Z","region":{"x":0.41,"y":0.37,"width":0.12,"height":0.12}}' \
  --json

Response

JSON
// 200
{
  "object": "upload_session",
  "image": {
    "id": "img_K3s9",
    "object": "image",
    "livemode": true,
    "client_id": null,
    "subject": "item",
    "scan_id": "scn_9a2Lk",
    "width": 1024,
    "height": 1024,
    "sha256": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d",
    "content_type": "image/jpeg",
    "content_length": 482113,
    "location": null,
    "captured_at": "2027-02-03T14:12:31Z",
    "status": "pending_upload",
    "download_url": null,
    "created_at": "2027-02-03T14:12:44Z",
    "kind": "log_end",
    "item_id": "itm_5Lw2Nc",
    "group_id": "grp_7QxV3m",
    "source_image_id": "img_Wd7Z",
    "region": {
      "x": 0.41,
      "y": 0.37,
      "width": 0.12,
      "height": 0.12
    },
    "upload_session": {
      "open": true,
      "expires_at": "2027-02-03T15:12:44Z"
    }
  },
  "upload": {
    "session_uri": "https://storage.googleapis.com/upload/storage/v1/b/timbereye-images/o?uploadType=resumable&upload_id=ADPycdtX3k",
    "expires_at": "2027-02-03T15:12:44Z"
  }
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_request_error: idempotency_key_reused, idempotency_request_in_progress, group_not_empty, group_billed, place_in_use, resource_exists, place_name_taken or another state conflict.
413invalid_request_error, payload_too_large: the upload is over the size limit (10 MB for multipart).
422invalid_request_error: the request was well formed but cannot be applied. Codes: group_cycle, group_depth_exceeded, unit_ambiguous, weight_inconsistent, area_ha_not_allowed, assignment_required.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.

Retrieve an image#

GET/v1/images/{id}

Returns the image with a fresh 15-minute download_url (once uploaded). Group images include detections. upload_session says whether an upload session is open for a pending_upload image (open) and when the newest one stops being offered (expires_at); the session URI itself is never returned here (only POST /images and POST /images/{id}/session return one), so a client that has lost it asks for a new session. For an uploaded image upload_session is { open: false, expires_at: null }.

Keys: secret key; restricted key with images:read; capture token (Allowed); publishable key (Allowed for the device's own images).

Parameters

FieldDescription
id requiredstring, pathImage id.

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
const result = await timbereye.images.retrieve("img_K3s9")
curl
curl https://api.timbereye.com/v1/images/img_K3s9 \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye images get img_K3s9 --json

Response

JSON
// 200
{
  "id": "img_K3s9",
  "object": "image",
  "livemode": true,
  "client_id": null,
  "subject": "item",
  "scan_id": "scn_9a2Lk",
  "width": 1024,
  "height": 1024,
  "sha256": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d",
  "content_type": "image/jpeg",
  "content_length": 482113,
  "location": null,
  "captured_at": "2027-02-03T14:12:31Z",
  "status": "uploaded",
  "download_url": "https://files.timbereye.com/img_K3s9.jpg?expires=1801234567&signature=4d0c9a",
  "created_at": "2027-02-03T14:12:44Z",
  "kind": "log_end",
  "item_id": "itm_5Lw2Nc",
  "group_id": "grp_7QxV3m",
  "source_image_id": "img_Wd7Z",
  "region": { "x": 0.41, "y": 0.37, "width": 0.12, "height": 0.12 },
  "upload_session": { "open": false, "expires_at": null }
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.

Remove a group photo#

DELETE/v1/images/{id}

Removes a group photo from the group's photos. Removal is soft and audited: the image keeps its record and its stored bytes (until retention removes them), gains removed_at and removed_by, and is left out of GET /groups/{id}/images. Only group images can be removed; a log's photo is the evidence of its measurement and stays (409 state_conflict). Your server and the console may remove any photo; a phone may remove only a photo it added itself (from the same app installation, or the same capture token). Removing a removed photo returns it. Emits group.updated.

Keys: secret key; restricted key with images:write; capture token (Allowed for a photo the token added, in the token's groups); publishable key (Allowed for a photo this installation added, in a group the device may capture into).

Parameters

FieldDescription
id requiredstring, pathImage id.

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
const result = await timbereye.images.remove("img_K3s9")
curl
curl -X DELETE https://api.timbereye.com/v1/images/img_K3s9 \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye groups images remove img_K3s9 --yes --json

Response

200: a GroupImage object.

Errors
StatusWhen
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_request_error: idempotency_key_reused, idempotency_request_in_progress, group_not_empty, group_billed, place_in_use, resource_exists, place_name_taken or another state conflict.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.

Complete an upload#

POST/v1/images/{id}/complete

Verifies the uploaded object (it exists, has the declared content_length, is a JPEG, and its SHA-256 equals the declared sha256; the server reads the object once, at most 25 MB, and never again for this image), sets the status to uploaded and enqueues refinement for item images. Completing an image that is already uploaded returns it with 200. A refusal can be repaired. 409 upload_incomplete means the bytes are missing or short; 409 upload_hash_mismatch means the SHA-256, the size or the type differs. In both cases the wrong object has been deleted, the image stays pending_upload, and the client recovers by calling POST /images/{id}/session, uploading the bytes again and calling this operation again. Because every response below 500, including these 409s, is stored and replayed for 24 hours under its Idempotency-Key, the second call to complete MUST use a new Idempotency-Key; repeating the key replays the old refusal without looking at the bytes.

Keys: secret key; restricted key with images:write; capture token (Allowed); publishable key (Allowed for the device's own images).

Parameters

FieldDescription
id requiredstring, pathImage id.

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
const result = await timbereye.images.complete("img_K3s9")
curl
curl -X POST https://api.timbereye.com/v1/images/img_K3s9/complete \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
CLI
timbereye images complete img_K3s9 --json

Response

JSON
// 200
{
  "id": "img_K3s9",
  "object": "image",
  "livemode": true,
  "client_id": null,
  "subject": "item",
  "scan_id": "scn_9a2Lk",
  "width": 1024,
  "height": 1024,
  "sha256": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d",
  "content_type": "image/jpeg",
  "content_length": 482113,
  "location": null,
  "captured_at": "2027-02-03T14:12:31Z",
  "status": "uploaded",
  "download_url": "https://files.timbereye.com/img_K3s9.jpg?expires=1801234567&signature=4d0c9a",
  "created_at": "2027-02-03T14:12:44Z",
  "kind": "log_end",
  "item_id": "itm_5Lw2Nc",
  "group_id": "grp_7QxV3m",
  "source_image_id": "img_Wd7Z",
  "region": { "x": 0.41, "y": 0.37, "width": 0.12, "height": 0.12 },
  "upload_session": { "open": false, "expires_at": null }
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_request_error: idempotency_key_reused, idempotency_request_in_progress, group_not_empty, group_billed, place_in_use, resource_exists, place_name_taken or another state conflict.
422invalid_request_error: the request was well formed but cannot be applied. Codes: group_cycle, group_depth_exceeded, unit_ambiguous, weight_inconsistent, area_ha_not_allowed, assignment_required.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.

Open a new upload session#

POST/v1/images/{id}/session

Returns a new upload session for an image that is still pending_upload, to upload its bytes again or for the first time after the session was lost: the session URI is never stored, so a client that restarted, whose session expired, or whose upload was refused by POST /images/{id}/complete (409 upload_incomplete or upload_hash_mismatch, which delete the wrong object) asks for another. It works with every store: in the cloud environment it starts a new resumable session to the same create-only object name; in local development it opens a new endpoint of the API. The new session starts at byte 0 and does not continue an earlier one (only the same session URI can be resumed, by its status query). Each call opens another session; the same Idempotency-Key replays the session of the first call for 24 hours, so a client that wants a fresh one uses a new key. If the object is already in storage in full but was never completed, call POST /images/{id}/complete instead (a hosted object cannot be created twice). The response is the same upload_session as POST /images; GET /images/{id} reports whether a session is open and until when (upload_session). An image that is already uploaded has nothing to send and is 409 state_conflict. A capture token limited to group_ids reaches only the images of those groups.

Keys: secret key; restricted key with images:write; capture token (Allowed); publishable key (Allowed for the device's own images).

Parameters

FieldDescription
id requiredstring, pathImage id.

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
const result = await timbereye.images.createSession("img_K3s9")
curl
curl -X POST https://api.timbereye.com/v1/images/img_K3s9/session \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
CLI
timbereye images session img_K3s9 --json

Response

JSON
// 200
{
  "object": "upload_session",
  "image": {
    "id": "img_K3s9",
    "object": "image",
    "livemode": true,
    "client_id": null,
    "subject": "item",
    "scan_id": "scn_9a2Lk",
    "width": 1024,
    "height": 1024,
    "sha256": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b2d4f6a8c0e2b4d6f8a0c2e4b6d",
    "content_type": "image/jpeg",
    "content_length": 482113,
    "location": null,
    "captured_at": "2027-02-03T14:12:31Z",
    "status": "pending_upload",
    "download_url": null,
    "created_at": "2027-02-03T14:12:44Z",
    "kind": "log_end",
    "item_id": "itm_5Lw2Nc",
    "group_id": "grp_7QxV3m",
    "source_image_id": "img_Wd7Z",
    "region": {
      "x": 0.41,
      "y": 0.37,
      "width": 0.12,
      "height": 0.12
    },
    "upload_session": {
      "open": true,
      "expires_at": "2027-02-03T16:02:10Z"
    }
  },
  "upload": {
    "session_uri": "https://storage.googleapis.com/upload/storage/v1/b/timbereye-images/o?uploadType=resumable&upload_id=ADPycdv9Qm",
    "expires_at": "2027-02-03T16:02:10Z"
  }
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_request_error: idempotency_key_reused, idempotency_request_in_progress, group_not_empty, group_billed, place_in_use, resource_exists, place_name_taken or another state conflict.
422invalid_request_error: the request was well formed but cannot be applied. Codes: group_cycle, group_depth_exceeded, unit_ambiguous, weight_inconsistent, area_ha_not_allowed, assignment_required.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.