Skip to the page
Docs menu

Docs API reference

Tag printing

QR tags to print for the Scale with QR tag and Count QR tags modes, label templates and Zebra (ZPL) or PDF print files. Tags are physical labels, so templates and batches belong to the organisation, not to test or live mode; a test key and a live key see the same ones. Only what a scan read (a tag's item_id, a batch's seen_count) is per mode.

The tag batch object#

Tags generated and printed together.

FieldDescription
idstringUnique identifier, prefixed tgb_.
objecttag_batchAlways tag_batch.
namestringDisplay name.
label_template_idstring, nullableThe template it prints with; null for the default.
schemesequential \| random \| listHow its short ids were chosen.
prefixstring, nullablesequential: the prefix.
startinteger, nullablesequential: the first counter value.
countintegerHow many tags.
first_short_idstringThe first tag's short id.
last_short_idstringThe last tag's short id.
fieldsobjectToken values.
fields.speciesstring, nullableValue of {species}.
fields.lengthstring, nullableValue of {length}.
fields.customstring, nullableValue of {custom}.
warningsarray of TagBatchWarningReuse of short ids already printed in this organisation.
seen_countintegerHow many of its tags are logs in the mode of the request (a scan in that mode read them). Test scans count only with a test key, live scans only with a live key.
created_atstringCreation time.

Create a label template#

POST/v1/label_templates

Creates a label design: stock size, margins, orientation, printer resolution, the short id's size, up to four text lines and an optional logo. The QR code is not sized here: it always prints with a 62 mm side, the size the SDKs measure with. A design whose code, 4-module quiet zone and text do not fit the stock is refused with 422 label_too_small.

Keys: secret key; restricted key with items:write.

Body

FieldDescription
name requiredstringDisplay name.
stockLabelStockThe label stock.
stock.width_mmnumberLabel width across the print head, in millimetres.
stock.height_mmnumberLabel length in the feed direction, in millimetres.
margins_mmLabelMarginsWhere nothing is printed, in millimetres. The code's quiet zone may overlap a margin (it is blank) but never leaves the label.
margins_mm.topnumberTop margin in millimetres.
margins_mm.rightnumberRight margin in millimetres.
margins_mm.bottomnumberBottom margin in millimetres.
margins_mm.leftnumberLeft margin in millimetres.
orientationportrait \| landscapeDefault portrait.
printer_dpi203 \| 300 \| 600Default 203.
short_idobjectThe printed short id.
short_id.size_mmnumberFont size of the printed short id in millimetres. Default 16.
linesarray of LabelTextLineUp to four lines. Default: one line, {batch} at 5 mm.
logoLabelLogoInput, nullableA logo. Thermal printers print black or nothing, so it is made one-bit at the printer's resolution.
logo.png_base64stringThe logo as a PNG, base64-encoded; at most 64 KB and 1,200 pixels on each side. Transparency prints as white. Required for a new logo.
logo.width_mmnumberPrinted width in millimetres; the height follows the picture's proportions. Default 30.
logo.thresholdintegerGrey levels below this print black. Default 128.
logo.ditherbooleanDiffuse the grey levels into dots (Floyd-Steinberg) instead of a hard threshold, for shaded logos. Default false.

Request

TypeScript
const result = await timbereye.labelTemplates.create({
    name: "Yard tags",
    stock: { widthMm: 101.6, heightMm: 152.4 },
    printerDpi: 203,
    shortId: { sizeMm: 16 },
    lines: [{ text: "{batch}", sizeMm: 5 }, { text: "{species} {length}", sizeMm: 5 }],
})
curl
curl -X POST https://api.timbereye.com/v1/label_templates \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Yard tags",
    "stock": { "width_mm": 101.6, "height_mm": 152.4 },
    "printer_dpi": 203,
    "short_id": { "size_mm": 16 },
    "lines": [
      { "text": "{batch}", "size_mm": 5 },
      { "text": "{species} {length}", "size_mm": 5 }
    ]
  }'
CLI
timbereye tags templates create \
  --name 'Yard tags' \
  --data '{"stock":{"width_mm":101.6,"height_mm":152.4},"printer_dpi":203,"short_id":{"size_mm":16},"lines":[{"text":"{batch}","size_mm":5},{"text":"{species} {length}","size_mm":5}]}' \
  --json

Response

