Usage
Metering.
Usage for a month#
GET/v1/usage
Billable totals for a period.
Keys: secret key; restricted key with usage:read.
Parameters
| Field | Description |
|---|---|
periodstring, query | Month as YYYY-MM. Defaults to the current month. |
Request
const result = await timbereye.usage.retrieve()curl https://api.timbereye.com/v1/usage \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"timbereye usage get --jsonResponse
// 200
{
"object": "usage",
"livemode": true,
"period": "2027-02",
"refined_m3": 1284.6,
"photos": 37,
"commitment_m3": 2000
}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. |
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. |
List usage records#
GET/v1/usage/records
The individual metered results behind the totals, newest first.
Keys: secret key; restricted key with usage:read.
Parameters
| Field | Description |
|---|---|
periodstring, query | Only this month, YYYY-MM. |
limitinteger, query | Page size, 1 to 100. |
starting_afterstring, query | Opaque cursor: pass the next_cursor of the previous page. Results are ordered by (created_at, id). |
expand[]array of string, query | Replace an id field with the full object, e.g. expand[]=origin_place. Allowed values are listed on each resource. |
Request
for await (const record of timbereye.usage.listRecords()) {
// every page, one at a time
}curl https://api.timbereye.com/v1/usage/records \
-H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"timbereye usage records --jsonResponse
// 200
{
"object": "list",
"data": [
{
"id": "ur_4Tz7Kb",
"object": "usage_record",
"livemode": true,
"item_id": "itm_5Lw2Nc",
"scan_id": "scn_9a2Lk",
"unit": "refined_m3",
"quantity": 1.32,
"rule": "jas",
"period": "2027-02",
"voided_at": null,
"created_at": "2027-02-03T14:40:52Z"
}
],
"has_more": false,
"next_cursor": null
}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. |
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. |