Skip to the page
Docs menu

Docs Sawlogs

Read logs, volume and photos

Read a group's logs, their measurements and stages, the volume under a rule, the photos behind each measurement, and the history of corrections.

Used in step 3: Sync, and any time after. Everything here is a read your backend can make at any moment.

Once a worker has scanned into a group, the group holds its logs. This page shows how to read them back: each log's measurement, how final that measurement is, the group's volume under your rule, the photos as evidence, and what was corrected. The group itself (reference, spec, weight) is in Create groups.

The API calls a log an item (itm_...). The examples use the group grp_7QxV3m for your record ctr_4821.

The logs in a group#

TypeScript
const timbereye = new Timbereye() // reads TIMBEREYE_SECRET_KEY
const page = await timbereye.groups.items.list("grp_7QxV3m", { limit: 100 })
curl
curl "https://api.timbereye.com/v1/groups/grp_7QxV3m/items?limit=100" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye groups items list grp_7QxV3m --limit 100 --json
JSON
{
    "object": "list",
    "data": [
        {
            "id": "itm_5Lw2Nc",
            "object": "item",
            "type": "log",
            "group_id": "grp_7QxV3m",
            "tag": { "payload": "DEMO-0001", "symbology": "qr", "side_mm": 62 },
            "species": "PINE_TAEDA",
            "length": { "value_m": 5.8, "source": "group_default" },
            "grade": "A",
            "measurement": {
                "stage": "server_refined",
                "method": "qr_scale",
                "diameter_short_m": 0.477,
                "diameter_long_m": 0.492
            },
            "refinement": { "status": "succeeded" },
            "status": "active"
        }
    ],
    "has_more": false,
    "next_cursor": null
}

Abbreviated, with example numbers. The SDK returns the same fields in camelCase. Iterating a list pages for you:

TypeScript
const tally = []
for await (const log of timbereye.groups.items.list("grp_7QxV3m")) {
    tally.push({
        tag: log.tag?.payload,
        shortM: log.measurement?.effectiveShortM,
        longM: log.measurement?.effectiveLongM,
    })
}
await db.containers.update("ctr_4821", { tally })

Read effective_short_m and effective_long_m for the diameters that count; the history is in GET /items/{id}/measurements.

What a log carries, briefly (every field is in the items reference):

FieldMeaning
tagThe QR tag on the log end, or null for an untagged log
speciesA code from your species catalogue
length{ value_m, source }. source is operator, group_default, bulk or measured
gradeA free string
measurementThe effective measurement: the one that counts now (below)
refinement{ status }: queued, running, succeeded or failed, or null
statusactive, or removed (no longer counted in volume or totals)
group_idThe group the log is in now, or null when it has been taken out of every group
detection_confidenceThe log detector's score, 0 to 1, for the box the phone measured the log in, or null (below)
photo_ref{ image_id, region }: the photo the measurement was made on and where the log is in it, or null

A log scanned twice#

Scan a tagged log twice and you still have one log: it is the same log every time its tag is read, and scanning it again adds a measurement to it. An untagged log cannot be recognised again, so scanning it again creates a new log.

To find one log anywhere: GET /items?tag=..., or timbereye items find --tag DEMO-0001 --json.

Measurements and their stages#

A log's diameters can come from four places. Each is a stage, and the most trustworthy one available wins.

StageIn plain termsWins over
manual_overrideA person entered it, with a required reasonEverything
server_refinedRefined: the server traced the log end's outline in its photo. The number to settle onEstimated and assigned
device_estimateEstimated: the phone measured it on the spot. Usable at once; may change when refinedAssigned
assignedAssigned: no one measured it. A nominal diameter class from the group's spec, so a count has a volumeNothing

A measurement is never edited; a change adds a new one. The log's measurement is the newest of the highest stage. When the server has refined a log, its refinement.status is succeeded. If refinement fails after its attempts, the status is failed, the estimate stays, and item.refinement_failed is sent.

Refinement follows the image upload; the queue is picked up every minute. It depends on image storage and is not verified end to end for real phones; the simulator shows it in test mode.

A measurement records raw diameters, any adjustments, the effective diameters after them, a 50-point outline, how it was scaled, a quality score and its provenance (models, app, device). See Accuracy and limits.

Volume under a rule#

