Test mode
A simulated scan and refinement, so the whole loop can be exercised with no phone and no segmentation service. Test-mode keys only.
Simulate a scan (test mode)#
POST/v1/test/scans/simulate
Test-mode keys only; a live key is refused with 403 test_mode_only. Creates a qr_scale scan in the group with logs synthetic, tagged logs and completes it, as a phone would. Diameters are plausible for the species and length, drawn from seed (the same seed gives the same logs) with relative spread. Each log gets a device_estimate marked provenance.simulated: true, and a refinement job. Refinement resolves by itself in test mode when the scheduler next runs, or at once with POST /test/refinements/run; it emits the same events and webhooks as the real path (scan.estimated, then scan.refined). Once the scan's logs are refined the group's tally has settled and group.measured is sent. With refine: true the logs are refined at once (as POST /test/refinements/run does), so the scan comes back refined. Nothing simulated is ever billed and nothing simulated exists in a live account. Safe to retry with the same Idempotency-Key.
Keys: secret key; restricted key with scans:write.
Body
| Field | Description |
|---|---|
group_id requiredstring | The group the simulated scan belongs to. It must be open. |
logsinteger | How many logs to simulate. |
speciesstring | Species code for every log. Defaults to the group's default species. |
lengthLengthInput | Length of every log. Defaults to the group's default length, else 5.8 m. |
seedinteger | Seed for the diameters: the same seed, species, length and spread give the same diameters. Default 1. |
spreadnumber | Relative spread of the diameters around the species' typical diameter (0 makes every log the same). |
tag_prefixstring | Tags are <tag_prefix>-001, -002, ... Default SIM- and the scan id, so tags never collide with real ones. |
refineboolean | Refines the account's pending simulated logs now (as POST /test/refinements/run does), so the scan comes back refined and group.measured is sent before the response. |
Request
const result = await timbereye.testMode.simulateScan({
groupId: "grp_7QxV3m",
logs: 12,
species: "PINE_TAEDA",
length: { valueM: 5.8 },
seed: 7,
})curl -X POST https://api.timbereye.com/v1/test/scans/simulate \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"group_id": "grp_7QxV3m",
"logs": 12,
"species": "PINE_TAEDA",
"length": { "value_m": 5.8 },
"seed": 7
}'timbereye simulate scan \
--group grp_7QxV3m \
--logs 12 \
--species PINE_TAEDA \
--length 5.8m \
--seed 7 \
--jsonResponse
// 200
{
"id": "scn_9a2Lk",
"object": "scan",
"livemode": true,
"client_id": null,
"method": "photo_count",
"intent": null,
"group_id": "grp_7QxV3m",
"status": "open",
"device": null,
"sdk": null,
"models": null,
"location": null,
"results": null,
"replaces_scan_id": null,
"measured_place_id": null,
"place_match": null,
"started_at": null,
"ended_at": null,
"created_at": "2027-02-03T14:10:02Z",
"metadata": {}
}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. |
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. |
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. |
Run pending refinements now (test mode)#
POST/v1/test/refinements/run
Test-mode keys only; a live key is refused with 403 test_mode_only. Resolves every queued refinement job of this account with the simulator immediately, instead of waiting for the scheduler: each item gets a server_refined measurement marked provenance.simulated: true, its scan moves to refined, and the scan.refined event and webhooks are emitted. Returns how many jobs it ran. Nothing is billed.
Keys: secret key; restricted key with scans:write.
Request
const result = await timbereye.testMode.runRefinements()curl -X POST https://api.timbereye.com/v1/test/refinements/run \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
-H "Idempotency-Key: $(uuidgen)"timbereye simulate refine --jsonResponse
// 200
{
"object": "simulated_refinement_run",
"livemode": false,
"claimed": 12,
"refined": 12,
"failed": 0
}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. |
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. |
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. |