Keys
Which credential do I need? A secret key on your server, a publishable key in your app, a device sign-in for a worker in the Timbereye app, or a capture token for per-group control. Restricted keys, limits, app ids, abuse, and test and live mode.
Used in all three steps. Your server's secret key creates groups (step 1) and receives events (step 3); the phone's publishable key, device sign-in or capture token uploads what the worker scans (step 2).
Every request carries a key as a bearer token:
const timbereye = new Timbereye() // reads TIMBEREYE_SECRET_KEY
const account = await timbereye.account.retrieve()curl https://api.timbereye.com/v1/account -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"timbereye account get --json{
"id": "acct_1Fq8Zt",
"object": "account",
"livemode": false,
"mode": "test",
"display_units": "metric",
"default_volume_rule": "jas"
}Which key do I need?#
| Credential | Who holds it | What it can do | Use it when |
|---|---|---|---|
Secret key (te_test_sk_…) | Your server | Everything in the account | Always, on your server |
Publishable key (te_test_pk_…) | Your own iOS or Android app, built in | Capture into groups; never read or list your data | You ship your own app |
Device sign-in (te_test_ds_…) | The Timbereye app, after a worker signs in with an emailed code | What a publishable key can do, plus list your groups; names the worker on every scan | Workers use the Timbereye app (how) |
Capture token (te_test_ct_…) | A phone, minted by your server for at most 24 hours | Capture into the groups you name; a few more capture calls | Your server must decide per group and per day (how) |
A server process that needs only part of the account uses a restricted key (te_test_rk_…) with scopes.
Your test secret key is already on the console's Home when you sign up: copy it. Every organisation has a default secret key and publishable key in test mode, and in live mode from the moment live mode is on. In live mode live replaces test (te_live_sk_…). Key formats are te_<mode>_<kind>_<keyid>_<secret>. You can reveal or copy a key in the console at any time. A publishable key is not a secret and is always shown. A request with no Authorization header gets 401 authentication_required; a malformed, expired or revoked key gets 401 invalid_api_key. Basic auth is not supported.
Secret keys#
On your server. Full access to the account. Keep it in your server's secret store as TIMBEREYE_SECRET_KEY, which the TypeScript client and the CLI both read. Only a secret key can mint capture tokens (403 secret_key_required otherwise).
Never put a secret key in an app or on a phone: a phone can be lost, rooted or inspected, and the key would read and change your whole account. The TypeScript client refuses to start with a secret or restricted key in a browser. The dangerouslyAllowBrowser flag exists. Do not use it.
Publishable keys#
In your app. A publishable key is safe to build into your app. It cannot read or list your data; it lets a scanner capture pieces into a group. The app sends it on every request as Authorization: Bearer te_live_pk_…, with no exchange for a token. Create it in the console (owners and developers can create, change, roll and revoke them):
{
"kind": "publishable",
"name": "Yard app",
"spec": "write",
"group_access": "any",
"allowed_app_ids": ["com.example.yard"]
}Your server creates the group with its secret key and gives the app the group id (Create groups). An app with no server code can open a group by reference instead (POST /groups/open, phone-first).
With the key and a group id, a scanner can:
- capture scans into that group;
- read the group's
id,kind,external_ref,name,defaultsandversion(acapture_group); - look up a reference (
GET /groups/lookup: the newest group with it, its pieces and last scan); - change the group's
defaultsandapply_to_existing, unless the key hasspec: "read"; - list the group's photos, add photos and remove the ones it added, and set the group's weight.
It can read back its own scans' logs with their final values (GET /scans/{id}/items, below), and the group's photos and weight, and never a group's other logs or volumes, other installations' scans, or a list of your groups. Anyone who extracts the key from the app can do the same, so its reach is the group ids they can learn. Narrow it with these options (change them with PATCH /api_keys/{id}):
| Option | Values |
|---|---|
group_access | any (default): any group whose id the app presents. opened_only: only groups this key opened by reference; any other id is 403 group_not_allowed |
spec | write (default): the worker may change species, length and grade. read: the worker only sees them |
Every request with a publishable key also sends two headers. The Timbereye mobile SDKs send both.
| Header | Required | Meaning |
|---|---|---|
Timbereye-Installation-Id | Yes | A lowercase UUID your app creates once per install and keeps. Missing: 400 installation_id_required |
Timbereye-App-Id | If the key restricts apps | The iOS bundle id or Android package name. Not allowed: 403 app_not_allowed |
A scanner reads back only what the same key wrote from the same installation. Every scan it creates names its group and its method, which is required: POST /scans with { "method": "qr_scale", "group_id": "grp_7QxV3m" } (or ar_scale, qr_count with "intent": "add", photo_count). The mobile SDKs send it for you.
GET /account tells the app what its key may do, so the scanner can hide "Change" up front instead of learning it from a 403. It describes only the key, never your data, and reading it uses none of the caps. With a publishable key the answer carries key:
{
"object": "account",
"key": {
"object": "key_rights",
"kind": "publishable",
"spec": "read",
"group_access": "any",
"remaining_today": { "scans_per_day": 1987, "items_per_day": 49562, "groups_opened_per_day": 496 },
"resets_at": "2027-02-04T00:00:00Z"
}
}Abbreviated: limits and remaining_today.image_bytes_per_day are there too. A capture token gets the same key with its group_ids; a secret or restricted key gets key: null.
Capture tokens#
For per-group control. A capture token is a short-lived credential your server mints for one phone or worker, after checking who the worker is. How long a capture token lasts: 1 hour by default, from 60 seconds to 24 hours as you set ttl_seconds. The Timbereye app can open one from a link (Advanced: limit a phone to specific groups). Use one in your own app when you want the strictest reach: one worker, the groups that worker may scan into, at most 24 hours, so a copy found on a lost phone is useless within a day.
const token = await timbereye.captureTokens.create({
groupIds: ["grp_7QxV3m"],
spec: "read",
ttlSeconds: 3600,
})curl https://api.timbereye.com/v1/capture_tokens \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "group_ids": ["grp_7QxV3m"], "spec": "read", "ttl_seconds": 3600 }'timbereye capture-tokens create --group grp_7QxV3m --spec read --ttl 3600 --json{
"object": "capture_token",
"key_id": "3kXq9TnB7mLp",
"secret": "te_test_ct_3kXq9TnB7mLp_…",
"expires_at": "2027-02-03T15:05:11Z",
"group_ids": ["grp_7QxV3m"],
"spec": "read"
}// Your route for the phone's token provider, behind your own check of the worker.
app.post("/capture-token", requireWorker, async (req, res) => {
const token = await timbereye.captureTokens.create({
groupIds: [req.body.groupId],
spec: "read",
ttlSeconds: 3600,
})
res.json({ token: token.secret })
})| Field | Meaning |
|---|---|
ttl_seconds | Lifetime. Default 3600 (1 hour), minimum 60, maximum 86400 (24 hours) |
group_ids | Limit the token to these groups. Leave it out for any group in the account |
spec | read (default) shows the group's spec (species, length, grade, diameter class); write also lets the phone change it |
secret is shown once, and is null on an idempotent replay; mint a new token instead. A capture token cannot be rolled; it expires. Capturing offline needs no token: the phone asks your app for one when it uploads, and an expired token pauses the upload and loses nothing. See Working offline.
Device sign-ins#
In the Timbereye app, for one worker. You do not create a device sign-in. The office adds the worker's email on the console's Team page; the worker signs in to the app with a code emailed to that address, and the app receives a device sign-in for that phone and keeps it in the iPhone Keychain (Android Keystore). Owners, developers and editors can sign in to the app too.
- What it can do: everything a publishable key can do (below), with the same per-credential limits, plus list your organisation's groups (
GET /capture_groups: name, reference, kind, spec, log count; never figures, weight or metadata). That includes reading the final values of the logs this phone captured (GET /scans/{id}/items) and its own rights inGET /account(key.kindisdevice, withspec: "write"). Nothing else:403 device_sign_in_not_allowed. - Who: it names the person and the phone. Every scan, log and image it uploads records it as the actor (
provenance.actorof a measurement is{ "type": "key", "id": "key_…" });GET /team/device_sign_insmaps it to the email. - One phone: it works only with the
Timbereye-Installation-Idit was issued to. - Mode: fixed at sign-in, the organisation's mode then (live once live mode is on). A test sign-in of an organisation that has gone live may still upload, into test mode, but cannot list or open groups (
403 organisation_now_live); the worker signs in again and gets a live sign-in. A test sign-in never reaches the live account (a live group's id is404to it, andTimbereye-Modecannot change its mode), so test data never becomes live data. The apps keep whatever the test sign-in had not uploaded on the phone, under "Made in test mode": never uploaded with the live sign-in, removed only when the worker asks. - Lifetime: no expiry. It stops at once when the office signs the phone out or removes the worker, when a member loses a role that may write data, or when the worker signs out on the phone. It cannot be rolled.
Honest limits: anyone who copies the credential and the installation id off an unlocked, compromised phone can act as that worker until the office signs the phone out. The sign-in email is the only proof of the person; whoever reads the worker's email can sign in as them.
Restricted keys and scopes#
A restricted key holds a list of scopes. Each operation needs one of the scopes listed for it, and a :write scope includes the matching :read. A call outside them returns 403 scope_missing.
| Scope | Gives access to |
|---|---|
groups:read, groups:write | Groups, group volume, group origin, volume rules, membership and weight (write) |
items:read, items:write | Items (logs), measurements, item volume, item edits (write) |
scans:read, scans:write | Scans, scan items and observations, submit |
images:read, images:write | Images and uploads |
places:read, places:write | Places and place validation |
species:read, species:write | The species catalogue |
webhooks:read, webhooks:write | Webhook endpoints |
events:read | The event feed |
usage:read | Usage totals and records |
models:read | The detector model |
events, usage and models have no :write scope. GET /account needs no scope. A service that only reads volumes needs groups:read.
Test and live mode#
Each organisation has a test mode and a live mode. A te_test_ key reaches only test data, and test data never appears in live queries. Every object carries livemode. Test mode is free and on from sign-up; an owner turns live mode on in the console by accepting the terms and adding a card. See Going live.
The Timbereye-Mode header is for dashboard sessions, which switch to test mode with Timbereye-Mode: test. An API key may send only its own mode; any other value gets 400 key_mode_mismatch. Dashboard session tokens are for the console, not for integrations.
Reference#
Creating, rolling and revoking keys#
Keys are managed in the developer console, not with API keys: the key routes (/api_keys) accept only a console sign-in, so a key can never mint, list, reveal or revoke keys (403 session_required). Your default keys (is_default: true) are made for you; create more for separate servers, narrower scopes or another app. Live keys exist once live mode is on. Revoking a default key makes a new default unless you have another key of that kind that can be shown. Rolling a key can keep the old one working for up to 7 days while you deploy the new one. Each change is in the audit log (api_key.updated, api_key.records_voided).
Showing a key again#
| Key | In the console | Who can reveal and copy it |
|---|---|---|
| Test secret or restricted key | Masked; Reveal and Copy at any time | Owners and developers |
| Live restricted key | Masked; Reveal and Copy at any time | Owners and developers |
| Live secret key | Masked; Reveal and Copy at any time | Owners |
| Publishable key (test or live) | Shown in full; it is not a secret | Owners and developers |
| Capture token, device sign-in | Never shown again | Nobody |
Copy works without revealing. Live keys reach real data and billing: each reveal and copy is in the audit log (api_key.revealed, never the key), one person can do it 60 times an hour, and rolling a key replaces it at once. The console calls POST /api_keys/{id}/reveal; revealable in the key list says whether it can. A key made before keys could be shown again (test keys before 23 November 2026, live secret and restricted keys before live keys became revealable) has revealable: false: it keeps working, and your default key sits beside it ready to copy.
What a publishable key can call#
Anything else is 403 publishable_key_not_allowed.
| Area | Calls |
|---|---|
| Groups | POST /groups/open, GET /groups/lookup, GET /groups/{id}, PATCH /groups/{id} (defaults and apply_to_existing only), PUT /groups/{id}/weight. Each but the lookup returns a capture_group (with the group's weight) |
| Scans | POST /scans, GET /scans (with client_id), GET /scans/{id}, GET and POST /scans/{id}/items, POST /scans/{id}/observations, POST /scans/{id}/submit |
| Images | POST /scans/{id}/images, POST /images, POST /images/{id}/session, GET /images/{id}, POST /images/{id}/complete, GET /groups/{id}/images, DELETE /images/{id} (its own photos) |
| Other | GET /species, GET /volume_rules, GET /models/detector, GET /account |
- A
qr_countscan with a publishable key may only add (intent: "add"); verifying or removing tags needs a capture token. - A publishable key cannot move logs: a tag whose log is in another group is
409 item_move_not_allowed. A phone signed in to the Timbereye app (a device sign-in) can, once the worker confirms: its refusal names the log's group inerror.details, and the log is sent again withallow_move: true(recorded asitem.movedin the audit log). GET /scans/{id}/itemsreads back the logs of the device's own scan (this key, this installation), each with that scan's own latest measurement andfinal: trueonce its refinement has finished, so the scanner can mark logs final. At most 100 a page; never another phone's measurement or anything else in the group.POST /scansneeds a group whose id the app presents, or one the key opened by reference from this installation (only the latter withgroup_access: opened_only).
What a device sign-in can call#
Every call in What a publishable key can call, plus:
| Area | Calls |
|---|---|
| Groups | GET /capture_groups (groups, newest first; q searches name and reference, kind filters) |
| Sign-in | GET /device_sign_in (who the phone is signed in as), DELETE /device_sign_in (sign out) |
The sign-in itself (POST /device_sign_in/code, /verify, /choose) needs no credential. The app makes these calls; there is no server SDK or CLI command for them. Workers and their phones are managed on the console's Team page (/team/scanners, /team/device_sign_ins, console sign-in only).
What a capture token can call#
| Area | Operations |
|---|---|
| Scans | POST /scans, GET /scans/{id}, POST /scans/{id}/items, POST /scans/{id}/observations, POST /scans/{id}/submit |
| Images | POST /scans/{id}/images, POST /images, GET /images/{id}, POST /images/{id}/complete |
| Groups | GET /groups, GET /groups/lookup, GET /groups/{id}, POST /groups, POST /groups/open, PATCH /groups/{id} (spec only) |
| Other | GET /species, GET /volume_rules, GET /models/detector, GET /account |
- A token limited to
group_idscannot create groups (POST /groups/openandGET /groups/lookuponly find one of its groups), and gets403 group_not_allowedfor any other. PATCH /groups/{id}works only withspec: write, and only fordefaultsandapply_to_existing.- A token cannot list scans, read logs, volumes or origin, delete groups or manage webhooks (
403 capture_token_not_allowed).
Publishable key limits#
Counted per key. Change them with PATCH /api_keys/{id} (limits); null returns a limit to its default, and a daily limit of 0 turns that capability off.
| Limit | Field | Default |
|---|---|---|
| Requests per second | requests_per_second | 10 |
| Scans per day | scans_per_day | 2,000 |
| Logs per day | items_per_day | 50,000 |
| Image bytes per day | image_bytes_per_day | 5 GiB |
| Group opens per day | groups_opened_per_day | 500 |
Over the request rate: 429 rate_limited. Over a daily limit: 429 daily_cap_reached, with param naming the limit and Retry-After running to 00:00 UTC. Usage from a publishable key is billed like any other (refined volume in m³); test mode is free.
App ids#
allowed_app_ids limits the key to your iOS bundle ids and Android package names. It is a speed bump, not proof: Timbereye-App-Id is a header anyone holding the key can set. App Attest and Play Integrity are not supported. Rely on limits and revocation.
If a publishable key is abused#
- Revoke the key, or roll it and let the old one stop at once or after a grace period.
- Remove what it captured:
POST /api_keys/{id}/void_recordswithcreated_afterandcreated_beforeremoves the logs the key captured in that window and voids their usage. Call it again whilehas_moreistrue.
Both need a console sign-in; the console does them for you.