TypeScript
const volume = await timbereye.groups.volume("grp_7QxV3m", { rule: "jas" })
curl
curl "https://api.timbereye.com/v1/groups/grp_7QxV3m/volume?rule=jas" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye groups volume grp_7QxV3m --rule jas --json
JSON
{
    "object": "volume",
    "rule": "jas",
    "rule_version": "1",
    "m3": 21.384,
    "native": null,
    "items": 142,
    "refined": 139,
    "estimated_only": 3
}
FieldMeaning
m3Volume in cubic metres. Includes the nominal volume of assigned logs
itemsMeasured logs: any stage but assigned
refinedOf those, how many are refined
estimated_onlyitems less refined: logs that rest on the phone's estimate (or an override) so far
nativeThe rule's own unit when it is not m³ (board feet), else null

Here 3 of 142 logs are not refined, so the figure moves when they are. With estimated_only: 0 every measured log is refined. Each log carries its own volume: every item has volume ({ rule, rule_version, m3 }, null while the log has no measurement), so one GET /groups/{id}/items page gives every log's volume with no call per log; GET /items/{id}/volume?rule=jas still reads one. The group's own summary (GET /groups/{id}) has the counts and the volume under the account's default rule, plus assigned_count.

You rarely need to poll this. When a group's scans have settled (none of its logs is still being refined), group.measured carries the same counts and volume, plus failed, so your record is updated without a read; it comes again with a higher revision when they change.

The server computes jas; GET /volume_rules lists what it supports. To compute a volume yourself, with no account, use the open library @timbereye/volume-rules (not on npm; build it from sdk/volume-rules):

TypeScript
import { jas } from "@timbereye/volume-rules"

jas({ short_diameter_cm: 47.7, long_diameter_cm: 49.2, length_m: 5.8 }) // 1.227

It also has board-foot rules: Doyle, International 1/4-inch and Scribner Decimal C are verified against published tables; the Scribner formula approximation is not. Read each rule's status before relying on it. See TypeScript SDK.

Photos as evidence#

Two kinds of image, kept apart because they answer different questions:

Group imageItem image
ShowsThe whole scene: a pile, a truck face, a container door, a sealOne log end, cropped tight
kindframe, load_face, container_door, pile, seal, overview, weigh_ticket, label, damage, otherlog_end, tag, defect, other
Read itGET /groups/{id}/imagesGET /items/{id}/images
Links todetections[]: a box per log, with the item_id it becamesource_image_id and region

The links run both ways, so you can open a container photo and step to each measured log, or from a log back to the frame it was cut from. Each image has a download_url, a signed URL valid for 15 minutes; fetch the image again (GET /images/{id}) for a fresh one.

TypeScript
const photos = await timbereye.items.listImages("itm_5Lw2Nc")
curl
curl https://api.timbereye.com/v1/items/itm_5Lw2Nc/images \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye items images itm_5Lw2Nc --json
JSON
{
    "object": "list",
    "data": [
        {
            "id": "img_K3s9",
            "object": "image",
            "subject": "item",
            "kind": "log_end",
            "item_id": "itm_5Lw2Nc",
            "source_image_id": "img_Wd7Z",
            "status": "uploaded",
            "download_url": "https://files.timbereye.com/img_K3s9.jpg?expires=1801234567&signature=4d0c9a"
        }
    ],
    "has_more": false,
    "next_cursor": null
}

Store the image id, not the URL, if you need the photo later. Images need image storage configured for the environment; where it is not, the image routes answer 503 service_unavailable. Uploading a log's photo is the scanner's job, covered in the images reference; photos of the group itself (a seal, a weighbridge ticket) can be added by anyone at any time: Photos and weights.

A durable reference to each log's photo#

Every log carries photo_ref, with no expand and no signed URL: the image id and the log end's box in that photo (normalised, origin top left; the bounding box of the outline once refined, else of the diameter lines the phone measured along). It is the same in GET /groups/{id}/items, GET /scans/{id}/items and each log of group.measured, and the SDKs give it to the app as photoReference.

JSON
{
    "id": "itm_5Lw2Nc",
    "object": "item",
    "detection_confidence": 0.87,
    "photo_ref": { "image_id": "img_K3s9", "region": { "x": 0.21, "y": 0.18, "width": 0.58, "height": 0.62 } }
}

