Skip to the page
Docs menu

Docs Platform

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:

TypeScript
const timbereye = new Timbereye() // reads TIMBEREYE_SECRET_KEY
const account = await timbereye.account.retrieve()
curl
curl https://api.timbereye.com/v1/account -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye account get --json
JSON
{
    "id": "acct_1Fq8Zt",
    "object": "account",
    "livemode": false,
    "mode": "test",
    "display_units": "metric",
    "default_volume_rule": "jas"
}

Which key do I need?#

CredentialWho holds itWhat it can doUse it when
Secret key (te_test_sk_…)Your serverEverything in the accountAlways, on your server
Publishable key (te_test_pk_…)Your own iOS or Android app, built inCapture into groups; never read or list your dataYou ship your own app
Device sign-in (te_test_ds_…)The Timbereye app, after a worker signs in with an emailed codeWhat a publishable key can do, plus list your groups; names the worker on every scanWorkers use the Timbereye app (how)
Capture token (te_test_ct_…)A phone, minted by your server for at most 24 hoursCapture into the groups you name; a few more capture callsYour 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):

JSON
{
    "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, defaults and version (a capture_group);
  • look up a reference (GET /groups/lookup: the newest group with it, its pieces and last scan);
  • change the group's defaults and apply_to_existing, unless the key has spec: "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}):

OptionValues
group_accessany (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
specwrite (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.

HeaderRequiredMeaning
Timbereye-Installation-IdYesA lowercase UUID your app creates once per install and keeps. Missing: 400 installation_id_required
Timbereye-App-IdIf the key restricts appsThe 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:

JSON
{
    "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.

TypeScript
const token = await timbereye.captureTokens.create({
    groupIds: ["grp_7QxV3m"],
    spec: "read",
    ttlSeconds: 3600,
})
curl
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 }'
CLI
timbereye capture-tokens create --group grp_7QxV3m --spec read --ttl 3600 --json
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"
}
TypeScript
// 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 })
})
FieldMeaning
ttl_secondsLifetime. Default 3600 (1 hour), minimum 60, maximum 86400 (24 hours)
group_idsLimit the token to these groups. Leave it out for any group in the account
specread (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 in GET /account (key.kind is device, with spec: "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.actor of a measurement is { "type": "key", "id": "key_…" }); GET /team/device_sign_ins maps it to the email.
  • One phone: it works only with the Timbereye-Installation-Id it 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 is 404 to it, and Timbereye-Mode cannot 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.

ScopeGives access to
groups:read, groups:writeGroups, group volume, group origin, volume rules, membership and weight (write)
items:read, items:writeItems (logs), measurements, item volume, item edits (write)
scans:read, scans:writeScans, scan items and observations, submit
images:read, images:writeImages and uploads
places:read, places:writePlaces and place validation
species:read, species:writeThe species catalogue
webhooks:read, webhooks:writeWebhook endpoints
events:readThe event feed
usage:readUsage totals and records
models:readThe 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#

KeyIn the consoleWho can reveal and copy it
Test secret or restricted keyMasked; Reveal and Copy at any timeOwners and developers
Live restricted keyMasked; Reveal and Copy at any timeOwners and developers
Live secret keyMasked; Reveal and Copy at any timeOwners
Publishable key (test or live)Shown in full; it is not a secretOwners and developers
Capture token, device sign-inNever shown againNobody

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.

AreaCalls
GroupsPOST /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)
ScansPOST /scans, GET /scans (with client_id), GET /scans/{id}, GET and POST /scans/{id}/items, POST /scans/{id}/observations, POST /scans/{id}/submit
ImagesPOST /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)
OtherGET /species, GET /volume_rules, GET /models/detector, GET /account
  • A qr_count scan 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 in error.details, and the log is sent again with allow_move: true (recorded as item.moved in the audit log).
  • GET /scans/{id}/items reads back the logs of the device's own scan (this key, this installation), each with that scan's own latest measurement and final: true once 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 /scans needs a group whose id the app presents, or one the key opened by reference from this installation (only the latter with group_access: opened_only).

What a device sign-in can call#

Every call in What a publishable key can call, plus:

AreaCalls
GroupsGET /capture_groups (groups, newest first; q searches name and reference, kind filters)
Sign-inGET /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#

AreaOperations
ScansPOST /scans, GET /scans/{id}, POST /scans/{id}/items, POST /scans/{id}/observations, POST /scans/{id}/submit
ImagesPOST /scans/{id}/images, POST /images, GET /images/{id}, POST /images/{id}/complete
GroupsGET /groups, GET /groups/lookup, GET /groups/{id}, POST /groups, POST /groups/open, PATCH /groups/{id} (spec only)
OtherGET /species, GET /volume_rules, GET /models/detector, GET /account
  • A token limited to group_ids cannot create groups (POST /groups/open and GET /groups/lookup only find one of its groups), and gets 403 group_not_allowed for any other.
  • PATCH /groups/{id} works only with spec: write, and only for defaults and apply_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.

LimitFieldDefault
Requests per secondrequests_per_second10
Scans per dayscans_per_day2,000
Logs per dayitems_per_day50,000
Image bytes per dayimage_bytes_per_day5 GiB
Group opens per daygroups_opened_per_day500

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#

  1. Revoke the key, or roll it and let the old one stop at once or after a grace period.
  2. Remove what it captured: POST /api_keys/{id}/void_records with created_after and created_before removes the logs the key captured in that window and voids their usage. Call it again while has_more is true.

Both need a console sign-in; the console does them for you.