Command line (CLI)
The timbereye command line for people and coding agents. Install, log in, the agent contract, the commands, the quickstart flow and the exit codes.
Start in 60 seconds. Install, sign in through your browser, and run the whole loop (Create, Scan, Sync) in test mode with a simulated scan. No phone, and no key to paste.
Start in 60 seconds#
1. Install (Node 20 or later). From npm, or with the install script, which puts it in ~/.timbereye without sudo and checks the download's SHA-256:
npm install -g timbereyecurl -fsSL https://www.timbereye.com/install.sh | sh2. Sign in. It prints a short code and opens the console in your browser. Check the code matches, click Approve, and the CLI has your organisation's test key. No account yet? Sign up at timbereye.com (or in the Timbereye app) first; it takes a minute and test mode is free.
timbereye login3. Run the loop. A group is created, a simulated scan goes into it, the results are refined and measured, and you see the tally and the group.measured event your server would receive:
timbereye quickstartTimbereye quickstart: Acme Forest, test mode
1 Create grp_7QxV3m container "Quickstart" ref quickstart-20261123-141502-9c1e
2 Scan scn_8RtY2k 12 simulated logs, no phone
3 Sync refined and measured; group.measured sent
Tally 12 pieces, 4.218 m3 (JAS rule)
The event your server receives (evt_2Wm8Xa):
{
"id": "evt_2Wm8Xa",
"type": "group.measured",
"data": { "object": { "object": "group_tally", "group_id": "grp_7QxV3m", "pieces": 12, ... } }
}
Webhook none yet. Receive events on this machine: timbereye webhooks listen
Next
timbereye groups get grp_7QxV3m the group, its tally and volume
timbereye webhooks listen receive events on this machine
timbereye init my-server a starter server that runs this loop
Docs https://www.timbereye.com/docs/cli/timbereye quickstart --json prints the same as one JSON document: a coding agent runs it to check its setup. Each run makes a new test group; --cleanup deletes it afterwards, --group <id> scans into a group of yours.
The five commands people use first#
timbereye groups create --kind truck_load --external-ref T-1042 --name "Truck 1042"
timbereye simulate scan --group grp_7QxV3m --logs 35 --wait-until refined
timbereye groups get grp_7QxV3m
timbereye events tail
timbereye webhooks listenCreate a group, scan into it without a phone, read its tally and volume, follow the events as they happen, and receive them as signed webhooks on your machine. Every command takes --json, and --help at any level.
Without the browser (CI, containers, agents)#
Skip login and set the key from Home in the console:
export TIMBEREYE_SECRET_KEY=te_test_sk_...
timbereye whoamiTIMBEREYE_SECRET_KEY always wins over a saved sign-in.
Availability#
| Topic | State |
|---|---|
The CLI (timbereye, version 0.2.0) | Available: install it as above |
login through the browser | Available. Gives the organisation's default test key; never a live key |
quickstart | Available in test mode |
| Commands for the API operations in the current build | Available |
models detector | Log detector 1.0.0 where the environment holds it, else 503 model_unavailable |
| Image upload commands | Need hosted image storage, which is not wired in the cloud environment (503) |
| Creating accounts or API keys | Not in the CLI, because not in the API. Keys come from the console or from Timbereye staff |
An MCP server (timbereye mcp serve) | Available. It exposes the same commands as tools, with the same safety rules |
Simulated scans and refinements (simulate) | Available in test mode only. Simulated: synthetic numbers, labelled as such |
What it is not#
Timbereye produces data. Your software runs your business. The CLI has no orders, bookings, approvals or reports, and does not grow them. Anything workflow-shaped belongs in your own software. See How an integration works.
Sign in#
timbereye login
timbereye whoami
timbereye logoutloginwith no key, on a terminal, starts a device sign-in: it prints a code such asKXWD-PTHMand openshttps://www.timbereye.com/app/cli/authorize?code=KXWD-PTHM. An owner or developer of your organisation checks the code and approves; the CLI then receives the organisation's default test secret key, once. The code works for 10 minutes. The console records the approval in the audit log (api_key.revealed,purpose: cli). It never gives a live key.--no-browserprints the link without opening it; off a terminal,--webdoes the same and waits.- The key is kept in your system's credential store where Node can reach one with no extra software: the macOS Keychain, the Secret Service on Linux (through
secret-tool), or Windows Credential Manager. Anywhere else it goes to~/.timbereye/config.json(directory 0700, file 0600), andloginsays so.TIMBEREYE_KEY_STORE=filechooses the file. whoamiprints the organisation, the mode, the profile, where the key is kept and the key prefix. Never the secret.logoutremoves the key from this computer. The key itself keeps working until it is rolled in the console (API keys), because the same key may be in use elsewhere.- Profiles:
timbereye login --profile acmekeeps a second organisation beside the default one.--profile acmeorTIMBEREYE_PROFILE=acmechooses it per command. - With a key in hand,
printf %s "$TIMBEREYE_TEST_KEY" | timbereye login --key -checks it withGET /accountand saves it the same way.--key -reads stdin, which keeps the key out of your shell history. A live secret key needs--allow-live; capture tokens are for devices and are refused. timbereye doctorchecks the key, the mode, whether the API is reachable and how far your clock is from the server's (webhook timestamps are rejected beyond five minutes), and asks the API which parts of this build are available.- In CI skip
loginand setTIMBEREYE_SECRET_KEY, the same variable the TypeScript SDK reads (the olderTIMBEREYE_API_KEYis still read when it is the only one set).TIMBEREYE_API_URLandTIMBEREYE_PROFILEalso override the config file.
The agent contract#
| Rule | What it means |
|---|---|
| stdout is the result | Progress, warnings and human-readable errors go to stderr. |
--json | Exactly one JSON value on stdout, in the API's snake_case as in these docs. events tail and webhooks listen print one compact JSON value per line. |
| Errors | With --json, one object on stdout: { "error": { "type", "code", "message", "param", "request_id" } }, and the exit code is set. |
| No prompts | The CLI never waits for input unless you pass --interactive (only login has a prompt), a person runs a destructive command on a terminal without --yes (it asks), or login waits for the browser approval on a terminal (--web elsewhere). It reads stdin only when told. |
| No colour | None when stderr is not a terminal, when NO_COLOR is set, or with --no-color. No spinners. |
| Secrets | API keys are never printed. A capture token or webhook secret is printed once, on creation, to stdout with a warning on stderr. It cannot be read again. |
| Environment first | TIMBEREYE_SECRET_KEY, TIMBEREYE_API_URL and TIMBEREYE_PROFILE beat the config file. |
| Waiting | scans submit --wait-until refined, scans wait and events tail poll and log each stage change on stderr. |
| Safe retries | Every POST carries an idempotency key (generated, or yours with --idempotency-key). See errors, idempotency and pagination. |
| Discovery | timbereye commands --json prints every command, flag, choice, default, API operation id and schema ref in one call (commands --summary is short, commands "groups describe" is one command in full). --help works at every level. |
| Mode | Every JSON result says livemode; lists and composite results also say profile. --fields cannot remove it. |
| Safe changes | Every command that changes data takes --dry-run, sends an idempotency key it prints on stderr, and prints what changed. Destructive or bulk ones need --yes without a terminal. |
| Small output | --fields a,b.c keeps only those fields, --summary keeps the few that identify a result, --output json|ndjson|table|csv picks the form. |
Exit codes#
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Failure: an API error other than auth, a network error, a webhook that did not verify, a wait that timed out |
| 2 | Usage: unknown command or flag, missing argument, a bad unit, a refused action (including a missing --yes) |
| 3 | Authentication: no key, or the key was rejected (401) |
| 4 | Permission: the key is valid but may not do this (403, for example scope_missing or secret_key_required) |
Commands#
Every command prints its API operation in --help. Add --json to any.
| Area | Commands |
|---|---|
| Setup | login, logout, whoami, quickstart, doctor, init, commands, explain, open, completion, mcp serve |
| Questions | groups describe, groups find, groups diff, groups reconcile, items find, items describe |
| Moving data | groups items move, import items, export group |
| Test mode | simulate scan, simulate refine, simulate packing-list |
| Lumber, panels | groups create-batch, groups parents, tally get, submit, correct, revisions, sheet; packing-list get; import packing-list |
| Offline | volume calc, volume rules, units convert |
| Groups | groups create, open, lookup, get, list, update, delete, set-weight, clear-weight, volume, origin; groups images list, add, remove |
| Group members | groups items add, remove, bulk-update, list |
| Items | items list, get, update, remove, volume, groups, images; items measurements list, create |
| Scans | scans create, list, get, wait, add-items, add-observations, submit, upload-image |
| Images | images create, session, get, complete |
| Places | places create, get, list, update, validate |
| Reference data | species list, create, update; volume-rules list; models detector |
| Events | events list, get, tail |
| Webhooks | webhooks endpoints create, list, get, update, delete, roll-secret, test; webhooks verify, webhooks listen |
| Devices | capture-tokens create |
| Account | usage get, usage records, account get |
groups open --kind container --external-ref MSKU1234567 continues or creates a group for a kind and reference (trimmed, ignoring case). --existing auto (the default) continues the newest group with the reference if it was active in the last 12 hours and starts a new one otherwise; continue and new choose; --started-at is when the worker started. groups lookup --kind container --external-ref MSKU1234567 shows that group and the suggested choice without creating anything. groups open takes the spec flags of groups create plus --apply-to-existing. See Create groups.
Asking questions: one call, one document#
These answer a question in one call. Each prints one JSON document with a stable shape, in parallel reads where it needs several, and reports api_calls.
# What was in this container? (the group, its spec, summary, parent, children, origin, and the items)
timbereye groups describe --external-ref ctr_4821 --items --json
# What was on booking B123? You stored the booking number in metadata, and the API filters on it.
timbereye groups find --metadata booking=B123 --json
timbereye groups find --metadata booking=B123 --kind container --tree --json
# Where is this log, and where has it been?
timbereye items find --tag TE-4F7K2Q1 --json # the item, its current group, every group it was in
timbereye items describe --tag TE-4F7K2Q1 --json # plus every measurement, with provenance, and its volume
# Does this manifest match what was scanned?
timbereye groups reconcile --external-ref ctr_4821 --tags @manifest.txt --locate --json
# What differs between a load as it left and the group that received it?
timbereye groups diff grp_origin grp_arrival --jsondescribe takes the group id, or --external-ref or --client-id; more than one match is an error that lists the ids. --items, --images, --scans, --events and --history add sections, each capped by --max-items and marked truncated when cut. Add --fields to keep the answer small: --fields group.name,summary.items,summary.volume.m3.
groups find filters by --q, --kind, --external-ref, --parent, --client-id, --origin, --created-after, --created-before and --metadata key=value (repeat it, up to five; they combine with AND). groups list takes the same filters and returns the API's groups.
Changing data safely#
timbereye groups delete grp_7QxV3m --dry-run # the request, its idempotency key, the effect; sends nothing
timbereye groups delete grp_7QxV3m --yes # run it; prints "changed: DELETE /groups/grp_7QxV3m -> 200 (idempotency-key ...)"
timbereye groups items move --from grp_origin --to grp_arrival --tags @tally.txt --yes--dry-runworks on every command that changes data. It prints `{ "object": "dry_run", "requests": [ { method,
path, query, body, idempotency_key, if_match } ], "effect": ... } and exits 0. The effect is read from the API with GETs only. On a command that only reads, --dry-run` is exit 2.
--yesis required, when stdin is not a terminal, forgroups delete,groups items remove,groups items bulk-update,groups items move,items remove,webhooks endpoints delete,webhooks endpoints roll-secretandimport items. Without it the command exits 2 withconfirmation_requiredbefore any request. On a terminal it shows the effect and asks.- Every write carries an idempotency key. It is printed on stderr, and when a write fails the line
retry safely with --idempotency-key ...says which to use.--if-match <version>guardsgroups update. groups items movechecks that every item named is in--from, then moves them with one call that the API makes atomic: all move or none. To undo, run it again with--fromand--toswapped.
Bulk in and out#
timbereye import items --group grp_7QxV3m --file tally.csv --validate-only --json # the report; sends nothing
timbereye import items --group grp_7QxV3m --file tally.csv --results tally.results.ndjson --yes --json
timbereye export group grp_7QxV3m --format csv > load.csv
timbereye export group grp_7QxV3m --format geojson --out origin.geojsonThe tally columns are tag (required), species, length (5.8m, or a bare number with --length-unit), grade, diameter_class (24cm), diameter_short and diameter_long (both or neither; a bare number is cm unless --diameter-unit), and any metadata.<key> columns. The file is validated whole before anything is sent: unknown species, bad units, duplicate tags and a missing diameter are reported with their row. Invalid rows stop the import unless --skip-invalid. Then it adds the tags in batches of 500, sets fields (rows with the same values share one bulk update) and metadata, and records two diameters as a manual measurement with the file named as the reason. New tags become items from the group's defaults, so the group needs a spec with species, length and a diameter class, else the API answers assignment_required. Every idempotency key derives from the file's hash and the row range, so running the same command again after a failure replays what finished. --results writes one line per row (ndjson, or csv if the name ends in .csv).
A metric width-class packing list (see Lumber and panels) imports as a packing list with one bundle per row:
timbereye import packing-list --file packing_list.csv --validate-only --json # the report; sends nothing
timbereye import packing-list --file packing_list.csv --external-ref SPEC-B7 --totals exact --no-photos "no camera at the mill" --yes --jsonIts columns are species, bundle number, quality code, AD/KD, thickness (mm), length (m) and pieces, then one column per width class in mm (90, 100, ... 580; a cell is a piece count, empty is 0); width_dev_m and volume_m3 are read and ignored, because the server computes. Headers match case-insensitively with common variants (Essence, NO, CODE, AD/KD, Nb pieces, Tickn. (mm), Lengtht. (M)), and other columns are ignored. It creates the list (or finds the newest one with this --external-ref), creates the bundles it lacks with groups create-batch in chunks of 100 (external_ref <quality>-<number>), and submits each bundle's tally. Each tally is final when submitted, so group.measured follows for each bundle and then for the list. Keys derive from the file's hash and bundles already there are not created again, so running it again resumes. The result gives the list's id, the bundles created and its totals and totals_alternative.
export group prints csv (one row per item with its measurement and metadata.* columns), json, or the origin as a GeoJSON FeatureCollection. This is data movement. It is not a report.
Offline tools#
No account, no network:
timbereye volume calc --rule jas --diameter 24cm --length 5.8m
timbereye volume calc --rule smalian --small-end 20cm --large-end 30cm --length 4m --json
timbereye volume calc --file logs.csv --json # columns: tag, diameter, length
timbereye volume rules --json # every rule with its verification status
timbereye units convert 19ft --to m
timbereye explain group_not_empty # an API error code: meaning, likely cause, next stepvolume calc uses the same open rules library as the API. A rule that is not verified against a standard reference (scribner_formula and its old id scribner) always prints an UNVERIFIED warning, in the result, on stderr and in the human view. doyle, international_quarter and scribner_decimal_c are verified against published tables and print no warning. The two table rules take whole inches and feet: timbereye volume calc --rule scribner_decimal_c --small-end 12in --length 16ft gives 80 board feet. explain with no code lists them all.
Inputs#
- Flags for the common fields.
--data @file.json(or--data -) takes a full body in the API'ssnake_case. Flags override fields in it.--metadata key=valueis repeatable. - Units go with the number:
--length 5.8m,--gross 42000lb,--diameter-class 24cm. Lengths arem,cm,ft,in. Weights arekg,lb,t(metric tonne) andshort_ton. A bare number, or a bareton, is exit 2. See Create groups. - Places take GeoJSON from a file:
--geometry @tract.geojson. Check it first withplaces validate. - Lists:
--limit(page size),--starting-after, and--allto fetch every page into one list.
The three steps, from the CLI#
The same loop as the Quickstart: Create a group for your record, Scan into it (simulated here), Sync the result. Set a test key first (export TIMBEREYE_SECRET_KEY=te_test_sk_... or timbereye login).
# Create: a group for your record ctr_4821, container MSKU1234567. Note the grp_ id it prints.
timbereye groups create --kind container --external-ref ctr_4821 --name MSKU1234567 \
--species PINE_TAEDA --length 5.8m --grade A --json
# Sync: follow the events (in a second terminal), or register an endpoint.
timbereye events tail --json
timbereye webhooks endpoints create --url https://example.com/webhooks/timbereye --event group.measured --json
# Scan, simulated (test mode only): 35 tagged logs, refined at once, so group.measured arrives
# with the piece count and volume (revision 1).
timbereye simulate scan --group grp_7QxV3m --logs 35 --seed 7 --wait-until refined --json
# Read: piece count and volume, then the logs.
timbereye groups volume grp_7QxV3m --rule jas --json
timbereye groups describe --external-ref ctr_4821 --items --jsonSimulated. The simulator measures synthetic, tagged logs as a phone would and marks every measurement provenance.simulated: true with the simulator as its segmenter. Nothing is billed; a live key is refused. It needs the group's id (--group) and takes species and length from the group's spec unless you pass --species and --length. The same seed, species, length and --spread give the same diameters.
groups volume returns items: 35, refined: 35, estimated_only: 0 and an m3 that follows from the synthetic diameters. simulate scan returns the scan and the ids of the logs (items) it made. --wait-until refined refines them at once, and group.measured follows. Without it, the logs stop at the phone's estimate (estimated), and refinement resolves when the scheduler next runs or when you run simulate refine.
Standing in for the phone with a tag count#
Real and available, but not needed to start. A tag count records which tagged logs are present, with no diameters. With a diameter class in the group's spec, each new tag gets a nominal (assigned) measurement, so the group has a volume. These are the calls a phone makes; the CLI sends them with a restricted key that has scans:write, and a phone sends them with a publishable key or a capture token.
timbereye groups create --kind container --external-ref ctr_4822 --name MSKU7654321 \
--species PINE_TAEDA --length 5.8m --diameter-class 24cm --json # note the grp_ id: grp_8Wn2Kd here
timbereye capture-tokens create --group grp_8Wn2Kd --ttl 3600 --json # what your server gives a phone; printed once
timbereye scans create --method qr_count --intent add --group grp_8Wn2Kd --json # note the scn_ id
timbereye scans add-observations scn_2Pq8 --payload TE-4F7K2Q1 --payload TE-4F7K2Q2
timbereye scans submit scn_2Pq8 --wait-until refined # logs stage changes on stderr
timbereye groups volume grp_8Wn2Kd --rule jas --jsonA tag count is refined as soon as it is submitted, since there is nothing to refine. Logs measured by a real phone (qr_scale, ar_scale) reach refined only after server refinement, which depends on image storage and is not verified end to end. Use --wait-until estimated for those, or scans wait with a --timeout.
A photo count#
Partly available. Server-side counting is not built: the count is the number of detections the client supplies with the photo, and it stops at estimated (no scan.refined). Image upload needs image storage configured for the environment, else 503.
timbereye groups create --kind truck_load --external-ref TRK-0417 --json # note the grp_ id: grp_4Tz9Pw
timbereye scans create --method photo_count --group grp_4Tz9Pw --json # note the scn_ id: scn_9a2Lk
timbereye scans upload-image scn_9a2Lk --file truck.jpg --subject group --kind load_face # may answer 503
timbereye scans submit scn_9a2Lk --wait-until estimated --jsonWeights and origin#
timbereye groups set-weight grp_7QxV3m --gross 42000lb --tare 9000lb --ticket-ref WT-118
timbereye groups origin grp_7QxV3m --jsonThe weight is spread over the logs by volume, and again whenever the logs change. See Origin for what the export contains and what it does not do.
Webhooks without writing code#
Your server on localhost gets each event, signed, with no tunnel:
# TIMBEREYE_WEBHOOK_SECRET holds the whsec_ secret your server verifies with
timbereye webhooks listen --forward-to http://localhost:3000/webhooks/timbereye --secret-env TIMBEREYE_WEBHOOK_SECRETforwarding every event from the API to http://localhost:3000/webhooks/timbereye, signed with --secret-env; no tunnel and no public URL needed (polling every 2 s)
2026-11-24T10:12:03Z group.measured evt_4Kp9Wd -> 200 POST http://localhost:3000/webhooks/timbereye (14 ms)What listen does, and does not do:
--forward-to URL(or--forward) follows your account's events through the API (GET /events, every--intervalseconds, 2 by default, starting from now) and POSTs each new one toURLas Timbereye's delivery would arrive: the event's JSON,webhook-idthe event id,webhook-timestampnow, signed with the secret in--secret-env. It needs an API key (timbereye loginorTIMBEREYE_SECRET_KEY), and no tunnel, no public URL and no webhook endpoint, against the hosted API or a local one.--event group.measured(repeatable) forwards only those types. Awebhooks endpoints testdelivery is not an event, so it is not forwarded.- Each forward is tried once and never retried; Timbereye's own deliveries to a registered endpoint are what retry. The line for each event shows your server's status; with
--jsonit is an objectwebhook_forwardwith theeventand theforward:url,status,ok,duration_ms,errorandresponse_body. A failed forward is reported on stderr and does not change the exit code unless you pass--fail-on-error(exit 1 at the end).timbereye explain forward_failedlists the usual causes. --port Ninstead receives real deliveries on127.0.0.1:N: it verifies each signature, answers400to one that does not verify, and prints it, or with--forward-topasses it on with its headers and raw body unchanged and answers what your server answered. Timbereye reaches that port only through a tunnel you run and register withwebhooks endpoints create;listencreates no tunnel and calls no third party.
timbereye webhooks listen --port 8787 --secret-env TIMBEREYE_WEBHOOK_SECRET --max-events 3 --json
timbereye webhooks verify --secret-env TIMBEREYE_WEBHOOK_SECRET --headers @headers.json --body @body.jsonverify checks a saved delivery offline. timbereye events tail --json prints the event feed with no server at all. See Stay in sync.
Scaffolds#
timbereye init ./my-integration --template server-node
timbereye init ./export-demo --template container-export-exampleEach needs an empty directory (or --force) and contains no secrets. server-node is a small Node server that creates a group, mints a capture token, receives signed webhooks and reads items and volume. container-export-example adds one worked example of the container use case: the container number as the group's external_ref, the booking number in metadata, a weight ticket, and the origin export. It is an example. It has no ERP features, and your use case may look nothing like it.
An MCP server#
timbereye mcp serve speaks the Model Context Protocol on stdio and exposes the command table as tools named timbereye_<command> (for example timbereye_groups_describe). It has the CLI's rules: results state livemode, mutating tools accept dry_run, destructive or bulk tools refuse without confirm: true, and every write sends an idempotency key. --read-only leaves out every tool that changes data. Credentials come from the environment or the profile, like the CLI. A typical client entry is { "command": "timbereye", "args": ["mcp", "serve", "--read-only"] } with TIMBEREYE_SECRET_KEY in its environment. login, init and the streaming commands are not tools.
Next#
- Build with a coding agent
- Quickstart and Keys
sdk/cli/README.mdin the repository for development notes, andsdk/cli/DESIGN.mdfor why the CLI is shaped this way