Skip to the page
Docs menu

How an integration works

Timbereye is an API for forest products. Point a phone at them; get counts, measurements and tallies as data in your system. It measures sawlogs and tallies lumber and panels.

Your backend creates a group for whatever is being measured. A worker scans its pieces with a phone. Timbereye tells your backend when the measurements are in, and you update your own record. That is the whole integration: Create → Scan → Sync.

How an integration works: Create, Scan, Sync Your backend Your container record ctr_4821 · MSKU1234567 group: grp_7QxV3m Timbereye The group and its logs 35 logs 11.113 m³ JAS refines every log The phone Timbereye app, or your app with the SDK species · length grade · mode 1 Create create group, keep its id 2 Scan logs into the group 3 Sync an event tells your backend; you update your record How an integration works: Create, Scan, Sync Your backend Your container record ctr_4821 · MSKU1234567 group: grp_7QxV3m 1 Create create group, keep its id 3 Sync an event tells your backend; you update your record Timbereye The group and its logs 35 logs 11.113 m³ JAS refines every log 2 Scan logs into the group The phone Timbereye app, or your app with the SDK species · length grade · mode

Two words carry the rest of the docs. A group is what is being measured: a container, a truckload, a pile. A piece is one thing in it: a log for sawlogs, a board or a sheet for lumber and panels. The API calls a piece an item. The examples below are logs. Everything else is in the Glossary; what each product type and SDK does is in What is available.

1. Create#

When your backend creates its own record, say ctr_4821 for container MSKU1234567, it creates the Timbereye group and keeps the group's id on that record.

TypeScript
const timbereye = new Timbereye() // reads TIMBEREYE_SECRET_KEY
const group = await timbereye.groups.create({
    kind: "container",
    externalRef: "ctr_4821",
    name: "MSKU1234567",
})
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": "container", "external_ref": "ctr_4821", "name": "MSKU1234567" }'
CLI
timbereye groups create --kind container --external-ref ctr_4821 --name MSKU1234567 --json
JSON
{
    "id": "grp_7QxV3m",
    "object": "group",
    "kind": "container",
    "external_ref": "ctr_4821",
    "name": "MSKU1234567"
}

Keep grp_7QxV3m on ctr_4821: containers are reused, so the group's id, not the container number, ties the two records together. You can preset the spec (species, length, grade) here, or leave it to the worker. Guide: Create groups.

2. Scan#

The worker scans the group's logs, choosing species, length, grade and mode in the scanner. Each log is saved on the phone as it is measured and uploaded when there is signal. Two ways:

  • The Timbereye app, no mobile code. The office adds the worker by email; the worker signs in once and picks the group from the list. Guide: Scan with the Timbereye app.
  • Your own iOS or Android app, with the SDK and a publishable key, which is made to ship inside an app. The iOS scanner is in the Swift SDK, the Android one in the Kotlin SDK. Guide: Scan in your app.
Swift
Timbereye.configure(publishableKey: "te_test_pk_…") // once, at launch
TimbereyeScanner(groupId: "grp_7QxV3m")
Kotlin
Timbereye.configure(context, publishableKey = "te_test_pk_…") // once, in Application.onCreate
TimbereyeScanner(groupId = "grp_7QxV3m")

3. Sync#

When the logs the worker scanned have been refined on the server, Timbereye sends your backend group.measured with the group's tally; more logs later send it again with the next revision. Your handler updates your record. Guide: Stay in sync.

TypeScript
const onEvent = timbereye.webhooks.handler(async (event) => {
    if (event.type === "group.measured") {
        const { externalRef, revision, pieces, volume } = event.data.object
        await db.containers.update(externalRef, { pieces, volumeM3: volume?.m3, revision }) // keep the highest revision
    }
})
app.post("/webhooks/timbereye", express.raw({ type: "application/json" }), onEvent)

Your record afterwards:

idcontainertimbereye_group_idpiecesvolume_m3
ctr_4821MSKU1234567grp_7QxV3m3511.113

Each log, with its tag, diameters and photo, stays readable from the API at any time: Read logs, volume and photos.

Next#

What is ready#

Test mode is free and open to everyone. What each product type, SDK and tool does, and the price: What is available.