200: a LabelTemplate object.

Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_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.
413invalid_request_error, payload_too_large: the upload is over the size limit (10 MB for multipart).
422invalid_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.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

List label templates#

GET/v1/label_templates

Returns your label templates, newest first.

Keys: secret key; restricted key with items:read.

Parameters

FieldDescription
limitinteger, queryPage size, 1 to 100.
starting_afterstring, queryOpaque cursor: pass the next_cursor of the previous page. Results are ordered by (created_at, id).

Request

TypeScript
for await (const printing of timbereye.labelTemplates.list()) {
    // every page, one at a time
}
curl
curl https://api.timbereye.com/v1/label_templates \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags templates list --json

Response

200: a LabelTemplateList object.

Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

Retrieve a label template#

GET/v1/label_templates/{id}

Returns one label template with the code's geometry at its printer and the computed layout.

Keys: secret key; restricted key with items:read.

Parameters

FieldDescription
id requiredstring, pathLabel template id.

Request

TypeScript
const result = await timbereye.labelTemplates.retrieve("lbt_8fR2kQ")
curl
curl https://api.timbereye.com/v1/label_templates/lbt_8fR2kQ \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags templates get lbt_8fR2kQ --json

Response

200: a LabelTemplate object.

Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

Update a label template#

PATCH/v1/label_templates/{id}

Changes a label template. Fields left out keep their value; logo: null removes the logo. Batches print with the template as it is when their print file is made.

Keys: secret key; restricted key with items:write.

Parameters

FieldDescription
id requiredstring, pathLabel template id.

Body

FieldDescription
namestringDisplay name.
stockLabelStockThe label stock.
stock.width_mmnumberLabel width across the print head, in millimetres.
stock.height_mmnumberLabel length in the feed direction, in millimetres.
margins_mmLabelMarginsWhere nothing is printed, in millimetres. The code's quiet zone may overlap a margin (it is blank) but never leaves the label.
margins_mm.topnumberTop margin in millimetres.
margins_mm.rightnumberRight margin in millimetres.
margins_mm.bottomnumberBottom margin in millimetres.
margins_mm.leftnumberLeft margin in millimetres.
orientationportrait \| landscapeLayout.
printer_dpi203 \| 300 \| 600Printer resolution.
short_idobjectThe printed short id.
short_id.size_mmnumberFont size of the printed short id in millimetres.
linesarray of LabelTextLineReplaces all the lines.
logoLabelLogoInput, nullableA logo. Thermal printers print black or nothing, so it is made one-bit at the printer's resolution.
logo.png_base64stringThe logo as a PNG, base64-encoded; at most 64 KB and 1,200 pixels on each side. Transparency prints as white. Required for a new logo.
logo.width_mmnumberPrinted width in millimetres; the height follows the picture's proportions. Default 30.
logo.thresholdintegerGrey levels below this print black. Default 128.
logo.ditherbooleanDiffuse the grey levels into dots (Floyd-Steinberg) instead of a hard threshold, for shaded logos. Default false.

Request

TypeScript
const result = await timbereye.labelTemplates.update("lbt_8fR2kQ", { printerDpi: 300, logo: null })
curl
curl -X PATCH https://api.timbereye.com/v1/label_templates/lbt_8fR2kQ \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"printer_dpi":300,"logo":null}'
CLI
timbereye tags templates update lbt_8fR2kQ \
  --data '{"printer_dpi":300,"logo":null}' \
  --json

Response

200: a LabelTemplate object.

Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_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.
413invalid_request_error, payload_too_large: the upload is over the size limit (10 MB for multipart).
422invalid_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.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

Delete a label template#

DELETE/v1/label_templates/{id}

Deletes a label template. A template a tag batch was made with is kept: 409 label_template_in_use (the batch prints with it and names it). Duplicate it to make a changed one.

Keys: secret key; restricted key with items:write.

Parameters

FieldDescription
id requiredstring, pathLabel template id.

Request

TypeScript
const result = await timbereye.labelTemplates.delete("lbt_8fR2kQ")
curl
curl -X DELETE https://api.timbereye.com/v1/label_templates/lbt_8fR2kQ \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags templates delete lbt_8fR2kQ --yes --json

Response

200: a LabelTemplateDeleted object.

Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_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.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

GET/v1/label_templates/{id}/test_label

