Skip to the page
Docs menu

Docs Use cases

Mill log intake

Measure each truckload of logs at the mill gate, attach the scale ticket, check tagged loads against what was sent, so your system can pay the supplier on the measured volume.

Used in steps 1–3: Create, Scan, Sync. For mills, sawmills and log yards that buy logs by the truckload. By the end, each delivery in your system carries the measured volume and the weighbridge net weight, and is marked ready to pay when its tally is final.

The group is one truckload, and the evidence for what the supplier is paid: every log, its diameters and its photos. Put your delivery id in external_ref and the supplier in metadata.

1. Create#

When the truck checks in at the gate, your backend creates the group for the delivery and keeps its id on the delivery record.

TypeScript
const timbereye = new Timbereye() // reads TIMBEREYE_SECRET_KEY
const load = await timbereye.groups.create({
    kind: "truck_load",
    externalRef: "del_30551", // your delivery's id
    name: "Truck KX-4417",
    defaults: { species: "PINE_TAEDA", length: { valueM: 5.8 } },
    metadata: { supplier: "sup_118" },
})
curl
curl https://api.timbereye.com/v1/groups \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "truck_load", "external_ref": "del_30551", "name": "Truck KX-4417",
        "defaults": { "species": "PINE_TAEDA", "length": { "value_m": 5.8 } },
        "metadata": { "supplier": "sup_118" } }'
CLI
timbereye groups create --kind truck_load --external-ref del_30551 --name "Truck KX-4417" \
  --species PINE_TAEDA --length 5.8m --metadata supplier=sup_118 --json
JSON
{
    "id": "grp_5Tq1Rb",
    "object": "group",
    "kind": "truck_load",
    "name": "Truck KX-4417",
    "external_ref": "del_30551",
    "defaults": { "species": "PINE_TAEDA", "length_m": 5.8, "grade": null, "diameter_class_m": null },
    "metadata": { "supplier": "sup_118" }
}

Store grp_5Tq1Rb on delivery del_30551. Then attach the weighbridge ticket:

TypeScript
await timbereye.groups.setWeight("grp_5Tq1Rb", { gross: 41.2, tare: 14.9, unit: "t", ticketRef: "WB-77812" })
curl
curl -X PUT https://api.timbereye.com/v1/groups/grp_5Tq1Rb/weight \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "gross": 41.2, "tare": 14.9, "unit": "t", "ticket_ref": "WB-77812" }'
CLI
timbereye groups set-weight grp_5Tq1Rb --gross 41.2t --tare 14.9t --ticket-ref WB-77812 --json
JSON
{
    "id": "grp_5Tq1Rb",
    "object": "group",
    "weight": { "gross_kg": 41200, "tare_kg": 14900, "net_kg": 26300, "ticket_ref": "WB-77812" }
}

Density (net weight over volume) fills in as logs are measured: a load far outside the species' range has a wrong count, length or ticket. See Photos and weights.

No delivery record before the truck reaches the grader? The grader's app can open the group by the delivery id instead (POST /groups/open, see Scan in your app).

2. Scan#

The grader scans the load with the Timbereye app or your own app. If the supplier tags its logs and sends the tag list, count the truck against it: see Count QR tags.

The grader can add the weighbridge ticket and a photo of it in the app (Photos and weights).

3. Sync#

When the grader's sitting is refined, Timbereye sends group.measured with the load's tally. That is the signal to pay. A later revision (a correction, a log removed, another sitting) is an adjustment: compare it with the revision you paid on. In your webhook handler (behind express.raw, see Stay in sync):

TypeScript
const event = await timbereye.webhooks.verify(req)
if (event.type === "group.measured") {
    const tally = event.data.object
    await db.deliveries.update(tally.externalRef, {
        pieces: tally.pieces,
        m3: tally.volume?.m3,
        revision: tally.revision, // apply only if higher than the stored one
        readyToPay: tally.volume?.failed === 0,
    })
}

Your delivery afterwards:

JSON
{
    "id": "del_30551",
    "timbereyeGroupId": "grp_5Tq1Rb",
    "pieces": 64,
    "m3": 23.91,
    "revision": 1,
    "readyToPay": true
}

Example figures. A log whose refinement failed keeps its device estimate, counted in tally.volume.failed: decide whether to pay on it. Net weight and density are on the group (timbereye.groups.retrieve("grp_5Tq1Rb"), summary.netKg). See Stay in sync.

What you get back#

  • Pieces, volume (JAS), net weight and density per load, and each log's share of the weight.
  • Every log with its diameters, length and photos, to settle a dispute with the supplier. The API calls a log an item. See Read logs, volume and photos.
  • Where the wood came from, if the load has an origin place: Origin.

Not supported#

  • No supplier payments: Timbereye has no prices, supplier accounts, payments or statements. Timbereye gives the volume; your system pays.
  • No declared volume: keep the supplier's figure in your system (or metadata) and compare it yourself.
  • No weighbridge connection: you or the grader enter the ticket.
  • Volume under JAS only. No grading rules or defect deductions.