Keep the image id; fetch GET /images/img_K3s9 when you show the photo, for a download_url valid 15 minutes. The image belongs to the organisation that owns the log: any other organisation's key gets 404, as for the log. It stays readable for as long as your images are kept (3 years in live mode, 30 days in test mode).

Detector confidence#

detection_confidence is the on-device log detector's own score for the box the phone measured the log in. It says how sure the detector was that the box is a log end. It is not an accuracy of the diameters, not the probability that the measurement is right, and not comparable across detector versions (measurement.provenance.detector). It comes from the log's device estimate and stays when the log is refined or overridden; it is null for logs from clients that did not send it. Use it to sort logs for a second look.

A log's photo with its outline#

Ask for a log with expand[]=photo to get the photo its measurement was made on. The measurement carries the geometry, normalised to that photo (0 to 1, origin top left): perimeter, the log end's outline (the segmentation's 50-point outline once refined); diameter_lines, the two lines the short and the long diameter were measured along; tag_corners, the QR tag. Draw them over the photo, as the console and the Timbereye app do.

TypeScript
const log = await timbereye.items.retrieve("itm_5Lw2Nc", { expand: ["photo"] })
curl
curl "https://api.timbereye.com/v1/items/itm_5Lw2Nc?expand[]=photo" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye items get itm_5Lw2Nc --expand photo --json
JSON
{
    "id": "itm_5Lw2Nc",
    "object": "item",
    "measurement": {
        "stage": "server_refined",
        "effective_short_m": 0.477,
        "effective_long_m": 0.492,
        "perimeter": [[0.21, 0.5], [0.24, 0.38], [0.31, 0.27], "…"],
        "diameter_lines": [
            [
                [0.23, 0.52],
                [0.79, 0.49]
            ],
            [
                [0.5, 0.21],
                [0.52, 0.8]
            ]
        ],
        "tag_corners": [
            [0.44, 0.45],
            [0.56, 0.45],
            [0.56, 0.57],
            [0.44, 0.57]
        ],
        "image_id": "img_K3s9"
    },
    "photo": {
        "image_id": "img_K3s9",
        "width": 1024,
        "height": 1024,
        "download_url": "https://files.timbereye.com/img_K3s9.jpg?expires=…",
        "source_image_id": "img_Wd7Z",
        "box": { "x": 0.41, "y": 0.37, "width": 0.12, "height": 0.12 }
    }
}
  • A point [x, y] is at x × width, y × height pixels of the photo. box is where the log end sits in the scene photo it was cut from (source_image_id).
  • The geometry is stored with each measurement and read back as stored: a device estimate has what the phone sent, a refinement has the segmentation's outline and diameter lines. A simulated log has none, and photo is null for a log whose photo never arrived.

The outline's state#

Every log has an outline: the segmentation model's trace of the log end, and where it stands. Draw points when status is ready; otherwise draw the phone's diameter_lines and say why, from reason. The same object is on GET /items/{id}, on each log of GET /scans/{id}/items (what a phone reads back) and in item.updated webhooks.

JSON
"outline": {
    "status": "ready",
    "reason": null,
    "source": "segmentation",
    "points": [[0.21, 0.5], [0.24, 0.38], [0.31, 0.27], "…"],
    "measurement_id": "msr_8Rt4Vb",
    "segmenter": { "id": "vertex-sawlog-segmentation", "version": "unknown" }
}
statusMeaningreason
pendingOn its way, usually within two minutes of the photo's upload. The phone's values showawaiting_photo, segmentation_queued, segmentation_running
readypoints holds the 50-point outline; the diameters were measured across itnull
failedNo outline, for good. The phone's values standno_outline_found, photo_unavailable, photo_link_unsigned, photo_link_refused, segmentation_unavailable, segmentation_not_configured, segmentation_error, test_limit_reached, test_segmentation_off (an unknown reason reads as segmentation_error)
not_availableNot measured from a photo (assigned or entered values), or the simulator's practice valuesnot_measured_from_photo, test_mode_practice