A print file with one label of this template, short id TEST0 and the test payload 00000000-0000-4000-8000-0000000TEST0, after a label with a 62 mm ruler bar. Print it, measure the bar and the code with a ruler, then throw it away: it belongs to no batch.

Keys: secret key; restricted key with items:read.

Parameters

FieldDescription
id requiredstring, pathLabel template id.
format requiredzpl \| pdf, queryzpl (ZPL II for Zebra printers) or pdf.

Request

TypeScript
const result = await timbereye.labelTemplates.testLabel("lbt_8fR2kQ", { format: "zpl" })
curl
curl "https://api.timbereye.com/v1/label_templates/lbt_8fR2kQ/test_label?format=zpl" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags templates test-label lbt_8fR2kQ --format zpl --json

Response

200: a PrintFile object.

Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

Create a tag batch#

POST/v1/tag_batches

Generates tags to print. Each tag's payload is a random UUID, upper case, whose last five characters are its short id: the only text printed on the tag. Short ids are sequential (prefix and counter, A0001, A0002, ...), random, or the list you give. They use the digits and the letters A-Z except I, L and O. A short id repeated within the batch is refused (422 short_id_duplicate); one already printed in this organisation is allowed and reported in warnings. At most 1,000 tags per batch. Tags are stored, so GET /tag_batches/{id}/tags can say which a scan has read. Free.

Keys: secret key; restricted key with items:write.

Body

FieldDescription
namestringDisplay name, printed where a line has {batch}. Default Tags and the date.
scheme requiredsequential \| random \| listHow short ids are chosen. sequential: prefix and a zero-padded counter from start. random: drawn from the alphabet, avoiding ids this account already printed. list: short_ids.
countintegerHow many tags (sequential and random).
prefixstringsequential: 0 to 4 characters before the counter. Default none.
startintegersequential: the first counter value. Default 1.
short_idsarray of stringlist: the short ids, 5 characters each, digits and A-Z except I, L and O (lower case is accepted and upper-cased). A repeat is refused.
label_template_idstring, nullableThe template to print with; none prints with the default.
fieldsTagBatchFieldsValues for the template's tokens, the same on every tag of the batch.
fields.speciesstring, nullablePrinted where a line has {species}.
fields.lengthstring, nullablePrinted where a line has {length}, as you write it (for example 5.8 m).
fields.customstring, nullablePrinted where a line has {custom}.

Request

TypeScript
const result = await timbereye.tagBatches.create({
    name: "North yard, March",
    scheme: "sequential",
    prefix: "A",
    start: 1,
    count: 200,
    labelTemplateId: "lbt_8fR2kQ",
})
curl
curl -X POST https://api.timbereye.com/v1/tag_batches \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "North yard, March",
    "scheme": "sequential",
    "prefix": "A",
    "start": 1,
    "count": 200,
    "label_template_id": "lbt_8fR2kQ"
  }'
CLI
timbereye tags create \
  --name 'North yard, March' \
  --prefix A \
  --start 1 \
  --count 200 \
  --data '{"scheme":"sequential","label_template_id":"lbt_8fR2kQ"}' \
  --json

Response

