Photos and weights
Add photos to a group at any time (a container's seal, a weighbridge ticket, damage), list and remove them, and record the group's weighbridge weight, which Timbereye spreads over the logs by volume.
Platform. Evidence that travels with a group: its photos and its weighbridge ticket.
A group can carry photos and one weight at any time, before, during or after scanning. Workers add them on the phone (the Timbereye app's Add photo and Add weight, or your app through the SDK); your server and the console can add them too. Neither is a measurement: Timbereye measures the wood, and a weight is what the weighbridge ticket says.
Photos#
A photo of a group has a kind, an optional caption, who took it (captured_by) and when. Kinds: overview, seal, label, weigh_ticket, damage, other (and the scan frames frame, load_face, container_door, pile, and the lumber kinds). Photos taken while scanning a log are that log's photos, not the group's: see Read logs, volume and photos.
Add a photo#
Three calls: ask for an upload session, send the JPEG to it, complete. client_id makes a retry return the same photo.
import { createHash, randomUUID } from "node:crypto"
import { readFile } from "node:fs/promises"
const jpeg = await readFile("seal.jpg")
const { image, upload } = await timbereye.images.createUploadSession({
subject: "group",
groupId: "grp_7QxV3m",
kind: "seal",
caption: "Seal 88213, intact",
clientId: randomUUID(),
contentType: "image/jpeg",
contentLength: jpeg.length,
sha256: createHash("sha256").update(jpeg).digest("hex"),
})
await fetch(upload!.sessionUri, {
method: "PUT",
headers: { "Content-Type": "image/jpeg", "Content-Range": `bytes 0-${jpeg.length - 1}/${jpeg.length}` },
body: jpeg,
})
const photo = await timbereye.images.complete(image.id)curl https://api.timbereye.com/v1/images \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "subject": "group", "group_id": "grp_7QxV3m", "kind": "seal", "caption": "Seal 88213, intact",
"content_type": "image/jpeg", "content_length": 482113, "sha256": "9f2c…" }'
# then PUT the bytes to upload.session_uri, and:
curl -X POST https://api.timbereye.com/v1/images/img_Sx81/complete \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
-H "Idempotency-Key: $(uuidgen)"timbereye groups images add grp_7QxV3m --file seal.jpg --kind seal --caption "Seal 88213, intact" --json{
"id": "img_Sx81",
"object": "image",
"subject": "group",
"group_id": "grp_7QxV3m",
"kind": "seal",
"caption": "Seal 88213, intact",
"width": 4032,
"height": 3024,
"status": "uploaded",
"download_url": "https://files.timbereye.com/img_Sx81.jpg?expires=…",
"captured_by": { "type": "api_key", "id": "key_2Fp8", "installation_id": null },
"removed_at": null
}A phone uploads the same way with its publishable key, into any group it may scan into, and keeps the photo on the phone until it is uploaded (Working offline).
List and remove#
const tickets = await timbereye.groups.listImages("grp_7QxV3m", { kind: "weigh_ticket" })
const removed = await timbereye.images.remove("img_Sx81")curl "https://api.timbereye.com/v1/groups/grp_7QxV3m/images?kind=weigh_ticket" \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
curl -X DELETE https://api.timbereye.com/v1/images/img_Sx81 \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"timbereye groups images list grp_7QxV3m --kind weigh_ticket --json
timbereye groups images remove img_Sx81 --yes --json{
"id": "img_Sx81",
"object": "image",
"kind": "seal",
"removed_at": "2027-02-03T15:40:02Z",
"removed_by": { "type": "api_key", "id": "key_2Fp8", "installation_id": null }
}- The list is oldest first, by when each photo was added.
kind=weigh_ticketlists only tickets. download_urlis valid for 15 minutes; list again for a fresh one. There is no thumbnail:widthandheightare the original's, so scale it down in your page.- Removing a photo is soft: it leaves the list, and keeps its record with
removed_atandremoved_by(include_removed=truelists those too). A phone may remove only a photo it added itself; a log's photo cannot be removed, because it is the evidence of the log's measurement. Removing sendsgroup.updated.
Weights#
A group has at most one weight: the weighbridge ticket of its load. Timbereye does not talk to weighbridges and does not measure weight; the worker or your server types the ticket in.
const weighed = await timbereye.groups.setWeight("grp_7QxV3m", {
gross: 52480,
tare: 14120,
unit: "lb",
ticketRef: "WT-88213",
ticketImageId: "img_Tk42", // a weigh_ticket photo of this group
})curl -X PUT https://api.timbereye.com/v1/groups/grp_7QxV3m/weight \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "gross": 52480, "tare": 14120, "unit": "lb", "ticket_ref": "WT-88213", "ticket_image_id": "img_Tk42" }'timbereye groups set-weight grp_7QxV3m --gross 52480lb --tare 14120lb --ticket-ref WT-88213 --ticket-image img_Tk42 --json{
"id": "grp_7QxV3m",
"object": "group",
"weight": {
"gross_kg": 23804.5,
"tare_kg": 6404.7,
"net_kg": 17399.8,
"entered": { "gross": 52480, "tare": 14120, "net": null, "unit": "lb" },
"ticket_ref": "WT-88213",
"weighed_at": null,
"ticket_image_id": "img_Tk42",
"entered_by": { "type": "key", "id": "key_2Fp8", "installation_id": null },
"entered_at": "2027-02-03T15:22:08Z"
},
"summary": { "net_kg": 17399.8, "density_kg_m3": 1566, "weight_allocation": "full" }
}- Give
net, orgrossandtare(net is derived, andentered.netstays null), in oneunit:kg,lb,t(metric tonne) orshort_ton. A baretonis422 unit_ambiguous. With all three, net must equal gross less tare exactly, else422 weight_inconsistentwithparam: net; a tare above gross isparam: tare. - Setting the weight again replaces it;
DELETE /groups/{id}/weight(groups.clearWeight,timbereye groups clear-weight) removes it. Both sendgroup.updated. entered_byandentered_atsay who typed it and when;weighed_atis the ticket's own time, if you give it.- A phone may set the weight of a group it scans into; it sees the group's
weighton itscapture_group.
The weight of each log#
Timbereye spreads the net weight over the group's logs in proportion to their volume (JAS): each log's weight is { value_kg, source: "allocated" }, and the shares add up to the net exactly (the rounding remainder goes to the first log). A log with its own measured weight keeps it, and is subtracted first; a log with no volume gets none, and summary.weight_allocation is then partial (full when every log has a weight). The split reruns whenever the weight, the logs or their volumes change. summary.density_kg_m3 is net weight over volume: a load far from the species' usual density (default_density_kg_m3 on GET /species) has a wrong count, length or ticket.