Capture tokens
Short-lived device tokens.
The capture token object#
A short-lived device token scoped to capture. Offline capture needs no token; the device asks the host app for one when it syncs.
| Field | Description |
|---|---|
objectcapture_token | String representing the object type. Always capture_token. |
livemodeboolean | true for objects in the live account, false for objects in the test account. Test and live data never mix. |
key_idstring | The 12-character key id inside the token. |
secretstring, nullable | The token, te_live_ct_<keyid>_<secret> (te_test_ct_ in test mode). Shown once. Pass it to the SDK's token provider. Null on an idempotent replay of the mint, because the token is never stored for replay; mint a new one. Devices never hold secret keys. |
expires_atstring | When the token stops working. |
group_idsarray of string, nullable | Groups the token is limited to; null when unrestricted. |
specread \| write | Spec access. |
Mint a capture token#
POST/v1/capture_tokens
Called by your server for a device. The token lasts one hour by default and at most 24 hours, and can be limited to group ids. Only a secret key may mint tokens; restricted keys and capture tokens cannot. Key management (create, roll, revoke) is dashboard-only and not part of this API.
Keys: secret key.
Body
| Field | Description |
|---|---|
ttl_secondsinteger | Lifetime in seconds. Default 3600 (1 hour), maximum 86400 (24 hours). |
group_idsarray of string | Limit the token to these groups. Omit for any group in the account. |
specread \| write | Whether the field user may change a group's spec (defaults). read shows it; write also lets the device edit it. |
Request
const result = await timbereye.captureTokens.create({ ttlSeconds: 3600, groupIds: ["grp_7QxV3m"] })curl -X POST https://api.timbereye.com/v1/capture_tokens \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"ttl_seconds":3600,"group_ids":["grp_7QxV3m"]}'timbereye capture-tokens create \
--data '{"ttl_seconds":3600,"group_ids":["grp_7QxV3m"]}' \
--jsonResponse
// 200
{
"object": "capture_token",
"livemode": true,
"key_id": "3kXq9TnB7mLp",
"secret": "te_live_ct_3kXq9TnB7mLp_<secret>",
"expires_at": "2027-02-03T15:05:00Z",
"group_ids": ["grp_7QxV3m"],
"spec": "read"
}Errors
| Status | When |
|---|---|
400 | invalid_request_error: the request was malformed or a field was invalid. |
401 | authentication_error: missing, malformed, expired or revoked key. |
402 | invalid_request_error: new live work is refused for billing. payment_overdue: an invoice is unpaid past its grace period; pay it or change the card in the console (Billing). spend_cap_reached: the monthly spend cap set to pause is reached; raise it or wait for the next month. Reads, and finishing scans already started, still work. |
403 | permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you. |
404 | invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404. |
409 | invalid_request_error: idempotency_key_reused, idempotency_request_in_progress, group_not_empty, group_billed, place_in_use, resource_exists, place_name_taken or another state conflict. |
413 | invalid_request_error, payload_too_large: the upload is over the size limit (10 MB for multipart). |
422 | invalid_request_error: the request was well formed but cannot be applied. Codes: group_cycle, group_depth_exceeded, unit_ambiguous, weight_inconsistent, area_ha_not_allowed, assignment_required. |
429 | rate_limit_error: slow down and retry after the Retry-After delay. |
500 | api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key. |
503 | api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later. |