JSON
// 200
{
  "id": "tgb_3mQ9vX",
  "object": "tag_batch",
  "name": "North yard, March",
  "label_template_id": "lbt_8fR2kQ",
  "scheme": "sequential",
  "prefix": "A",
  "start": 1,
  "count": 200,
  "first_short_id": "A0001",
  "last_short_id": "A0200",
  "fields": { "species": null, "length": null, "custom": null },
  "warnings": [],
  "seen_count": 0,
  "created_at": "2027-03-02T08:15:00Z"
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
409invalid_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.
413invalid_request_error, payload_too_large: the upload is over the size limit (10 MB for multipart).
422invalid_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.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

List tag batches#

GET/v1/tag_batches

Returns your tag batches, newest first.

Keys: secret key; restricted key with items:read.

Parameters

FieldDescription
limitinteger, queryPage size, 1 to 100.
starting_afterstring, queryOpaque cursor: pass the next_cursor of the previous page. Results are ordered by (created_at, id).

Request

TypeScript
for await (const printing of timbereye.tagBatches.list()) {
    // every page, one at a time
}
curl
curl https://api.timbereye.com/v1/tag_batches \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags list --json

Response

JSON
// 200
{
  "object": "list",
  "data": [
    {
      "id": "tgb_3mQ9vX",
      "object": "tag_batch",
      "name": "North yard, March",
      "label_template_id": "lbt_8fR2kQ",
      "scheme": "sequential",
      "prefix": "A",
      "start": 1,
      "count": 200,
      "first_short_id": "A0001",
      "last_short_id": "A0200",
      "fields": {
        "species": null,
        "length": null,
        "custom": null
      },
      "warnings": [],
      "seen_count": 0,
      "created_at": "2027-03-02T08:15:00Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

Retrieve a tag batch#

GET/v1/tag_batches/{id}

Returns one tag batch, with how many of its tags a scan has read.

Keys: secret key; restricted key with items:read.

Parameters

FieldDescription
id requiredstring, pathTag batch id.

Request

TypeScript
const result = await timbereye.tagBatches.retrieve("tgb_3mQ9vX")
curl
curl https://api.timbereye.com/v1/tag_batches/tgb_3mQ9vX \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags get tgb_3mQ9vX --json

Response

JSON
// 200
{
  "id": "tgb_3mQ9vX",
  "object": "tag_batch",
  "name": "North yard, March",
  "label_template_id": "lbt_8fR2kQ",
  "scheme": "sequential",
  "prefix": "A",
  "start": 1,
  "count": 200,
  "first_short_id": "A0001",
  "last_short_id": "A0200",
  "fields": { "species": null, "length": null, "custom": null },
  "warnings": [],
  "seen_count": 0,
  "created_at": "2027-03-02T08:15:00Z"
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

List a batch's tags#

GET/v1/tag_batches/{id}/tags

The batch's tags in print order, each with the log (item_id) and group a scan made of it. A tag that was printed but never read has item_id: null.

Keys: secret key; restricted key with items:read.

Parameters

FieldDescription
id requiredstring, pathTag batch id.
limitinteger, queryPage size, 1 to 100.
starting_afterstring, queryOpaque cursor: pass the next_cursor of the previous page. Results are ordered by (created_at, id).

Request

TypeScript
for await (const printing of timbereye.tagBatches.listTags("tgb_3mQ9vX")) {
    // every page, one at a time
}
curl
curl https://api.timbereye.com/v1/tag_batches/tgb_3mQ9vX/tags \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags list-tags tgb_3mQ9vX --json

Response

JSON
// 200
{
  "object": "list",
  "data": [
    {
      "object": "tag",
      "payload": "7F3C9A12-5B0E-4D21-9C44-1A2B3C4A0001",
      "short_id": "A0001",
      "position": 1,
      "batch_id": "tgb_3mQ9vX",
      "item_id": "itm_5Jw2Rt",
      "group_id": "grp_7QxV3m"
    },
    {
      "object": "tag",
      "payload": "0B6D51E7-28C4-4F9A-B1D3-6E5F708A0002",
      "short_id": "A0002",
      "position": 2,
      "batch_id": "tgb_3mQ9vX",
      "item_id": null,
      "group_id": null
    }
  ],
  "has_more": true,
  "next_cursor": "2"
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.

Download a batch's print file#

GET/v1/tag_batches/{id}/print_file

The batch's labels as ZPL II for a Zebra printer (one label per tag, at the template's printer resolution) or as a PDF (one label per page at the stock's size, or tiled on A4 or Letter sheets). The file is in the response body: data is the ZPL text, or the PDF in base64. A ZPL file starts with a label carrying a 62 mm ruler bar; a PDF with the same bar and an "Actual size" reminder. qr gives the code's achieved side: 62.0 mm in a PDF, the closest whole-dot size on a Zebra.

Keys: secret key; restricted key with items:read.

Parameters

FieldDescription
id requiredstring, pathTag batch id.
format requiredzpl \| pdf, queryzpl (ZPL II for Zebra printers) or pdf.
layoutlabels \| a4 \| letter, queryPDF only: labels (one per page, the stock's size; default), a4 or letter (tiled, with corner marks for cutting).
headerboolean, queryStart with the ruler label (ZPL) or page (PDF labels layout). Default true. Sheets always carry the ruler.

Request

TypeScript
const result = await timbereye.tagBatches.printFile("tgb_3mQ9vX", { format: "zpl" })
curl
curl "https://api.timbereye.com/v1/tag_batches/tgb_3mQ9vX/print_file?format=zpl" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye tags download tgb_3mQ9vX --format zpl --json

Response

200: a PrintFile object.

Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
422invalid_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.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.