Skip to content

Field Reference

Overview

This glossary lists recurring identifiers and fields across API v2. Use it when reading endpoint specifications to keep names consistent in your integrations.

Organization & Access

FieldDescriptionExample
slugOrganization identifier used in URLs and access tokens. Lowercase, unique per tenant.yanji-lab
org_idShorthand for organization slug returned in device data payloads.yanji-lab
organization_idInternal numeric primary key referenced in relational models. Usually hidden from API consumers.42

Projects

FieldDescriptionExample
project_idPublic identifier for a project. Appears in URLs: /projects/{project_id}/....greenhouse-alpha
project (object)Serializer representation of a project with project_id, name, and other metadata.{ "project_id": "cold-chain-east", "name": "Cold Chain East" }

Devices

FieldDescriptionExample
device_pkInternal integer primary key for a device. Used as {device_pk} in nested routes.128
device_idHardware identifier (IMEI, SN). Used when binding devices via safe code.868686000123456
agri_id (device)Platform-generated string ID assigned when the device is created. Prefix for factor IDs.d-1000-abcd
safe_codeFour-character code printed on hardware, required for binding.8K2P

Factors

FieldDescriptionExample
unitModbus slave ID (integer).1
addressRegister address (integer).0
data_indexOffset used when reading multiple registers.0
modbus_typeRegister type (holding, input, coil, discrete).holding
data_typeEncoding for the register value (int16, uint32, float, etc.).int16
data_endianByte order (ABCD, DCBA, BADC, CDAB).ABCD
data_factorMultiplier applied to raw data.0.1
data_deltaAdditive offset applied after scaling.-10
the_typeLogical factor type, matching definitions from /base/device-types/.temp
the_type_detailExpanded metadata for the_type (name, unit, icon).{ "name": "Temperature", "unit": "℃" }
agri_id (factor)Full factor identifier: <device_agri_id>-<unit>-<address><data_index>.d-1000-abcd-1-000

Data Payloads

FieldDescriptionExample
tUTC timestamp in seconds.1708070400
value / vNumeric reading for a factor. Some endpoints use value, others use v.25.6
project_idInjected into POST /devices/{device_pk}/data/ responses to show source project.greenhouse-alpha
org_idInjected into POST /devices/{device_pk}/data/ responses to show owning organization.yanji-lab

Access Control

FieldDescriptionExample
roleRole assigned to AccessConfig (owner, manager, operator, readonly).manager
all_projectsBoolean flag indicating whether a token/user can access every project.true
projectsExplicit list of project IDs allowed when all_projects=false.["greenhouse-alpha"]

Command Tokens

FieldDescriptionExample
tokenIdentifier returned by device/factor control endpoints, referencing an AgriCommand.cmd_01H98Y5EW8HV41ZQMD2D
cmd_typeCommand category (e.g., BYTES_ASCII, ON, OFF, FORWARD).BYTES_ASCII

Refer to this document whenever an endpoint references one of these fields to keep naming consistent across integrations.