measurement.provenance.diameter_source says what the diameters themselves came from: segmentation_outline (the server's model), device (the phone: while the outline is pending, or when it failed), simulator, assigned or manual. A log with final: true and diameter_source: device shows the phone's values, not the server's. group.measured carries outlines, the group's logs counted by outline status.

  • expand[]=photo also works on GET /groups/{id}/items and GET /items; each log then costs a signed URL, so ask for it only when you show the photos.

A group with bundles and units#

A group can hold lumber bundles and panel units beside its logs, as groups inside it. Its logs read as above, and their volume is the logs' only. The bundles' and units' figures are in summary.products, each product apart (never one total), and their rows in GET /groups/{id}/packing_list; each bundle's tally is GET /groups/{id}/tally on the bundle. Their photos come with the group's own when you ask for them, each naming its group in group_id:

TypeScript
const photos = await timbereye.groups.listImages("grp_7QxV3m", { includeChildren: true, limit: 100 })
curl
curl "https://api.timbereye.com/v1/groups/grp_7QxV3m/images?include_children=true&limit=100" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye groups images list grp_7QxV3m --include-children --limit 100 --json
JSON
{
    "object": "list",
    "data": [
        { "id": "img_8Pq2", "kind": "overview", "group_id": "grp_7QxV3m" },
        { "id": "img_WLMX", "kind": "bundle_end", "group_id": "grp_7MWvQH" },
        {
            "id": "img_4Hq8",
            "kind": "unit_edge",
            "group_id": "grp_SZXaAB",
            "caption": "One photo for 3 identical units, U-02 to U-04"
        }
    ],
    "has_more": false
}

See Lumber and panels for where each product's figures live.

Corrections and history#

Nothing is overwritten silently. You can always see what changed and who changed it.

QuestionRead
Every measurement of a log, newest firstGET /items/{id}/measurements, each with its stage, provenance and, for overrides, the reason
Which groups a log has been inGET /items/{id}/groups: { group, joined_at, left_at }, oldest first
What changed recentlyGET /events (30 days): item.updated, item.removed and the rest. See Stay in sync
Which sitting a log was scanned inThe measurement's scan_id; GET /scans/{id} has who, when, which phone and which mode

To correct a log yourself:

  • A diameter: POST /items/{id}/measurements adds a manual_override with a required reason. Your key is recorded as the actor. See Accuracy and limits.
  • Species, length or grade: PATCH /items/{id} (the value gets source: operator), or POST /groups/{id}/items/bulk_update for many at once.
  • A log that should not count: DELETE /items/{id} marks it removed; it keeps its history.

Each of these sends item.updated or item.removed, and the group's next group.measured revision (reason correction or log_removed). A log removed within 72 hours of its billing is not billed (Billing).

A log can also move between groups of the account: POST /groups/{id}/items/add from your system, or a tag scanned into another group. A phone signed in to the Timbereye app is first refused (409 item_move_not_allowed, with the log's group in error.details) and moves the log only when the worker confirms (allow_move: true on the item or the observation); a publishable key never moves one. The log keeps its measurements and its history (the group it left), sends item.updated, and the group it left gets its next group.measured revision (log_removed); the group it joined counts it when its scan settles. A move by a phone is in the audit log as item.moved (from and to group, the worker's email, the installation). A log is billed once, wherever it moves (Billing).

The scan record#

A scan is the record of one sitting of scanning into a group: who, when, which phone and app, which mode, and where. It is created automatically when a worker starts scanning; you never need to create one in the main flow. It is there for audit, and for redoing a sitting: a new sitting can replace an earlier one (replaces_scan_id), which removes the earlier sitting's logs. Read them with GET /scans?group_id=.... Its status runs open, processing, estimated, refined or failed. Field detail is in the scans reference.

The other objects, briefly#

ObjectPrefixWhat it is
Groupgrp_What is being measured: a container, truck load, stack. See Create groups
Itemitm_One log
Measurementmsr_One set of diameters for a log, at one stage
Scanscn_The record of one sitting of scanning
Imageimg_A group photo, or a crop of one log end
Placeplc_Where wood came from: a tract, yard, mill or port. See Origin
Speciesspc_An entry in your species catalogue: the global list plus codes you add with POST /species
Group tallynoneA group's settled figures at one revision, sent as group.measured; not stored as its own object
Eventevt_A snapshot of an object when it changed. See Stay in sync

Every stored object has a prefixed id, an object field and livemode. A volume rule is not stored: Timbereye applies it when you read a volume. Timbereye does not model orders, bookings or shipments; those stay in your system, linked by the group's external_ref and metadata.