CropPath for developers

API reference

Schemas

Every object the API reads or returns, by name.

AccountLinkAccept

object

Properties
NameTypeDescription
token
required
string
password
required
string

A new account's or a reset's new password (12 to 1,024 characters); for an email that already has an account, that account's password.

display_name
optional
string | null

A new account's name; ignored for an existing account.

AccountLinkCreated

object

Properties
NameTypeDescription
id
required
integer
link
required
string

The link, shown this once: the token is in the URL fragment (/login#invite=... or /login#reset=...), so it never reaches a server log. Only its SHA-256 is stored.

expires_at
required
number

Unix seconds: 72 hours after creation for an invitation, 24 hours for a recovery link.

emailed
required
boolean

#270. Whether CropPath queued this link's email to its person. False when this server sends no email, or when it cannot email this address (one SMTP cannot carry): the link must then be passed on by hand.

AccountLinkInfo

object

Properties
NameTypeDescription
purpose
required
"invite" | "reset" | "admin_recovery"
company
required
string

The company's name.

role
required
"tenant_admin" | "operator" | "auditor" | "lab" | "agronomist"
email
required
string

The account's email; it cannot be changed on the page.

expires_at
required
number

Unix seconds.

account_exists
required
boolean

Whether the email already has a CropPath account: the invitee then signs in with that account's password instead of choosing one.

AccountLinkToken

object

Properties
NameTypeDescription
token
required
string

The token from the link's fragment.

AddressToCode

object

A record whose address is not coded by official administrative unit codes yet (#273, D5): the lot's packing house (facility), its growing area (growing_area) or the company profile (company_profile, in Viet Nam; code null, a company has one).

Properties
NameTypeDescription
kind
required
"facility" | "growing_area" | "company_profile"
code
required
string | null

The facility or growing-area code; null for the company profile.

AdminHealth

Health & object

What /healthz reports (Health) plus the database, the external timestamp authority and the issuer key store, for the admin health page. Each certificate's not_after is written in UTC with Z (e.g. 2030-01-02T03:04:05Z).

AdminInvitationCreate

object

Properties
NameTypeDescription
email
required
string

The first admin's email: their sign-in name, not checked by any email.

display_name
optional
string | null

Proposed as the new account's name; the invitee may change it.

reason
optional
string | null

Why (one line). Required when the company already has an admin (admin recovery); written to the company's activity log.

AdminUnitCommune

object

A commune-level unit: a commune (xã), a ward (phường) or a special zone (đặc khu).

Properties
NameTypeDescription
code
required
string

Its 5-digit official code.

name
required
string

Its official name, with its unit word ("Xã", "Phường", "Đặc khu"), in Vietnamese.

kind
required
"xã" | "phường" | "đặc khu"

AdminUnitCommunes

object

One province of a catalog version and its communes, by code.

Properties
NameTypeDescription
version
required
string

The catalog version: vn- and the date of the official list it holds. Store it with every code taken from it.

valid_from
required
string (date)

The day from which this version is the one for new input: the effective date of the newest resolution it reflects.

source
required
AdminUnitSource
province
required
AdminUnitProvince
communes
required
array<AdminUnitCommune>

AdminUnitProvince

object

A province-level unit: a province (tỉnh) or a centrally governed city (thành phố trung ương).

Properties
NameTypeDescription
code
required
string

Its 2-digit official code.

name
required
string

Its official name, with its unit word ("Tỉnh", "Thành phố"), in Vietnamese.

kind
required
"tỉnh" | "thành phố trung ương"

AdminUnitProvinces

object

The provinces of one catalog version, by code.

Properties
NameTypeDescription
version
required
string

The catalog version: vn- and the date of the official list it holds. Store it with every code taken from it.

valid_from
required
string (date)

The day from which this version is the one for new input: the effective date of the newest resolution it reflects.

source
required
AdminUnitSource
provinces
required
array<AdminUnitProvince>

AdminUnitSource

object

Who publishes the official list, credited with it.

Properties
NameTypeDescription
publisher
required
string
url
required
string (uri)

Agronomist

object

#351: a row of the platform's agronomist registry (control/agronomists.py). Personal data: a platform admin reads every row, the person their own; never on a public read.

Properties
NameTypeDescription
id
required
integer
user_id
required
integer

The account.

email
required
string
legal_name
required
string

The name a signature names (snapshotted into each attestation).

organisation
required
string
qualification
required
string | null
contact
required
string | null
note
required
string | null
status
required
"pending" | "verified" | "suspended"

pending until a platform admin verified the person outside the platform; only a verified agronomist signs; suspended signs nothing.

created_at
required
number
updated_at
required
number
verified_by
required
string | null
verified_at
required
number | null
suspended_by
required
string | null
suspended_at
required
number | null
suspend_reason
required
string | null

AgronomistCreate

object

Properties
NameTypeDescription
email
required
string

The account's email (the account must exist).

legal_name
required
string
organisation
required
string
qualification
optional
string | null
contact
optional
string | null
note
optional
string | null

AgronomistPage

object

Properties
NameTypeDescription
items
required
array<Agronomist>
next_before
required
integer | null

Pass as before for the next page.

AgronomistSuspend

object

Properties
NameTypeDescription
reason
required
string

AgronomistVerify

object

Properties
NameTypeDescription
note
optional
string | null

AgronomyAdvisory

object

#351: advice in words only: no digit (amounts and formulas come from a lab test).

Properties
NameTypeDescription
text
optional
AgronomyLocalizedText
attachment_sha256
optional
string
requires_lab_test
optional
true

AgronomyEt0

object

Properties
NameTypeDescription
krs
optional
number

FAO-56 eq. 50 adjustment coefficient. Sanity bounds only: the value is the agronomist's, never a CropPath default.

effective_rain_fraction
optional
number

Share of the rain counted as effective. Sanity bounds only: the value is the agronomist's, never a CropPath default.

AgronomyFallbackRule

object

Properties
NameTypeDescription
rule_id
required
integer
rule_name
required
string
device_id
required
string
zones
required
array<integer>
reason
required
string | null

AgronomyHome

object

#351: the agronomist's home in the selected company.

Properties
NameTypeDescription
generated_at
required
number
now
required
object

The drafts waiting for a signature, oldest first (at most 20).

today
required
object

#352: today's control work resting on sheets the caller signed: the programs composed for today that cite one (newest first, at most 20) and the rules bound to one whose zones are on their fallback schedule.

status
required
object

AgronomyLocalizedText

object

#351: a text in each language of the console (all three are needed to sign).

Properties
NameTypeDescription
vi
optional
string
en
optional
string
zh-Hans
optional
string

AgronomyPhotoperiod

object

Properties
NameTypeDescription
start
optional
string (date)
end
optional
string (date)
night_start_local
optional
string
duration_h
optional
number

Lamp hours a night. Sanity bounds only: the value is the agronomist's, never a CropPath default.

min_confirmed_h
optional
number

Confirmed hours needed, at most the duration. Sanity bounds only: the value is the agronomist's, never a CropPath default.

AgronomySalinity

object

#351: electrical conductivity in mS/cm only. A member named g_per_l (anywhere in the body) is refused: g/L is never used or converted.

Properties
NameTypeDescription
water_ec_limit_ms_cm
optional
number

Irrigation water EC limit, mS/cm. Sanity bounds only: the value is the agronomist's, never a CropPath default.

soil_ec_limit_ms_cm
optional
number

Soil EC limit, mS/cm. Sanity bounds only: the value is the agronomist's, never a CropPath default.

soil_ec_basis
optional
"bulk" | "pore"
action
optional
"block" | "alert"

AgronomySheet

object

#351: an agronomic input sheet of the company (control/sheets.py).

Properties
NameTypeDescription
id
required
integer
series_key
required
string

<crop>:<variety>:<province>; * for every variety or province.

crop
required
string

A code of the crop registry.

variety
required
string
province_code
required
string
version
required
integer
status
required
"draft" | "signed" | "superseded" | "revoked"
valid_from
required
string (date) | null (date)
valid_to
required
string (date) | null (date)
body_sha256
required
string

The SHA-256 of the sheet's JCS document (GET .../document): what a signature covers.

created_by
required
string
created_at
required
number
updated_by
required
string | null
updated_at
required
number
copied_from_id
required
integer | null
supersedes_id
required
integer | null
superseded_by_id
required
integer | null
signed_at
required
number | null
superseded_at
required
number | null
revoked_at
required
number | null
revoked_by
required
string | null
revoke_reason
required
string | null
body
required
AgronomySheetBody
attestation
required
AgronomySheetAttestation | null

AgronomySheetAttestation

object

#351: a signature (append-only): who signed (snapshots of the registry row), the statement agreed to and the hash signed. An in-app attestation recorded by CropPath, not a detached digital signature (ADR 0014).

Properties
NameTypeDescription
id
required
integer
agronomist_id
required
integer
user_id
required
integer
legal_name
required
string
organisation
required
string
statement_version
required
string
statement_text_sha256
required
string
body_sha256
required
string
signed_at
required
number
second_factor_at
required
number

When the session last proved a second factor.

AgronomySheetBody

object

#351: the agritrace.agronomy-sheet/1 body (control/sheets.py). Every value is optional in a draft and none has a default: CropPath ships no agronomic number.

Properties
NameTypeDescription
stages
optional
array<AgronomyStage>
stress_windows
optional
array<AgronomyStressWindow>
salinity
optional
AgronomySalinity
et0
optional
AgronomyEt0
lighting
optional
object
advisory
optional
object
references
optional
array<object>

AgronomySheetCreate

object

Properties
NameTypeDescription
crop
required
string
variety
optional
string

* (the default) for every variety; no :.

province_code
optional
string

* (the default) for every province.

valid_from
optional
string (date) | null (date)
valid_to
optional
string (date) | null (date)
body
optional
AgronomySheetBody

AgronomySheetDocument

object

Properties
NameTypeDescription
id
required
integer
spec
required
"agritrace.agronomy-sheet/1"
document
required
string

The RFC 8785 (JCS) text of {spec, tenant, series_key, version, valid_from, valid_to, body}: hash its UTF-8 bytes to check sha256.

sha256
required
string
statement
required
object

AgronomySheetPage

object

Properties
NameTypeDescription
items
required
array<AgronomySheetSummary>
next_before
required
integer | null

AgronomySheetRevoke

object

Properties
NameTypeDescription
reason
required
string

AgronomySheetSign

object

Properties
NameTypeDescription
body_sha256
required
string
statement_version
required
string

AgronomySheetSummary

object

Properties
NameTypeDescription
id
required
integer
series_key
required
string

<crop>:<variety>:<province>; * for every variety or province.

crop
required
string

A code of the crop registry.

variety
required
string
province_code
required
string
version
required
integer
status
required
"draft" | "signed" | "superseded" | "revoked"
valid_from
required
string (date) | null (date)
valid_to
required
string (date) | null (date)
body_sha256
required
string

The SHA-256 of the sheet's JCS document (GET .../document): what a signature covers.

created_at
required
number
updated_at
required
number
signed_at
required
number | null
superseded_at
required
number | null
revoked_at
required
number | null
signed_by
required
string | null

The signer's legal name.

AgronomySheetUpdate

object

Each member given replaces the draft's; one left out stays.

Properties
NameTypeDescription
valid_from
optional
string (date) | null (date)
valid_to
optional
string (date) | null (date)
body
optional
AgronomySheetBody

AgronomyStage

object

#351: a crop stage. Every member is optional in a draft; signing needs code, name, start and end, and a value given in one stage given in every stage.

Properties
NameTypeDescription
code
optional
string
name
optional
AgronomyLocalizedText
start
optional
string (date)
end
optional
string (date)
kc
optional
number

Crop coefficient. Sanity bounds only: the value is the agronomist's, never a CropPath default.

p_depletion
optional
number

FAO-56 depletion fraction p. Sanity bounds only: the value is the agronomist's, never a CropPath default.

root_depth_m
optional
number

Effective root depth, metres. Sanity bounds only: the value is the agronomist's, never a CropPath default.

schedule_mm_per_day
optional
number

Scheduled irrigation depth, mm per day. Sanity bounds only: the value is the agronomist's, never a CropPath default.

moisture_lower_pct
optional
number

Soil moisture band, lower edge (%), below the upper. Sanity bounds only: the value is the agronomist's, never a CropPath default.

moisture_upper_pct
optional
number

Soil moisture band, upper edge (%). Sanity bounds only: the value is the agronomist's, never a CropPath default.

moisture_basis
optional
object

What the band is read on.

AgronomyStressWindow

object

Properties
NameTypeDescription
start
optional
string (date)
end
optional
string (date)
action
optional
"no_irrigation" | "cap_fraction" | "max_mm_per_day"
fraction
optional
number

With cap_fraction: the share of the scheduled depth kept. Sanity bounds only: the value is the agronomist's, never a CropPath default.

max_mm_per_day
optional
number

With max_mm_per_day: the cap, mm per day. Sanity bounds only: the value is the agronomist's, never a CropPath default.

note
optional
string

AgronomyTodayProgram

object

Properties
NameTypeDescription
id
required
integer
device_id
required
string
status
required
"proposed" | "approved" | "rejected" | "dispatched" | "superseded" | "failed" | "blocked" | "expired" | "withdrawn"
proposed_at
required
number
sheets
required
array<object>

AlarmAck

object

Properties
NameTypeDescription
note
optional
string

Optional: what the person did or will do.

AlarmCounts

object

#361: how many open alarms the caller may read, over every page: urgent, warning and notice count the ones not shelved, shelved the shelved ones of every priority.

Properties
NameTypeDescription
urgent
required
integer
warning
required
integer
notice
required
integer
shelved
required
integer

AlarmDetail

object

#361: an alarm (AlarmView) with its history: events, oldest first, at most the 100 newest (events_truncated when older ones exist).

Properties
NameTypeDescription
id
required
integer
kind
required
string

The catalog kind (catalog v1: command_refused_security, controller_fault, delivered_over_limit, sheet_hash_mismatch, controller_offline, program_not_installed, command_refused_site, run_no_water, step_missed, rule_blocked, salinity_block, rule_on_fallback, probe_stale_in_use, moisture_outside_band). The catalog grows under management of change (the philosophy), so a client words an unknown kind by its token.

catalog_version
required
integer

The catalog version the alarm was raised under.

priority
required
"urgent" | "warning" | "notice"
state
required
"active_unacked" | "active_acked" | "cleared_unacked" | "shelved" | "closed"
raised_at
required
string (date-time)

When the condition was first raised (after its on-delay).

last_active_at
required
string (date-time)

When the condition was last seen true.

cleared_at
required
string (date-time) | null (date-time)

When the condition returned to normal (after its clear-delay); null while active. A re-raise within 30 minutes of clearing (not closed) reuses the alarm and empties it again.

closed_at
required
string (date-time) | null (date-time)
occurrences
required
integer

How many times the condition was raised on this alarm (chatter control).

acked
required
object | null
shelved
required
object | null

The current shelving, null when the alarm is not shelved (or its shelving ended).

subject
required
object
detail
required
object

Facts the platform observed (the command id and its refusal reason, the measured litres and the command's max_volume_l, the controller's faults, when its gateway was last heard), at most 2 KB, never coordinates.

response_anchor
required
string

The anchor of the alarm's documented response in the alarm philosophy (the kind).

under
required
integer | null

Suppression by design, computed when read: the id of the open controller_offline alarm of the same controller this alarm is shown under; null otherwise.

events
required
array<AlarmEvent>
events_truncated
required
boolean

AlarmEvent

object

#361: one change of an alarm's state (alarm_events, append-only).

Properties
NameTypeDescription
at
required
string (date-time)
event
required
"raised" | "reraised" | "cleared" | "acked" | "shelved" | "unshelved" | "shelve_expired" | "closed"
actor
required
string | null

The person (display name, or sign-in when they have none), or system for the evaluator. Null for a person when an agronomist reads it (#363).

reason
required
string | null

A code only: for shelved, the shelving's reason code (maintenance, technician_called, known_issue, equipment_off or other); null for every other event. The acknowledgement's note and the shelving's note are the alarm's (acked.note, shelved.note), never the history's, so they can be erased with the person's data.

AlarmPage

object

Properties
NameTypeDescription
items
required
array<AlarmView>
next_cursor
required
string | null

The next page's cursor; null on the last page.

counts
required
AlarmCounts | null

With state=open: the open alarms the caller may read, by priority, over every page (not this page only); null with state=closed.

AlarmShelve

object

Properties
NameTypeDescription
until
required
string (date-time)

When the shelving ends: in the future, and at most 12 hours ahead for an urgent alarm, 72 hours for a warning or a notice.

reason
required
"maintenance" | "technician_called" | "known_issue" | "equipment_off" | "other"
note
optional
string

Free text; required when reason is other.

AlarmView

object

#361 (ADR 0015, the alarm philosophy): one alarm of the company, a condition with a lifecycle (control/cockpit/alarms). Its state is derived from the stored times: closed once closed (cleared and acknowledged, or a notice cleared), else shelved while shelved.until is ahead, else active_unacked, active_acked or cleared_unacked. Times are RFC 3339 UTC.

Properties
NameTypeDescription
id
required
integer
kind
required
string

The catalog kind (catalog v1: command_refused_security, controller_fault, delivered_over_limit, sheet_hash_mismatch, controller_offline, program_not_installed, command_refused_site, run_no_water, step_missed, rule_blocked, salinity_block, rule_on_fallback, probe_stale_in_use, moisture_outside_band). The catalog grows under management of change (the philosophy), so a client words an unknown kind by its token.

catalog_version
required
integer

The catalog version the alarm was raised under.

priority
required
"urgent" | "warning" | "notice"
state
required
"active_unacked" | "active_acked" | "cleared_unacked" | "shelved" | "closed"
raised_at
required
string (date-time)

When the condition was first raised (after its on-delay).

last_active_at
required
string (date-time)

When the condition was last seen true.

cleared_at
required
string (date-time) | null (date-time)

When the condition returned to normal (after its clear-delay); null while active. A re-raise within 30 minutes of clearing (not closed) reuses the alarm and empties it again.

closed_at
required
string (date-time) | null (date-time)
occurrences
required
integer

How many times the condition was raised on this alarm (chatter control).

acked
required
object | null
shelved
required
object | null

The current shelving, null when the alarm is not shelved (or its shelving ended).

subject
required
object
detail
required
object

Facts the platform observed (the command id and its refusal reason, the measured litres and the command's max_volume_l, the controller's faults, when its gateway was last heard), at most 2 KB, never coordinates.

response_anchor
required
string

The anchor of the alarm's documented response in the alarm philosophy (the kind).

under
required
integer | null

Suppression by design, computed when read: the id of the open controller_offline alarm of the same controller this alarm is shown under; null otherwise.

Alert

object

Properties
NameTypeDescription
id
required
integer
tenant
required
string | null
kind
required
string
severity
required
string
device_id
required
string | null
envelope_id
required
string | null
detail
required
object

Shape depends on kind (for example reasons, or from and to for a sequence gap).

created_at
required
number

Unix seconds.

resolved_at
required
number | null

Unix seconds; null while open.

AlertResolution

object

Properties
NameTypeDescription
note
optional
string | null

Why the alert is resolved, at most 500 characters (after trimming). Kept in the audit row of the request, not on the alert.

AnchorEvidenceRecord

object

INTEGRITY-2 (#202): an evidence envelope's record in its day's evidence tree, fields in encoding order. It names no device: the SHA-256 of the stored body commits to the device and its sequence number.

Properties
NameTypeDescription
id
required
string

The envelope id (the EPCIS eventID without urn:uuid:).

received_at
required
number

Reception time, Unix seconds (encoded as binary64).

payload_sha256
required
string

SHA-256 of the stored envelope body as UTF-8.

AnchorInclusionProof

object

INTEGRITY-2 (#202): the inclusion proof of one record in its day's anchor. Recompute the leaf from record (the canonical encoding of /developers/downloads/integrity-anchors.md), follow path (RFC 9162 section 2.1.3.2, leaf side first) to the anchor's root of kind (seal_root or evidence_root), then the anchor from its roots; compare the anchor with the one GET /v1/public/anchors publishes for day (/developers/downloads/verify_anchors.py proof does all of it). included is false when the record as stored today is not among the anchored ones (it was changed after its day was anchored); path is then empty.

Properties
NameTypeDescription
kind
required
"seal" | "evidence"
day
required
string
record
required
AnchorSealRecord | AnchorEvidenceRecord

The record's fields in encoding order: an AnchorSealRecord for seal, an AnchorEvidenceRecord for evidence.

leaf_hash
required
string
included
required
boolean
leaf_index
required
integer | null
tree_size
required
integer
path
required
array<string>
anchor
required
IntegrityAnchor

AnchorSealRecord

object

INTEGRITY-2 (#202): a lot seal's record in its day's seal tree, fields in encoding order.

Properties
NameTypeDescription
manifest_sha256
required
string

The seal's manifest hash, as the public lot record shows it.

sealed_at
required
number

Seal time, Unix seconds (encoded as binary64).

fruit_count
required
integer
event_count
required
integer

Announcement

object

Properties
NameTypeDescription
id
required
integer
text
required
string

Plain text, one line.

level
required
"info" | "warning"
starts_at
required
number

Shown from this time (seconds since 1970, UTC).

ends_at
required
number | null

Shown until this time; null until expired.

state
required
"live" | "scheduled" | "ended"

scheduled before starts_at; ended once expired or past ends_at.

created_at
required
number
created_by
required
string
expired_at
required
number | null
expired_by
required
string | null

AnnouncementCreate

object

Properties
NameTypeDescription
text
required
string

1 to 500 characters after trimming, one line, plain text.

level
optional
"info" | "warning"
starts_at
optional
number | null

When it starts showing (default now; a past time means now); at most a year ahead.

ends_at
optional
number | null

When it stops showing: later than the start and at most a year after it; null shows it until expired.

AnnouncementPage

object

Properties
NameTypeDescription
items
required
array<Announcement>
next_cursor
required
string | null

The next page's cursor; null on the last.

ApiToken

object

A machine API token of the tenant as the admin console lists it: never the token itself, never its hash (only its SHA-256 is stored; the token is shown once, by POST /v1/api-tokens). Unix seconds.

Properties
NameTypeDescription
id
required
integer
name
required
string

The operator's label (not unique).

role
required
"platform_admin" | "tenant_admin" | "operator" | "lab" | "auditor"

The role the token acts with (tokens made with the users CLI may hold any role).

created_by
required
string | null

Who created it: a user's email, or cli.

created_at
required
number
last_used_at
required
number | null

The last authenticated use, to the minute; null: never.

expires_at
required
number | null

null: never expires.

revoked_at
required
number | null
revoke_reason
required
string | null
revoked_by
required
string | null
status
required
"active" | "expired" | "revoked"

At the server clock: revoked, else expired once expires_at passed, else active.

ApiTokenCreate

object

role: operator, auditor or tenant_admin (platform_admin and lab tokens are made with the users CLI only). expires_in_days: whole days from 1 to 3650; absent or null, the token never expires.

Properties
NameTypeDescription
name
required
string
role
required
"tenant_admin" | "operator" | "auditor"
expires_in_days
optional
integer | null

ApiTokenCreated

object

The new token and, in secret, the token itself: this response is the only place it ever appears (Authorization: Bearer <secret>). Store it now; a lost token is revoked and replaced.

Properties
NameTypeDescription
token
required
ApiToken
secret
required
string

ApiTokenPage

object

Properties
NameTypeDescription
items
required
array<ApiToken>
next_cursor
required
string | null

The next page's cursor; null on the last.

ApiTokenRevoke

object

Properties
NameTypeDescription
reason
required
string

Why it is revoked, one line (e.g. leaked, no longer used).

ApprovalRequest

object

INTEGRITY-3 (#203). A critical action one admin asked for, waiting for (or decided by) another admin of the company. body is the action's JSON body (public keys, grading rules or a yes/no: never a secret). status expired: it was not decided within 72 hours and can no longer be.

Properties
NameTypeDescription
id
required
integer
action
required
string

The action's audit action, e.g. key.create, grading_rule.update.

method
required
"POST" | "PUT"
path
required
string

The path the action calls.

body
required
object

The action's JSON body.

status
required
"pending" | "approved" | "rejected" | "expired"
requested_by
required
string

Who asked (their sign-in email).

requested_by_user_id
required
integer
requested_at
required
number

Unix seconds.

expires_at
required
number

Unix seconds: a pending request can be decided until then.

decided_by
required
string | null
decided_as
required
"company_admin" | "platform_support" | null

platform_support: CropPath support decided, acting for the company.

decided_at
required
number | null
reason
required
string | null

A rejection's reason.

ApprovalRequestApproved

object

Properties
NameTypeDescription
request
required
ApprovalRequest
result
required
object

The action's own answer, as if it had been called directly.

ApprovalRequestCreate

object

Properties
NameTypeDescription
method
required
"POST" | "PUT"
path
required
string

The critical action's path, without a query.

body
optional
object

The action's JSON body (default {}).

ApprovalRequestPage

object

Properties
NameTypeDescription
items
required
array<ApprovalRequest>
next_cursor
required
string | null

The next page's cursor; null on the last.

ApprovalRequestRejection

object

Properties
NameTypeDescription
reason
optional
string

AreaMassBalance

object

Harvested against shipped kg of a growing area in a season, across all tenants (aggregates only).

Properties
NameTypeDescription
growing_area
required
string
season
required
string
harvested_kg
required
number

Accepted harvest and receive envelopes (as the volume) plus the self-declared harvest declarations of the season.

declared_kg
required
number

Of which tenant-entered harvest declarations (source self_declared).

shipped_kg
required
number

Packed net mass of the area's packed lots of the season.

packed_lots
required
integer
violation
required
"harvest_not_declared" | "shipped_exceeds_harvest" | null

harvest_not_declared: nothing declared; shipped_exceeds_harvest: more packed than harvested; null when the balance holds.

AttachmentPeaks

object

Waveform peaks: n buckets of [min, max] (normalised to -1..1) over all channels.

Properties
NameTypeDescription
sha256
required
string
n
required
integer

Buckets returned.

channels
required
integer
sample_rate
required
integer
frames
required
integer
duration_s
required
number
peaks
required
array<array<number>>

AttachmentStored

object

An uploaded blob as stored for its owner.

Properties
NameTypeDescription
sha256
required
string
media_type
required
"application/pdf" | "audio/wav" | "image/jpeg" | "image/png"
size
required
integer

AuditEntry

object

One append-only audit row. No column ever holds a password, a session, API or CSRF token, a cookie or a raw IP address.

Properties
NameTypeDescription
id
required
integer

Increasing row id; the list is ordered by it, newest first.

at
required
number

Unix seconds.

actor
required
string | null

The principal's user (email, token:<name> or legacy user); null for a failed login.

tenant
required
string | null
action
required
string

For example auth.login, auth.logout, auth.password.change, envelope.review or device.command.issue; .failed is appended when the request answered 400 or more.

entity
required
string

user, session, envelope or device.

entity_id
required
string | null

The record's id; for a failed login an HMAC of the normalized email, never the email.

before_hash
required
string | null

SHA-256 hex of the canonical JSON (sorted keys, compact) of the changed fields' prior state; null when no existing record changed or the request failed.

after
required
object | null

Outcome: the HTTP status, plus the error code on failure or a short summary on success. A row the server's command line (cli:*) wrote before #188 has no status; newer ones carry the status the API would have answered (201 for a create, 200 otherwise).

request_id
required
string | null

The request's X-Request-Id.

ip_hash
required
string | null

HMAC-SHA256 of the client IP.

actor_kind
required
"member" | "support" | "api_token" | "api_client" | "server" | "other"

Who the actor is (SELF-1-7, #188): member a signed-in user of the company (by email), support CropPath staff (a platform admin) acting for the company, api_token an API token (token:<name>), api_client an API client (oauth:<client_id>), server the server's command line (cli:*), other anything else (a configured token, or no actor).

actor_name
required
string | null

A member's current display name, an API token's name or the API client's name; null when there is none (support staff are named by their email in actor).

AuditPage

object

Properties
NameTypeDescription
items
required
array<AuditEntry>
next_cursor
required
string | null

Pass as cursor for the next (older) page; null on the last page.

AuthSession

object

Properties
NameTypeDescription
user
required
User
memberships
required
array<Membership>
csrf_token
required
string
two_factor
optional
TwoFactorState

BackupCodes

object

SELF-1-6 (#187). Ten single-use backup codes (80 random bits each, base32, grouped by four for reading aloud), in this response only; CropPath keeps only slow hashes of them.

Properties
NameTypeDescription
backup_codes
required
array<string>

BatchCount

object

Properties
NameTypeDescription
count
required
integer

How many records to create (at most 1,000).

BatchItemError

object

One failed item of a batch request.

Properties
NameTypeDescription
index
required
integer

The item's position in the request (from 0).

status
required
integer

The status the single-item route answers for this item.

error
required
string
code
required
string

BoundaryWalk

object

#248: one walk with its outline and its raw track.

Properties
NameTypeDescription
id
required
integer

The walk's id.

growing_area
required
string
client_walk_id
required
string (uuid)
submitted_by
required
string | null

Who sent the walk.

submitted_at
required
number

Unix seconds when the walk was received.

started_at
required
number

Unix seconds when the walk started (the phone's clock).

finished_at
required
number

Unix seconds when the walk finished (the phone's clock).

accuracy_threshold_m
required
number

The accuracy threshold of the walk in metres.

polygon_sha256
required
string

SHA-256 (hex) of the outline's canonical GeoJSON text (compact, sorted keys, UTF-8): the SHA-256 of the boundary proposal the walk made, and of the version it becomes once a platform admin approves it.

area_ha
required
number

The walked area in hectares: the ring area on a sphere of the WGS 84 equatorial radius, as the admin console computes a boundary's area.

registered_area_ha
required
number | null

The growing area's registered area_ha when the walk was received.

area_difference_ratio
required
number | null

(area_ha - registered_area_ha) / registered_area_ha: negative when the walk found less than registered; null without a registered size.

points_total
required
integer

Fixes in the raw track.

points_kept
required
integer

Fixes whose accuracy is within the walk's threshold (they may back the outline).

points_dropped
required
integer

Fixes less precise than the threshold (kept in the track, never in the outline).

superseded
required
boolean

Whether the walk replaced a boundary proposal that was waiting.

polygon
required
GeoJsonPolygon
points
required
array<array<number>>

The raw track: every fix taken during the walk, the imprecise ones included, at most 20000 (and the whole body at most 1 MiB).

BoundaryWalkCreate

object

#248: a walk around a growing area: the simplified outline and the raw track it came from.

Properties
NameTypeDescription
client_walk_id
required
string (uuid)

A UUID in lower case chosen by the phone for this walk: sending the same walk again with it is safe.

polygon
required
GeoJsonPolygon

The outline: a Polygon of exactly one closed ring, at most 1000 positions, at least 3 different corners, not crossing itself, at least 0.01 ha, each corner one of points with an accuracy within the threshold.

accuracy_threshold_m
required
number

Fixes less precise than this (metres) were not used for the outline.

started_at
required
number

Unix seconds when the walk started; at most 300 s ahead of the server.

finished_at
required
number

Unix seconds when the walk finished; not before started_at.

points
required
array<array<number>>

The raw track: every fix taken during the walk, the imprecise ones included, at most 20000 (and the whole body at most 1 MiB).

BoundaryWalkPage

object

Properties
NameTypeDescription
items
required
array<BoundaryWalkSummary>

Newest first.

next_cursor
required
string | null

BoundaryWalkResult

object

#248: what a submitted walk answers; the same walk sent again answers the same.

Properties
NameTypeDescription
id
required
integer

The walk's id.

polygon_sha256
required
string

SHA-256 (hex) of the outline's canonical GeoJSON text (compact, sorted keys, UTF-8): the SHA-256 of the boundary proposal the walk made, and of the version it becomes once a platform admin approves it.

area_ha
required
number

The walked area in hectares: the ring area on a sphere of the WGS 84 equatorial radius, as the admin console computes a boundary's area.

registered_area_ha
required
number | null

The growing area's registered area_ha when the walk was received.

area_difference_ratio
required
number | null

(area_ha - registered_area_ha) / registered_area_ha: negative when the walk found less than registered; null without a registered size.

points_total
required
integer

Fixes in the raw track.

points_kept
required
integer

Fixes whose accuracy is within the walk's threshold (they may back the outline).

points_dropped
required
integer

Fixes less precise than the threshold (kept in the track, never in the outline).

superseded
required
boolean

Whether the walk replaced a boundary proposal that was waiting.

BoundaryWalkSummary

object

#248: a walk kept as the evidence of a boundary proposal, without its track. It is the evidence of the proposal and of the boundary version with the same polygon_sha256.

Properties
NameTypeDescription
id
required
integer

The walk's id.

growing_area
required
string
client_walk_id
required
string (uuid)
submitted_by
required
string | null

Who sent the walk.

submitted_at
required
number

Unix seconds when the walk was received.

started_at
required
number

Unix seconds when the walk started (the phone's clock).

finished_at
required
number

Unix seconds when the walk finished (the phone's clock).

accuracy_threshold_m
required
number

The accuracy threshold of the walk in metres.

polygon_sha256
required
string

SHA-256 (hex) of the outline's canonical GeoJSON text (compact, sorted keys, UTF-8): the SHA-256 of the boundary proposal the walk made, and of the version it becomes once a platform admin approves it.

area_ha
required
number

The walked area in hectares: the ring area on a sphere of the WGS 84 equatorial radius, as the admin console computes a boundary's area.

registered_area_ha
required
number | null

The growing area's registered area_ha when the walk was received.

area_difference_ratio
required
number | null

(area_ha - registered_area_ha) / registered_area_ha: negative when the walk found less than registered; null without a registered size.

points_total
required
integer

Fixes in the raw track.

points_kept
required
integer

Fixes whose accuracy is within the walk's threshold (they may back the outline).

points_dropped
required
integer

Fixes less precise than the threshold (kept in the track, never in the outline).

superseded
required
boolean

Whether the walk replaced a boundary proposal that was waiting.

BrokerAuthzRequest

object

Missing fields are treated as empty strings (and denied).

Properties
NameTypeDescription
username
optional
string
action
optional
string
topic
optional
string

BrokerAuthzResult

object

Properties
NameTypeDescription
result
required
"allow" | "deny"

Calibration

object

SENS-B1d (#234): a calibration record of a device, never changed once recorded. Ingest links each reading of the device to the calibration in force at its time (calibration_id of the reading record): the latest not superseded, made at or before the reading, covering the reading's capability or every capability of the device; when its valid_until is before the reading, the reading is flagged suspect (QC flag 3, reason calibration_expired).

Properties
NameTypeDescription
id
required
integer
device_id
required
string
sensor_serial
required
string | null
capability
required
string | null

The capability covered; null: every capability of the device.

calibrated_at
required
number
method
required
"ph_buffers" | "ec_reference" | "lab_correlation" | "factory" | "other"
reference_values
required
object | array<any> | null
coefficients
required
object | array<any> | null
performer
required
string
accreditation
required
"iso17025_lab" | "in_house" | "manufacturer"
certificate_sha256
required
string | null

SHA-256 of the certificate, readable with GET /v1/attachments/{sha256}.

valid_until
required
number
supersedes
required
integer | null

The calibration this one corrects.

created_at
required
number
created_by
optional
string

Who recorded it; present for platform admins only.

superseded_by
required
integer | null

The calibration that corrects this one; null while it is not corrected.

CalibrationCertificate

object

SENS-B1d (#234): a calibration certificate sent with the calibration. Its bytes must hash to the calibration's certificate_sha256; it is then kept as an upload of the company, as one sent with PUT /v1/attachments/{sha256} would be.

Properties
NameTypeDescription
media_type
required
"application/pdf" | "image/jpeg" | "image/png"
content_base64
required
string

The certificate's bytes, standard base64 (RFC 4648 §4, with padding), at most 1 MiB decoded (and within the 1 MiB request body).

CalibrationCreate

object

SENS-B1d (#234): a calibration of a device of the company (GLOBALG.A.P. IFA v6 FV-GFS 13.01: measuring equipment calibrated at least yearly, traceably). Times are Unix seconds: calibrated_at from 2020-01-01 and at most 300 s ahead of the server clock, valid_until after it and at most about five years (5 × 366 days) later. The certificate is either uploaded first with PUT /v1/attachments/{sha256} for the same company (a PDF, JPEG or PNG) and named by certificate_sha256, or sent in certificate with certificate_sha256, which its bytes must hash to. A correction is a new calibration naming the one it corrects in supersedes; nothing is ever edited.

Properties
NameTypeDescription
sensor_serial
optional
string

The serial of the probe calibrated, when the device carries several.

capability
optional
string

The capability the calibration covers: one of the vocabulary's, or an x- extension. Absent: every capability of the device.

calibrated_at
required
number

When the calibration was done.

method
required
"ph_buffers" | "ec_reference" | "lab_correlation" | "factory" | "other"

ph_buffers: pH buffer solutions (e.g. 4, 7 and 10); ec_reference: an EC reference solution; lab_correlation: against a laboratory analysis; factory: the manufacturer's calibration; other.

reference_values
optional
object | array<any>

The reference values used (e.g. the buffers' pH): a JSON object or array of at most 4096 bytes, nested at most 4 deep, finite numbers only, strings of at most 200 characters.

coefficients
optional
object | array<any>

The coefficients found (e.g. slope and offset), with the same bounds as reference_values.

performer
required
string

Who calibrated: a laboratory, a technician or the manufacturer.

accreditation
required
"iso17025_lab" | "in_house" | "manufacturer"

iso17025_lab: a laboratory accredited to ISO/IEC 17025; in_house: the company itself; manufacturer.

certificate_sha256
optional
string

SHA-256 of the calibration certificate (PDF, JPEG or PNG).

certificate
optional
CalibrationCertificate
valid_until
required
number

Until when the calibration is valid: after calibrated_at. A reading made later, while this calibration is the device's latest, is flagged suspect (calibration_expired).

supersedes
optional
integer

The id of a calibration of the same device that this one corrects; a calibration is superseded once at most.

Calibrations

object

SENS-B1d (#234): a device's calibrations, newest first (by calibrated_at, then id), at most 1000.

Properties
NameTypeDescription
device_id
required
string
items
required
array<Calibration>

CapturedEvent

object

An EPCIS event a partner captured: its statement, Self-declared.

Properties
NameTypeDescription
event_id
required
string

The EPCIS eventID.

capture_id
required
integer

The capture that stored it.

event_type
required
"ObjectEvent" | "AggregationEvent" | "TransformationEvent"
biz_step
required
"commissioning" | "receiving" | "packing" | "shipping" | "sensor_reporting"

The CBV business step (bare term).

step
required
"harvest" | "receive" | "pack" | "ship" | "observe"

The journey step the event records: commissioning is the harvest, receiving, packing, shipping; sensor_reporting (#238) is an observation (observe).

action
required
"ADD" | "OBSERVE" | null

The EPCIS action; null for a TransformationEvent.

event_time
required
string

eventTime as sent (RFC 3339).

event_time_zone_offset
required
string

eventTimeZoneOffset as sent.

read_point
required
string | null

readPoint.id as sent.

biz_location
required
string | null

bizLocation.id as sent.

source
required
"partner_capture"
tier
required
"self_declared"
captured_by
required
string

Opaque operator id of the capturing principal.

captured_at
required
number

Capture time, Unix seconds.

references
required
array<object>

The tenant's records the event names.

CapturedEventPage

object

Properties
NameTypeDescription
lot
required
string

The lot code.

items
required
array<CapturedEvent>
next_cursor
required
string | null

Cursor of the next page; null on the last.

Carton

object

A carton of one lot (issue #37); its contents are fruits of that lot.

Properties
NameTypeDescription
tenant
required
string
code
required
string

C-<lot seq>-<carton number>.

lot
required
string

Code of the carton's lot.

carton_no
required
integer

Number within the lot.

public_id
required
string

128 random bits as hex.

qr_url
required
string

What the carton label's QR code carries (ADR 0004): a GS1 Digital Link <resolver>/01/<gtin>/10/<lot>/21/<serial> when the lot has a GTIN and a lot code of at most 20 characters (GS1 AI 10), else <resolver>/q/<public_id>.

net_mass_kg
required
number | null

Weighed net mass; null until the contents are set.

fruit_count
required
integer
fruit_mass_kg
required
number

Sum of the measured (scale) weights of its fruits, 3 decimals.

labels_printed_at
required
number

Unix seconds: the carton label's print time (creation).

created_by
required
string
created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

CartonBatchResult

object

The cartons a batch created, by number.

Properties
NameTypeDescription
batch_id
required
integer

The stored batch request's id.

count
required
integer
items
required
array<CartonDetail>

In request order.

CartonContents

object

What the carton holds, replacing its previous contents.

Properties
NameTypeDescription
fruits
required
array<string>

Codes of packable fruits of the carton's lot (status recorded or overridden, grade A or B), each in no other carton.

net_mass_kg
required
number

The carton's weighed net mass.

CartonContentsBatch

object

Up to 1,000 cartons of the lot, applied in order.

Properties
NameTypeDescription
items
required
array<CartonContentsBatchItem>

CartonContentsBatchItem

object

One carton's new contents, replacing its previous ones.

Properties
NameTypeDescription
carton
required
string

A carton of the path's lot; at most once per batch.

fruits
required
array<string>

Codes of packable fruits of the carton's lot (status recorded or overridden, grade A or B), each in no other carton.

net_mass_kg
required
number

The carton's weighed net mass.

CartonContentsBatchResult

object

The cartons as a batch left them, in request order.

Properties
NameTypeDescription
batch_id
required
integer

The stored batch request's id.

count
required
integer
items
required
array<CartonDetail>

In request order.

CartonCreate

object

No fields: the number, code and ids are the server's; the contents come with PUT .../fruits.

CartonDetail

object

A carton with the codes of its fruits (by fruit number).

Properties
NameTypeDescription
tenant
required
string
code
required
string

C-<lot seq>-<carton number>.

lot
required
string

Code of the carton's lot.

carton_no
required
integer

Number within the lot.

public_id
required
string

128 random bits as hex.

qr_url
required
string

What the carton label's QR code carries (ADR 0004): a GS1 Digital Link <resolver>/01/<gtin>/10/<lot>/21/<serial> when the lot has a GTIN and a lot code of at most 20 characters (GS1 AI 10), else <resolver>/q/<public_id>.

net_mass_kg
required
number | null

Weighed net mass; null until the contents are set.

fruit_count
required
integer
fruit_mass_kg
required
number

Sum of the measured (scale) weights of its fruits, 3 decimals.

labels_printed_at
required
number

Unix seconds: the carton label's print time (creation).

created_by
required
string
created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

fruits
required
array<string>

CartonPage

object

Properties
NameTypeDescription
items
required
array<Carton>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

CertificateStatus

object

Properties
NameTypeDescription
path
required
string
subject
required
string
not_after
required
string (date-time)
remaining_s
required
integer
remaining_fraction
required
number
expired
required
boolean

Certification

object

A certification of a growing area (e.g. VietGAP). It is verified when its scheme is one of the fixed list (see CertificationCreate), it has an issuer and an evidence_sha256, and a GLOBALG.A.P. number is a GGN; otherwise (e.g. a record written before #156, or sent without them) it is unverified and never counts towards a lot's trust tier.

Properties
NameTypeDescription
id
required
integer
growing_area
required
string
scheme
required
string
number
required
string
issuer
required
string | null
valid_from
required
string (date)
valid_to
required
string (date)
evidence_sha256
required
string | null
created_at
required
number

Unix seconds.

status
required
"valid" | "expired" | "not_yet_valid"

Against today's UTC date.

verified
optional
boolean

#269 review, with listCertifications verified=1 only: whether the server counts this certification as verified (the rule of this object's description; also false for an ISO 22000, FSSC 22000, BRCGS or IFS certification recorded on the growing area since these schemes moved to the facility). Only a verified one counts towards a lot's trust tier.

CertificationCreate

object

#156: a certification is verified when it names its scheme from the fixed list, its certifier (issuer) and the SHA-256 of the certificate document (evidence_sha256), and, for GLOBALG.A.P., a number that is the producer's GGN; the console always sends that shape. A request without them (as released clients send it: any scheme text, no certifier, no hash) is accepted and stored as sent, unverified: an unverified certification never counts towards a lot's trust tier (the harvest step's certification check counts verified certifications only).

Properties
NameTypeDescription
scheme
required
string

The certification scheme. A verified certification names one of VietGAP, GLOBALG.A.P., Organic JAS, Organic EU, Organic USDA, ISO 22000, FSSC 22000, BRCGS, IFS and HACCP (compared exactly), as the console sends it; any other text is accepted and stored, and the certification is unverified. ISO 22000, FSSC 22000, BRCGS and IFS certify a packing house (#269): record new ones on the facility (createFacilityCertification). A growing-area certification of these schemes is still accepted and stored as sent, but one recorded from this change on is unverified whatever it holds (it never counts towards a lot's trust tier); one recorded before is judged as before.

number
required
string

The certificate number. For a verified GLOBALG.A.P. certification, the producer's GLOBALG.A.P. Number (GGN): its 13 digits without the "GGN" prefix, the last being the GS1 mod-10 check digit of the others.

issuer
optional
string | null

The certifier (certification body) that issued the certificate. Optional; without it the certification is unverified.

valid_from
required
string (date)
valid_to
required
string (date)

Not before valid_from.

evidence_sha256
optional
string | null

The SHA-256 of the certificate document, e.g. the PDF uploaded with PUT /v1/attachments/{sha256}. Optional; without it the certification is unverified.

CertificationPage

object

Properties
NameTypeDescription
items
required
array<Certification>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

CockpitDay

object

#365: the farm day (Asia/Ho_Chi_Minh) an answer of the cockpit was computed in (common/farm_day.py).

Properties
NameTypeDescription
date
required
string

Its farm date.

starts_at
required
string (date-time)

Its local midnight, in UTC.

time_zone
required
"Asia/Ho_Chi_Minh"

Command

object

Properties
NameTypeDescription
id
required
string
tenant
required
string
site
required
string
device_id
required
string
name
required
string
params
required
object
issued_by
required
string
issued_at
required
number

Unix seconds.

status
required
"pending" | "sent" | "succeeded" | "failed" | "accepted" | "rejected" | "completed" | "aborted" | "expired"
result
required
object | null

The device reply or the dispatch error; null until settled.

completed_at
required
number | null

Unix seconds; null until settled.

kind
optional
"config" | "actuation"

#242, with getCommand or listDeviceCommands channel=1 only: config (set_model, calibrate, ...: status pending, sent, then succeeded or failed) or actuation (an irrigation controller's run_zone or set_program, a signed command document the controller checks and enforces locally: status pending, sent, then accepted and completed or aborted, or rejected; expired when it was not delivered or accepted before expires_at, or no final report came; failed when the dispatch failed). Without channel=1 the status of an actuation command is still answered.

expires_at
optional
number | null

#242, with getCommand or listDeviceCommands channel=1 only: Unix seconds after which the controller refuses the command (null for a config command).

reason
optional
string | null

#242, with getCommand or listDeviceCommands channel=1 only: why an actuation command was rejected, aborted or expired, as the controller or the server said it (for example bad_sig, expired, wrong_device, replayed, limit_exceeded, interlock, manual_override_active, clock_unsynced, no_final_report); null otherwise.

accepted_at
optional
number | null

#242, with getCommand or listDeviceCommands channel=1 only: Unix seconds when the controller accepted the actuation command; null until then and for a config command.

CommandIssued

object

Properties
NameTypeDescription
id
required
string

CommandKey

object

#242: one platform command key's public part.

Properties
NameTypeDescription
kid
required
string

platform-cmd- and the first 16 hex digits of the SHA-256 of the public key's SubjectPublicKeyInfo DER.

alg
required
"ES256"
jwk
required
object

The public key as an RFC 7517 JWK.

CommandKeys

object

Properties
NameTypeDescription
keys
required
array<CommandKey>

Empty when the server has no command key.

CommandPage

object

Properties
NameTypeDescription
items
required
array<Command>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

CommandRequest

object

Properties
NameTypeDescription
name
required
string
params
optional
object

Defaults to an empty object.

CommuneVerdictCounts

object

How many of the company's positions of the area in the range got each commune verdict (#247).

Properties
NameTypeDescription
commune_match
required
integer
commune_mismatch
required
integer
commune_unknown
required
integer

CompanyApiCallDay

object

SELF-2-5 (#194). A company's API calls on one UTC day.

Properties
NameTypeDescription
day
required
string (date)

The UTC day, YYYY-MM-DD.

calls
required
integer

CompanyExport

object

SELF-2-3 (#192). One request for the selected company's full data archive and its state. The archive layout (files, columns, encoding, times) is documented at /developers/downloads/company-export.md.

Properties
NameTypeDescription
id
required
integer
status
required
"queued" | "running" | "ready" | "failed" | "expired"

queued until the background job takes it, running while it builds the archive, ready to download until expires_at, failed when the build failed (request a new one), expired once its 24 hours are over and the file is deleted.

requested_by
required
string

Who asked for it (the signed-in user's email).

requested_at
required
number

Unix seconds.

started_at
required
number | null

Unix seconds when the job started building it.

finished_at
required
number | null

Unix seconds when the build ended (ready or failed).

expires_at
required
number | null

While ready: Unix seconds after which the download is refused (24 hours after the archive was ready); null otherwise.

size
required
integer | null

While ready: the archive's size in bytes.

sha256
required
string | null

While ready: the SHA-256 of the archive, to check the downloaded file.

file_name
required
string | null

While ready: the file name the download is saved under (croppath-export-<company>-<request time, UTC>.zip).

error
required
string | null

Why the build failed: build_failed or interrupted (the server stopped while building it); null otherwise.

CompanyExportList

object

SELF-2-3 (#192). The selected company's 20 newest export requests, newest first, and the limits.

Properties
NameTypeDescription
items
required
array<CompanyExport>
max_per_day
required
integer

How many exports the company may request in any 24 hours.

download_hours
required
integer

How long a ready archive can be downloaded.

CompanyLogoStored

object

Properties
NameTypeDescription
sha256
required
string
media_type
required
"image/png" | "image/jpeg"
size
required
integer
width
required
integer
height
required
integer

CompanyOffboarding

object

SELF-2-4 (#193): whether a company is leaving CropPath. active: no departure. leaving: the read-only window (30 days from started_at to window_ends_at) in which its people still sign in, read and download the full data export, but nothing of the company may change. left: sign-in stopped at left_at; the job then revokes the company's credentials and removes its people's names and emails (steps_done of 3). Sealed lot records, evidence and public lot pages stay until retention_ends_at: the latest seal (or the end of the window when later) plus retention_years, which CropPath sets for each company (no default).

Properties
NameTypeDescription
status
required
"active" | "leaving" | "left"
retention_years
required
integer | null

Years the sealed lot records are kept, counted from each lot's seal.

started_at
required
number | null

Unix seconds; null while the company is active.

window_ends_at
required
number | null

Unix seconds; null while the company is active.

left_at
required
number | null

Unix seconds; when sign-in stopped (status left).

retention_ends_at
required
number | null

Unix seconds; null while the company is active.

steps_done
required
integer

The job's steps done: 1 members off, 2 credentials revoked, 3 personal data removed.

CompanyOffboardingStart

object

Properties
NameTypeDescription
retention_years
required
integer

How many years the company's sealed lot records, evidence and public lot pages are kept, counted from each lot's seal (owner decision D-S4: no default; CropPath sets it for each company).

CompanyOverview

object

#274. The selected company's overview for the admin home: what needs attention, today's work, its lots and shipments, its devices and gateways, its people and its usage; counts and the company's own codes only. view admin: every section; view auditor (a caller who is no admin): without approvals, team, integrations, email and requests.personal_data_open (absent, not zero). Each section has state: ok with its figures, or unavailable (OverviewSectionUnavailable) when it could not be read.

Properties
NameTypeDescription
tenant
required
string

The selected company.

generated_at
required
string (date-time)

When the answer was computed (the server serves it for up to max_age_s).

max_age_s
required
integer

Seconds the server serves one answer.

day
required
object

The day today counts in: the Vietnam calendar day (UTC+7). The API call figures keep the UTC day.

view
required
"admin" | "auditor"
sections
required
object

CompanyOverviewAlerts

object | OverviewSectionUnavailable

#274. The company's open alerts.

CompanyOverviewApiDay

object

#274. The company's daily API call quota and today's calls (UTC day) against it.

Properties
NameTypeDescription
api_per_day
required
integer

API calls a UTC day.

api_calls_today
required
integer

API calls counted this UTC day.

api_day_warning
required
boolean

api_calls_today is at least 80% of api_per_day.

api_day_reached
required
boolean

api_calls_today reached api_per_day.

CompanyOverviewApprovals

object | OverviewSectionUnavailable

#274. Changes waiting for a second admin (admin view only).

CompanyOverviewCertifications

object | OverviewSectionUnavailable

#274. The growing areas' certifications (the latest of each area and scheme: a renewal replaces the older one).

CompanyOverviewEmail

object | OverviewSectionUnavailable

#274. Emails of the company that could not be sent (admin view only).

CompanyOverviewFleet

object | OverviewSectionUnavailable

#274. The company's devices and gateways.

CompanyOverviewIntegrations

object | OverviewSectionUnavailable

#274. The company's webhooks (admin view only).

CompanyOverviewLots

object | OverviewSectionUnavailable

#274. The company's lots per status.

CompanyOverviewQuarantine

object | OverviewSectionUnavailable

#274. Device messages waiting for review (quarantined).

CompanyOverviewRecalls

object | OverviewSectionUnavailable

#274. Recalled and withdrawn lots and the recall notices not yet delivered.

CompanyOverviewRequests

object | OverviewSectionUnavailable

#274. Requests waiting for the company. personal_data_open is in the admin view only.

CompanyOverviewShipments

object | OverviewSectionUnavailable

#274. The company's shipments.

CompanyOverviewTeam

object | OverviewSectionUnavailable

#274. The company's people (admin view only).

CompanyOverviewToday

object | OverviewSectionUnavailable

#274. Today's work, day of the answer (the Vietnam calendar day).

CompanyOverviewUsage

object | OverviewSectionUnavailable

#274. The company's limits, its daily API call quota and its API calls per day, as getCompanyUsage counts them (without what it stores).

CompanyPersonalDataRequest

object

SELF-2-9 (#198). A member's request about their personal data, as the company's admins see it.

Properties
NameTypeDescription
id
required
integer
kind
required
"access" | "correction"

access: see more of the personal data held; correction: correct it.

text
required
string

Plain text, as typed (trimmed): never HTML or markdown; line breaks are kept.

status
required
"open" | "handled"

open (new) or handled (a company admin dealt with it; final).

created_at
required
number

Seconds since 1970 (UTC).

handled_at
required
number | null

When a company admin marked it handled, or null.

user
required
SupportRequestUser
handled_by
required
string | null

Who marked it handled (an email), or null.

CompanyPersonalDataRequestPage

object

Properties
NameTypeDescription
items
required
array<CompanyPersonalDataRequest>
next_cursor
required
string | null

The next page's cursor; null on the last.

CompanyProducer

object

#186 (SELF-1-5): the lot's producer as its company profile names it now: the legal name and the address lines, never the trading name, tax number, contacts or website. Read when the label or dossier is built, so it is not part of any seal.

Properties
NameTypeDescription
legal_name
required
string
address
required
string | null
district
required
string | null

District or commune.

province
required
string | null
country
required
string

ISO 3166-1 alpha-2; VN until set.

commune
optional
string | null

#273: the company's commune (official name) when its profile is coded; null otherwise, and null for a household business that has not opted in to its full address. Only with admin_units=1, in getCompanyPublicIdentity's public_producer and in getLotExportLabel's producer; never in a customs dossier or without the parameter.

CompanyProfile

object

The selected company's legal identity. Every field is null until set (country: VN). Changing it never changes a sealed lot: sealed facts and signed credentials keep what they recorded.

Properties
NameTypeDescription
tenant
required
string

The company's id (X-Tenant).

name
required
string

The company's short display name (tenants.name), unchanged by the profile.

legal_name
required
string | null
trading_name
required
string | null
address
required
string | null
province
required
string | null
district
required
string | null
country
required
string

VN until set.

tax_id
required
string | null
contact_name
required
string | null
contact_phone
required
string | null
contact_email
required
string | null
website
required
string | null
logo
required
CompanyLogo | null
updated_at
required
number | null

Seconds since the epoch; null until the profile is first saved.

updated_by
required
string | null

Who saved it last; null until then.

commune
optional
string | null

The commune's official name (xã, phường or đặc khu) when the record is coded; else null. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

province_code
optional
string | null

The province's official 2-digit code, in the list admin_units_version; null when not coded. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

commune_code
optional
string | null

The commune's official 5-digit code, in the list admin_units_version; null when not coded. A code is only meaningful with its version (codes were reused across the 2025 reform). Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

admin_units_version
optional
string | null

The version of the official list the codes were taken from (for example vn-2026-10-17); null without codes. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_before_reform
optional
object | null

The province, district and commune text the record held before it was coded, or the text a request gave through the deprecated text path; kept for good once set. Null for a record entered with codes. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_status
optional
"coded" | "choose_commune" | "needs_commune" | "outside_vietnam" | null

coded: the codes are set from the official list; choose_commune: the old commune was split, a person picks one of address_candidates; needs_commune: no codes yet (given as text, or before the reform), a person picks the commune; outside_vietnam: a company profile in another country, where the codes do not apply. Null for a record not reviewed since the codes were introduced. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_candidates
optional
array<string> | null

For choose_commune: the official commune codes to pick from; else null. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

CompanyProfileUpdate

object

The whole profile (a PUT replaces it: a field left out, null or blank is cleared). Text is trimmed and may not hold control characters. The logo is set with PUT /v1/company/logo.

Properties
NameTypeDescription
legal_name
required
string

As on the business registration. Required; trimmed, not blank.

trading_name
optional
string | null
address
optional
string | null
province
optional
string | null

In Viet Nam (country VN): deprecated (#273), sunset 1 May 2027; send province_code and commune_code instead (with them this must be absent or null), and a profile given as text only is stored as not yet coded and answered with the Deprecation, Sunset and Link headers. Deprecated in Viet Nam only: in another country this stays the free-text region and is not deprecated.

district
optional
string | null

District or commune. In Viet Nam (country VN): deprecated (#273), sunset 1 May 2027; Viet Nam has had no district level since 1 July 2025, so send province_code and commune_code instead (with them this must be absent or null, 400 district_with_codes). Deprecated in Viet Nam only: in another country this stays the free-text locality and is not deprecated.

province_code
optional
string | null

#273: the province (tỉnh or thành phố trực thuộc trung ương) by its official 2-digit code in the administrative units list in force (getAdminUnits). Sent with commune_code, both or neither; with them province, district and commune must be absent or null and the server writes the official names. Only for an address in Viet Nam (country VN or absent): with another country the codes are refused (400 invalid_country) and province and district stay free text.

commune_code
optional
string | null

#273: the commune (xã, phường or đặc khu) by its official 5-digit code in the administrative units list in force (getAdminUnits with province). Sent with province_code, both or neither; the commune must lie in that province by the list, never by its digits.

country
optional
string | null

ISO 3166-1 alpha-2 code in capital letters; null or absent: VN.

tax_id
optional
string | null

Tax or business registration number. At most 32 characters for every country; the Vietnamese format is not checked yet (the exact rule awaits the owner's confirmation, #186).

contact_name
optional
string | null
contact_phone
optional
string | null

Digits, spaces and + ( ) . - only, starting with + or a digit.

contact_email
optional
string | null

An email address (name@domain.tld).

website
optional
string | null

An https:// address with a DNS host name; no user name or password.

CompanyPublicIdentity

object

#208: how the company is named on public outputs (today the lot's public customs file).

Properties
NameTypeDescription
household_business
required
boolean

The company is a household business (hộ kinh doanh). Its public customs file then names it by its trading name (or 'Hộ kinh doanh' alone when it has no trading name, never its tax number) and shows its province only, unless it opts in below. False for a company.

public_full_address
required
boolean

A household business shows its full address (address and district too) on its public customs file. Always false for a company.

public_legal_name
required
boolean

A household business shows its legal name (a person's name) on its public customs file instead of its trading name. Always false for a company.

public_producer
required
CompanyProducer | null

The producer as the lot's public customs file shows it now: for a company its legal name and full address; for a household business its trading name (or 'Hộ kinh doanh' alone, never its tax number) in legal_name and its province only, unless it opted in. Null until the profile is saved.

CompanyPublicIdentityUpdate

object

#208: every flag, true or false. The opt-ins are stored false unless household_business is true.

Properties
NameTypeDescription
household_business
required
boolean

The company is a household business (hộ kinh doanh). Its public customs file then names it by its trading name (or 'Hộ kinh doanh' alone when it has no trading name, never its tax number) and shows its province only, unless it opts in below. False for a company.

public_full_address
required
boolean

A household business shows its full address (address and district too) on its public customs file. Always false for a company.

public_legal_name
required
boolean

A household business shows its legal name (a person's name) on its public customs file instead of its trading name. Always false for a company.

CompanySecurity

object

SELF-1-6 (#187). The selected company's sign-in rule and how many of its active members have two-step sign-in on.

Properties
NameTypeDescription
require_two_factor
required
boolean

Every member must use two-step sign-in to act for this company.

members
required
integer

Active members (active membership and account).

members_with_two_factor
required
integer
admin_deadline
required
number

Unix seconds from which every company admin must use two-step sign-in (60 days after the release that shipped it).

updated_at
required
number | null
updated_by
required
string | null

CompanySecurityUpdate

object

Properties
NameTypeDescription
require_two_factor
required
boolean

CompanyUsage

object

SELF-2-5 (#194). The selected company's usage of its limits, its API calls per day, its quotas and what it stores (#134), counts only.

Properties
NameTypeDescription
tenant
required
string
warn_percent
required
integer

An entry warns from this percentage of its limit.

limits
required
array<CompanyUsageLimit>

Every limit, in a fixed order.

api_calls
required
array<CompanyApiCallDay>

The last 14 UTC days, newest first, today included (0 for a day without calls).

quotas
required
CompanyUsageQuotas
stored
required
CompanyUsageStored

CompanyUsageLimit

object

SELF-2-5 (#194). One per-company limit: what the company uses of it.

Properties
NameTypeDescription
id
required
"members" | "pending_links" | "devices" | "api_tokens" | "api_clients" | "webhooks"

members: active members plus pending invitations (limit 200). pending_links: pending one-time links of every purpose, invitations and new-password links (limit 50). devices: active devices (no limit is enforced: limit null). api_tokens: live API tokens (limit 100). api_clients: live API clients (limit 50). webhooks: webhook subscriptions of every status (limit 20).

used
required
integer
limit
required
integer | null

The limit the backend enforces; null when there is none.

warning
required
boolean

used is at least warn_percent of limit (false without a limit).

reached
required
boolean

used is at the limit: the next create is refused (false without a limit).

CompanyUsageQuotas

object

#134. The company's quotas: its API calls per minute and per UTC day (requests made with its API tokens or API clients; over either, 429 with Retry-After), with today's calls, and its device messages per second with a burst (over them the MQTT ingest keeps its messages in its ingest backlog and stores them at that rate; the HTTP ingest answers 429), with the messages waiting in that backlog.

Properties
NameTypeDescription
api_per_minute
required
integer

API calls a minute; over it, 429 with Retry-After.

api_per_day
required
integer

API calls a UTC day; once reached, 429 until the next UTC midnight.

api_calls_today
required
integer

API calls counted this UTC day (as api_calls' first day).

api_day_warning
required
boolean

api_calls_today is at least warn_percent of api_per_day.

api_day_reached
required
boolean

api_calls_today reached api_per_day: further calls today are refused.

ingest_per_second
required
integer

Device messages a second the ingest stores as they arrive.

ingest_burst
required
integer

Device messages the ingest stores at once above that rate after a quiet period.

ingest_backlog
required
integer

Device messages waiting in the company's ingest backlog.

CompanyUsageStored

object

#134. What the company keeps, counts only (no quota applies to them): its device messages stored, the public scans of its fruits still kept, and its stored files (attachments uploaded for its devices' envelopes and documents its users uploaded) with their total size. Files are content-addressed and shared, so a file two companies hold counts for each; database rows are not counted in storage_bytes.

Properties
NameTypeDescription
envelopes
required
integer

Device messages (envelopes) stored for the company, of every status.

scans
required
integer

Public scans of the company's fruits still kept (each fruit's scan counter, which keeps its count after the raw scan rows expire).

attachments
required
integer

Files stored: device attachments uploaded for the company's envelopes plus documents its users uploaded.

storage_bytes
required
integer

The total size of those files, in bytes.

Consignee

object

The immediate subsequent recipient of a shipment (#153; Circular 17/2021 Art. 6, Regulation (EC) 178/2002 Art. 18, FSMA 204). Staff-only: never on a public page or document.

Properties
NameTypeDescription
name
required
string

Legal name.

address
required
string

Postal address; line breaks allowed.

country
required
string

ISO 3166-1 alpha-2 (an assigned code).

gln
required
string | null

GS1 Global Location Number with a valid check digit.

registration_id
required
string | null

Tax or importer registration id.

ConsigneeInput

object

A consignee as written: gln and registration_id are optional.

Properties
NameTypeDescription
name
required
string

Legal name.

address
required
string

Postal address; line breaks allowed.

country
required
string

ISO 3166-1 alpha-2 (an assigned code).

gln
optional
string | null

GS1 Global Location Number with a valid check digit.

registration_id
optional
string | null

Tax or importer registration id.

ConsoleHome

object

#286. The console's work home for the selected company within the caller's packing houses (every packing house of the company for a company admin): what is measuring now, the work by next action, open shipments, messages waiting for review, the devices and stations, and today's counts. Codes and counts of the company only, and the names of its packing houses. Each section has state: ok with its figures, or unavailable (OverviewSectionUnavailable) when it could not be read.

Properties
NameTypeDescription
tenant
required
string

The selected company.

generated_at
required
string (date-time)

When the answer was computed (the server serves it for up to max_age_s).

max_age_s
required
integer

Seconds the server serves one answer.

day
required
object

The day today counts in: the Vietnam calendar day (UTC+7).

scope
required
object

Whose work the answer counts.

sections
required
object

ConsoleHomeDevices

object | OverviewSectionUnavailable

#286. The active devices and stations (gateways) of the scope's packing houses. A device belongs to a packing house, not to a line.

ConsoleHomeReview

object | OverviewSectionUnavailable

#286. Device messages of the scope waiting for a company admin's review (quarantined); a lot with such messages cannot be closed until they are reviewed.

ConsoleHomeSessions

object | OverviewSectionUnavailable

#286. The measurement sessions open or paused now, one per busy line, newest first.

ConsoleHomeShipments

object | OverviewSectionUnavailable

#286. Shipments not departed, oldest first (a shipment has no planned departure); #283: and the shipments departed in the last 30 days whose temperature logger readings are missing or incomplete.

ConsoleHomeTask

object

Properties
NameTypeDescription
count
required
integer

Lots of the window that need this action.

oldest
required
array<object>

The 5 oldest of them, oldest first (by the time of the step the action follows; a lot whose step time is unknown comes last).

ConsoleHomeToday

object | OverviewSectionUnavailable

#286. Today so far, day of the answer (the Vietnam calendar day); lot counts among the newest 1,000 lots of each packing house.

ConsoleHomeWork

object | OverviewSectionUnavailable

#286. The work by next action, read among the newest 1,000 lots of each packing house in scope (of the company for a company-wide answer). A lot may need several actions.

ControlAdvisory

object

#354: the lime and fertiliser advisory view (control/advisory.py): the advice of the signed sheets whose validity covers today and whose signature still holds, by series and version. No amount and no formula: a lab test is required.

Properties
NameTypeDescription
generated_at
required
number
today
required
string
items
required
array<ControlAdvisorySheet>
drafts
required
integer

The company's draft sheets (never listed).

withheld
required
integer

#354 review M5: the company's signed sheets in force today that are not listed because their signature can no longer be checked (the stored document no longer hashes to what was signed, or the signer is no longer verified); a count only, no detail.

ControlAdvisorySheet

object

#354: a signed sheet in force today, with its lime and fertiliser advice as signed.

Properties
NameTypeDescription
sheet_id
required
integer
series_key
required
string
crop
required
string
version
required
integer
valid_from
required
string
valid_to
required
string
body_sha256
required
string
signed_by
required
string | null

The signer's legal name as the attestation recorded it.

signed_at
required
number | null

When the attestation was signed.

advisory
required
object | null

The body's advisory section exactly as signed; null when the sheet has none.

references
required
array<object>

The body's references, as signed ([] when none).

growing_areas
required
array<string>

The codes of the company's growing areas whose crop is the sheet's crop; [] for a caller who may not read the growing areas (an agronomist holding no role of growing_area_read).

ControlAreaToday

object

#363. The day of the irrigation controllers placed in one growing area.

Properties
NameTypeDescription
generated_at
required
string (date-time)

When the answer was computed (the server serves it for up to max_age_s).

max_age_s
required
integer
poll_hint_s
required
15 | 60

15 while a run is open, a step is scheduled now or a command waits for its controller, else 60.

day
required
ControlDay
area
required
object
controllers
required
array<ControlControllerToday>
truncated
required
boolean

A cap left something out (50 controllers, 48 steps, the reads' row caps).

ControlBudgetDay

object

#353: a zone's water on a local date: what the program in force of the day planned for it (the engine's holding rule over a day, control/in_force.py, shared with the zone history) and what the controller reported delivered (control/budget.py). A refused or failed command never reads as planned water. Null where the source holds nothing, never a filled-in 0.

Properties
NameTypeDescription
device_id
required
string
zone
required
integer
name
required
string
growing_area
required
string
local_date
required
string
plan
required
"dispatched" | "withdrawn" | "replaced" | "refused" | "none" | "proposed" | "approved" | "rejected" | "superseded" | "failed" | "blocked" | "expired"

dispatched (the engine's program the controller held that day), withdrawn (the controller no longer ran it: a later row of the day recorded its withdrawal, a person withdrew it, a withdrawal of the controller's program was asked for after its dispatch, or the controller reported it replaced or cancelled, #367 cross-review M1), replaced (a person's own set_program replaced it: no planned water), refused (every program of the day that became a command was refused or failed: no planned water), else the status of the day's latest program, or none.

program_id
required
integer | null
rule_id
required
integer | null
mode
required
string | null
planned_mm
required
number | null

planned_l over the zone's irrigated area (1 L/m2 = 1 mm), the water given, before efficiency, the zone history's basis; null without a plan. The depth at the roots stays in the program's provenance and et0.

planned_l
required
number | null

The planned litres of the program in force; null without one.

clamps
required
array<string>
et0
required
object | null

An et0_budget zone's trace: the station day, its ET0 and krs, the estimated inputs, Kc and its stage, the rain and its effective fraction, ETc, the net depth, the trim and the bucket.

applied_l
required
number | null

The litres the controller reported; null when it reported nothing.

applied_mm
required
number | null

applied_l over the zone's irrigated area, the basis of planned_mm.

ControlBudgetPage

object

#353: planned and applied water per zone and local date (at most 2000 items).

Properties
NameTypeDescription
from
required
string
to
required
string
items
required
array<ControlBudgetDay>
truncated
required
boolean

A cap was reached (the items, or one of the reads behind them: zones, program rows, step runs): the answer is not whole.

ControlCommandToday

object

#363. One of a controller's newest actuation commands.

Properties
NameTypeDescription
id
required
string
name
required
string
status
required
"pending" | "sent" | "accepted" | "completed" | "aborted" | "rejected" | "expired" | "failed"
issued_by
required
string | null

The person's display name (system for the engine); null for a caller who may not read the device (an agronomist).

issued_at
required
string (date-time)
params
required
object
expires_at
required
string (date-time) | null (date-time)
reason
required
string | null
measured
required
object | null

ControlControllerDay

object

#363. One irrigation controller's day.

Properties
NameTypeDescription
generated_at
required
string (date-time)

When the answer was computed (the server serves it for up to max_age_s).

max_age_s
required
integer
poll_hint_s
required
15 | 60

15 while a run is open, a step is scheduled now or a command waits for its controller, else 60.

day
required
ControlDay
device_id
required
string
name
required
string | null
link
required
ControlLink
hold_until
required
string (date-time) | null (date-time)

#367 cross-review M2: the end of the controller's hold in force (a person withdrew today's program; the engine sends nothing automatic until then), or null.

program
required
ControlProgramToday
zones
required
array<ControlZoneToday>
steps
required
array<ControlStepToday>
commands
required
array<ControlCommandToday>
area
required
null | object
limits
required
object

The controller profile's run_zone bounds (minima since #371): installation facts, never an irrigation amount.

truncated
required
boolean

ControlControllerToday

object

#363. One controller of an area's day.

Properties
NameTypeDescription
device_id
required
string
name
required
string | null
link
required
ControlLink
hold_until
required
string (date-time) | null (date-time)

#367 cross-review M2: the end of the controller's hold in force (a person withdrew today's program; the engine sends nothing automatic until then), or null.

program
required
ControlProgramToday
zones
required
array<ControlZoneToday>
steps
required
array<ControlStepToday>
commands
required
array<ControlCommandToday>

ControlDay

object

#363. The farm-local day an answer describes (the backend owns the day).

Properties
NameTypeDescription
date
required
string (date)

The farm-local date (Asia/Ho_Chi_Minh).

starts_at
required
string (date-time)

Its local midnight, in UTC (17:00:00Z of the day before).

time_zone
required
"Asia/Ho_Chi_Minh"

The farm time zone every time of the answer is shown in.

ControlEt0Day

object

#353: the latest stored version (seq) of the reference ET0 (FAO-56 Penman-Monteith, meteorology only: no sheet value) of a weather station's local day (control/et0_inputs.py, et0_daily). A compose appends a version only when the latest was refused or needed the krs and the day now reads differently, a capability's coverage grew, or a plausibility verdict arrived; programs cite the version they used.

Properties
NameTypeDescription
device_id
required
string

The weather station.

local_date
required
string

The local day (Asia/Ho_Chi_Minh, midnight to midnight).

seq
required
integer

The version of the station day (1, 2, ...): the latest is listed.

wind_height_m
required
number

The anemometer's height the zone gives (eq. 47).

elevation_m
required
number

The station's elevation the zone gives (eqs. 7 and 37).

status
required
"ok" | "needs_krs" | "refused"

ok with et0_mm; needs_krs: no usable measured radiation (a daylight hour without a reading, none at all, a suspect sun or night-light check, or a measured Rs above 1.05 x the clear-sky Rso: a sensor fault), each rule estimates it by eq. 50 with its own sheet's krs (the program's provenance has that ET0); refused: no ET0 (reason), the rule falls back.

reason
required
string | null

Why not ok: station_not_approved, station_not_placed, temperature_coverage, out_of_range (refused); radiation_coverage, no_radiation, light_suspect, radiation_above_clear_sky (needs_krs).

et0_mm
required
number | null

mm/day; null unless ok.

inputs
required
object

The daily inputs and how each was found: latitude_deg (the placement's), day_of_year, g (0, eq. 42), coverage (per capability: readings, coverage_h of the 24 local hours, truncated), rain {mm, method, estimated}, tmax and tmin (degC), ea {value kPa, method dew_point|rh_max_min|rh_mean|tdew_tmin, estimated}, u2 {value m/s, method measured|default_2_m_s, estimated}, pressure {value kPa, method measured|elevation}, rs {value MJ m-2 day-1 or null, method measured|eq50_krs, estimated}. Also longitude_deg, daylight_hours (the local hours with the sun up at their midpoint: Rs is the sum of their hourly means x 0.0036, the night counting 0), light_verdicts (the plausibility job's sun and night-light verdicts read), and on pressure a measured_rejected value when the measured pressure was more than 10 % from eq. 7's.

trace
required
map<string, number>

Every intermediate of the equations (tmean, pressure_kpa, gamma, delta, es, ea, vpd, ra, rs, rso, rns, rnl, rn, g, u2, et0_mm) and hargreaves_mm, the paper's cross-check only (eq. 52). methods_diverge: Hargreaves more than 25 % from Penman-Monteith (an alert, no change of water); rs_clamped_to_rso on an eq. 50 estimate.

computed_at
required
number
estimated
required
array<"ea" | "u2" | "rs" | "rain">

The inputs that are estimated.

ControlEt0Page

object

#353: the stored ET0 days of a span of local dates, by station and date (at most 2000).

Properties
NameTypeDescription
from
required
string
to
required
string
items
required
array<ControlEt0Day>
truncated
required
boolean

A cap was reached (the items, or one of the reads behind them: zones, program rows, step runs): the answer is not whole.

ControlFleetArea

object

#363. A growing area holding an irrigation controller.

Properties
NameTypeDescription
code
required
string
name
required
string | null
controllers
required
object
zones
required
object
water_today
required
object
sensors
required
object
alarms
required
object

ControlFleetAreas

object | OverviewSectionUnavailable

#363. The areas, at most 200 by code.

ControlFleetAttention

object | OverviewSectionUnavailable

#363. What needs attention: exact counts of the open alarms the caller may read, and at most 20 items (alarms not shelved, urgent then warning then notice, the oldest first; then today's programs waiting for approval).

ControlFleetControllers

object | OverviewSectionUnavailable

#363. The controllers, at most 500 by device id.

ControlFleetState

object

#363. The company's water today at a glance. Each section has state: ok with its figures, or unavailable (OverviewSectionUnavailable) when one of its reads failed.

Properties
NameTypeDescription
tenant
required
string
generated_at
required
string (date-time)

When the answer was computed (the server serves it for up to max_age_s).

max_age_s
required
integer
poll_hint_s
required
15 | 60

15 while a run is open, a step is scheduled now or a command waits for its controller, else 60.

day
required
ControlDay
view
required
string
attention
required
ControlFleetAttention
areas
required
ControlFleetAreas
controllers
required
ControlFleetControllers

ControlGateDecision

object

Properties
NameTypeDescription
zone
required
integer
rule_id
required
integer
decided_at
required
number
verdict
required
"healthy" | "fallback" | "blocked"
reason
required
string | null
detail
required
object

Every probe's reading and status, the basis and the peer check (control/health_gate.py).

ControlHome

object

#354: the irrigation control home (control/home.py): what needs a person today, for the controllers in scope.

Properties
NameTypeDescription
generated_at
required
number
controllers
required
integer

The company's controllers with a control zone in scope.

programs_waiting
required
object

The programs still proposed (waiting for a person's approval): their count and the newest 5.

rules
required
object

The company's rules in scope by what they need.

salinity
required
object

The open alerts of a controller in scope whose zone's water or soil EC (mS/cm) passed its signed sheet's limit: salinity_block (high, the sheet's action blocked the zone's water) and salinity_alert (warning, the zone was watered as decided); their count and the newest 5.

et0
required
object

Per weather station a zone in scope names, its latest stored reference ET0 day (meteorology only, as GET /v1/control/et0 answers it), by station.

ControlPreview

object

#352: a dry run of a rule's controller as if the rule were enabled; nothing written or sent.

Properties
NameTypeDescription
generated_at
required
number
rule_id
required
integer
device_id
required
string
provenance
required
object

As a program's provenance. A zone's record may carry salinity (#354, control/salinity.py) when its sheet has a salinity section: {state ok|exceeded|not_measured, action block|alert, water {limit_ms_cm, state, sources[]}, soil {limit_ms_cm, basis bulk|pore, capability, state, sources[]}, stale_s}, electrical conductivity in mS/cm only. An exceedance with the action block gives the zone no steps (mode blocked, reason salinity_block), blocks its rule (salinity_block) and raises a high alert salinity_block; with the action alert the zone is watered as decided and a warning alert salinity_alert is raised. not_measured never starts a block. A zone a fallback waters is checked against the salinity sections of both sheets, the fallback rule's and its own rule's (the strictest applies); its record then also carries salinity_sheets [{sheet_id, evaluation}], the sheet watering it first, while salinity is the binding evaluation. A zone blocked by salinity in today's reference program, or named by an open salinity_block alert of the controller, stays blocked while its block section reads not_measured (reason salinity_block, the record's held not_measured), until a usable reading at or below the limit is found. The salinity alerts' detail lists every zone a compose found (zones [{zone, rule_id, sheet_id, action, exceeded}]); a new one is raised when such a zone is in no open alert of its kind, and a person resolves them.

gate
required
array<object>
params
required
object | null

The set_program params: as sent once dispatched (with the program_version CropPath assigned), else as they would be sent now.

blocked_zones
required
array<integer>

ControlProbeHealth

object

#365: one probe of the area at one depth.

Properties
NameTypeDescription
device_id
required
string
profile
required
string
depth_cm
required
number | null
capability
required
string | null

The series judged: soil.moisture for a probe a zone names (the series the health gate reads); for a field sensor no zone names, soil.moisture when its profile produces it, else its first capability.

link
required
object

The health gate's freshness rule (decision D11): fresh up to 2 poll intervals (at most 1800 s) after the latest reading of any area (which has a value), stale up to 10 poll intervals, offline past that or without a reading.

coverage_30d_pct
required
number

Whole hours of the last 720 holding a usable reading (QC pass or not evaluated, a value, Device-recorded), by the reading's own time.

qc_30d
required
object
used_by
required
array<object>

ControlProgram

object

#352: a program the engine composed (control/programs.py), with the #242 command it became.

Properties
NameTypeDescription
id
required
integer
device_id
required
string
local_date
required
string
status
required
"proposed" | "approved" | "rejected" | "dispatched" | "superseded" | "failed" | "blocked" | "expired" | "withdrawn"
cause
required
"daily" | "threshold" | "recompose"
proposed_at
required
number
expires_at
required
number
decided_by
required
string | null
decided_at
required
number | null
dispatched_at
required
number | null
command_id
required
string | null
program_version
required
integer | null
error
required
string | null
steps
required
integer
litres
required
number
rules
required
array<object>
sheets
required
array<object>

Every sheet the program cites: its id, version, series and SHA-256.

withdrew
required
boolean

The controller's earlier program was withdrawn with this row.

params
required
object | null

The set_program params: as sent once dispatched (with the program_version CropPath assigned), else as they would be sent now.

provenance
required
object

What composed it: the rules and how each applied, every sheet cited (id, version, SHA-256, attestation id), each zone's decision, budget and clamps, the day's placed steps (plan), per zone the planned depth and litres with their clamps and an ET0 zone's trace (budget, #353), the weather stations' ET0 days cited (et0, #353) and the decisions' signature (control/engine.py). A zone's record may carry salinity (#354, control/salinity.py) when its sheet has a salinity section: {state ok|exceeded|not_measured, action block|alert, water {limit_ms_cm, state, sources[]}, soil {limit_ms_cm, basis bulk|pore, capability, state, sources[]}, stale_s}, electrical conductivity in mS/cm only. An exceedance with the action block gives the zone no steps (mode blocked, reason salinity_block), blocks its rule (salinity_block) and raises a high alert salinity_block; with the action alert the zone is watered as decided and a warning alert salinity_alert is raised. not_measured never starts a block. A zone a fallback waters is checked against the salinity sections of both sheets, the fallback rule's and its own rule's (the strictest applies); its record then also carries salinity_sheets [{sheet_id, evaluation}], the sheet watering it first, while salinity is the binding evaluation. A zone blocked by salinity in today's reference program, or named by an open salinity_block alert of the controller, stays blocked while its block section reads not_measured (reason salinity_block, the record's held not_measured), until a usable reading at or below the limit is found. The salinity alerts' detail lists every zone a compose found (zones [{zone, rule_id, sheet_id, action, exceeded}]); a new one is raised when such a zone is in no open alert of its kind, and a person resolves them.

decision_note
required
string | null
withdrawal
required
object | null

#367: who withdrew the program from the controller (null to an agronomist), when (RFC 3339 UTC) and why ([removed] once the company has left); null unless its status is withdrawn.

gate_decisions
required
array<ControlGateDecision>
command
required
object | null

ControlProgramPage

object

Properties
NameTypeDescription
items
required
array<ControlProgramSummary>
next_before
required
integer | null

ControlProgramReject

object

Properties
NameTypeDescription
reason
optional
string

ControlProgramStep

object

Properties
NameTypeDescription
zone
required
integer
start_s
required
integer
duration_s
required
integer
max_volume_l
required
number

ControlProgramSummary

object

Properties
NameTypeDescription
id
required
integer
device_id
required
string
local_date
required
string
status
required
"proposed" | "approved" | "rejected" | "dispatched" | "superseded" | "failed" | "blocked" | "expired" | "withdrawn"
cause
required
"daily" | "threshold" | "recompose"
proposed_at
required
number
expires_at
required
number
decided_by
required
string | null
decided_at
required
number | null
dispatched_at
required
number | null
command_id
required
string | null
program_version
required
integer | null
error
required
string | null
steps
required
integer
litres
required
number
rules
required
array<object>
sheets
required
array<object>

Every sheet the program cites: its id, version, series and SHA-256.

withdrew
required
boolean

The controller's earlier program was withdrawn with this row.

ControlProgramToday

object

#363. Today's program of a controller.

Properties
NameTypeDescription
state
required
"none" | "sending" | "installed" | "refused" | "not_installed" | "ended"

The day's newest set_program as the controller reported it.

command_id
required
string | null
program_version
required
integer | null
control_program_id
required
integer | null

The #352 program row that sent it (null: not the rules').

valid_until
required
string (date-time) | null (date-time)

The end of its lease.

withdrawable
required
boolean

Whether a withdrawal (POST /v1/devices/{id}/program-withdrawal) would be accepted now: a lease in force, a set_program waiting for the controller, or a rule or proposal to hold (#371: before, a lease in force only).

withdraw_effect
required
"stop_installed" | "stop_sending" | "hold" | "already_held" | null

#371: what a withdrawal would do now: stop_installed (the controller stops the program it holds), stop_sending (the set_program still waiting for the controller is withdrawn before it is taken), hold (nothing on the controller: the engine is held for the rest of the farm-local day); null when it would answer 409 no_program. already_held (#367 cross-review INFO 5): the controller is held already and nothing else is in force; a withdrawal answers 202 again, idempotently, and the hold stays as it is.

lease_version
required
integer | null

#371: the program_version of the program the controller holds now (its lease in force), which the day's newest set_program may not be; null when none is installed.

lease_command_id
required
string | null

#371: the set_program command of that program; null when none is installed.

lease_control_program_id
required
integer | null

#371: the #352 program row that sent that program (null: none installed, or not the rules').

withdrawal
required
null | object

#367 cross-review M2: the withdrawal of the controller's program asked for since its lease was accepted (today when it has none); null when there is none.

ControlRule

object

#352: an irrigation rule (control/rules.py): its kind, controller and zones, the exact signed sheet it reads, its windows, approval and the state the engine last left it in.

Properties
NameTypeDescription
id
required
integer
kind
required
"schedule" | "threshold" | "et0_budget" | "lighting"

schedule (the stage's daily depth), threshold (soil moisture against the stage's band, falling back to a schedule rule) or et0_budget (#353: Kc x yesterday's ET0 of the zones' weather station less the rain that counts, falling back to a schedule rule); lighting is recorded but never enabled.

device_id
required
string
name
required
string
zones
required
array<integer>
sheet_id
required
integer | null

A signed agronomic input sheet of the company.

windows
required
array<object>
fallback_rule_id
required
integer | null

A threshold or et0_budget rule's fallback (required to enable one): a disabled schedule rule of the same controller and zones.

eval_interval_s
required
integer
min_interval_s
required
integer
peer_tolerance_pct
required
number | null

The health gate's peer tolerance (percentage points): required by a threshold rule; an et0_budget rule takes it with min_probes or neither (with them its probes trim the depth and measure the bucket).

min_probes
required
integer | null

The health gate's minimum of usable probes: required by a threshold rule; an et0_budget rule takes it with peer_tolerance_pct or neither.

approval
required
"required" | "auto"
enabled
required
boolean
state
required
"disabled" | "ok" | "blocked" | "fallback"
state_reason
required
string | null

Why blocked or on fallback, e.g. no_signed_sheet, sheet_expired, sheet_hash_mismatch, frozen, stale, disagreeing, fallback_sheet_revoked, manual_override (a person's own program is in force on the controller), salinity_block (#354: a zone's EC reading above its sheet's limit with the action block).

state_at
required
number | null
next_run_at
required
number | null
last_run_at
required
number | null
created_by
required
string
created_at
required
number
updated_by
required
string | null
updated_at
required
number
enabled_by
required
string | null
enabled_at
required
number | null
auto_approval_by
required
string | null
auto_approval_at
required
number | null
hold_until
required
string (date-time) | null (date-time)

#367: the end of the hold on the rule's controller (RFC 3339 UTC): until then the engine proposes and sends nothing automatic for it (a withdrawal holds it until the next farm-local midnight). Null when the controller is not held or its hold has ended.

sheet
required
object | null
sheet_gate
required
string | null

#354: the reason the rule's sheet would block it today (the sheet gate the engine runs on every compose, on today's local date): no_signed_sheet, sheet_superseded, sheet_revoked, sheet_hash_mismatch, sheet_not_started, sheet_expired, signer_not_verified, sheet_crop_mismatch or sheet_incomplete; null when the sheet is usable.

resumed_command_id
required
string | null

The person's own set_program an admin resumed the controller's rules over (POST .../resume), or null.

ControlRuleApproval

object

Properties
NameTypeDescription
approval
required
"required" | "auto"

ControlRuleCreate

object

Properties
NameTypeDescription
kind
required
"schedule" | "threshold" | "et0_budget" | "lighting"

schedule (the stage's daily depth), threshold (soil moisture against the stage's band, falling back to a schedule rule) or et0_budget (#353: Kc x yesterday's ET0 of the zones' weather station less the rain that counts, falling back to a schedule rule); lighting is recorded but never enabled.

device_id
required
string
name
required
string
zones
required
array<integer>
sheet_id
optional
integer | null

A signed agronomic input sheet of the company.

windows
required
array<object>
fallback_rule_id
optional
integer | null

A threshold or et0_budget rule's fallback (required to enable one): a disabled schedule rule of the same controller and zones.

eval_interval_s
optional
integer
min_interval_s
optional
integer
peer_tolerance_pct
optional
number | null

The health gate's peer tolerance (percentage points): required by a threshold rule; an et0_budget rule takes it with min_probes or neither (with them its probes trim the depth and measure the bucket).

min_probes
optional
integer | null

The health gate's minimum of usable probes: required by a threshold rule; an et0_budget rule takes it with peer_tolerance_pct or neither.

ControlRulePage

object

Properties
NameTypeDescription
items
required
array<ControlRule>
next_before
required
integer | null

ControlRuleUpdate

object

Properties
NameTypeDescription
name
optional
string
zones
optional
array<integer>
sheet_id
optional
integer | null

A signed agronomic input sheet of the company.

windows
optional
array<object>
fallback_rule_id
optional
integer | null

A threshold or et0_budget rule's fallback (required to enable one): a disabled schedule rule of the same controller and zones.

eval_interval_s
optional
integer
min_interval_s
optional
integer
peer_tolerance_pct
optional
number | null

The health gate's peer tolerance (percentage points): required by a threshold rule; an et0_budget rule takes it with min_probes or neither (with them its probes trim the depth and measure the bucket).

min_probes
optional
integer | null

The health gate's minimum of usable probes: required by a threshold rule; an et0_budget rule takes it with peer_tolerance_pct or neither.

ControlSensorHealth

object

#365 (CP-5): a growing area's probes, the rules that read them and today's gate decisions (control/cockpit/sensor_health.py).

Properties
NameTypeDescription
generated_at
required
string (date-time)

When the answer was computed (the server serves it from its cache for max_age_s).

max_age_s
required
integer

How long the server serves this answer from its cache.

poll_hint_s
required
integer

How often a screen may ask again.

day
required
CockpitDay
area
required
string
probes
required
array<ControlProbeHealth>
gate_decisions_today
required
array<object>

Newest first.

truncated
required
boolean

True when more than 200 probes, or more than 200 of the caller's gate decisions of today, were left out.

ControlStepToday

object

#363. A step of the controller's lease today, with what was observed of it.

Properties
NameTypeDescription
zone
required
integer
start_s
required
integer

Seconds after local midnight.

duration_s
required
integer
max_volume_l
required
number | null
planned_l
required
number | null
actual
required
object

ControlZone

object

#352: an irrigation zone of a controller, with its installation facts (control/zones.py).

Properties
NameTypeDescription
id
required
integer
device_id
required
string
zone
required
integer
growing_area
required
string
name
required
string
irrigated_area_m2
required
number
nominal_flow_lpm
required
number
efficiency
required
number
max_daily_l
required
number
probes
required
array<object>

The soil moisture probes that watch the zone: devices of the company whose profile produces soil.moisture (#365).

weather_station
required
object | null
controller_utc_offset
required
string
field_capacity_pct
required
number | null

#353: the zone soil's volumetric water content at field capacity (%), a measurement of the site, never a default; given with wilting_point_pct (above it) or not at all. The et0_budget rule's root-zone bucket needs both.

wilting_point_pct
required
number | null

#353: the zone soil's volumetric water content at the permanent wilting point (%), below field_capacity_pct; given with it or not at all.

offset_ok
required
boolean

Whether the controller is on Viet Nam time (+07:00): a zone that is not blocks the rules watering it.

created_by
required
string
created_at
required
number
updated_by
required
string | null
updated_at
required
number

ControlZoneBand

object

#365 (decision D3): a moisture target band of a stage of a signed sheet, clipped to the range and the sheet's validity. Only from a sheet signed now; never a default.

Properties
NameTypeDescription
from
required
string
to
required
string
lower_pct
required
number
upper_pct
required
number
depth_cm
required
number

The band's basis depth.

probe_profile
required
string | null

The probe profile the band was set for.

stage
required
string | null

The stage's code.

stage_name
required
AgronomyLocalizedText | null

#372: the stage's name as the sheet words it (vi, en, zh-Hans); null when the stage has none.

sheet
required
object

ControlZoneCreate

object

Properties
NameTypeDescription
device_id
required
string
zone
required
integer
name
required
string
irrigated_area_m2
required
number
nominal_flow_lpm
required
number
efficiency
required
number
max_daily_l
required
number
probes
optional
array<object>
weather_station
optional
object | null
controller_utc_offset
required
string
field_capacity_pct
optional
number | null

#353: the zone soil's volumetric water content at field capacity (%), a measurement of the site, never a default; given with wilting_point_pct (above it) or not at all. The et0_budget rule's root-zone bucket needs both.

wilting_point_pct
optional
number | null

#353: the zone soil's volumetric water content at the permanent wilting point (%), below field_capacity_pct; given with it or not at all.

ControlZoneHistory

object

#365 (CP-5): a zone's water per farm day, its runs and the target bands of its signed sheets (control/cockpit/zone_history.py).

Properties
NameTypeDescription
generated_at
required
string (date-time)

When the answer was computed (the server serves it from its cache for max_age_s).

max_age_s
required
integer

How long the server serves this answer from its cache.

poll_hint_s
required
integer

How often a screen may ask again.

day
required
CockpitDay
from
required
string
to
required
string
zone
required
object
days
required
array<ControlZoneHistoryDay>
runs
required
array<ControlZoneRun>

Newest first.

moisture_series
required
object | null

What the moisture chart reads from getSensorSeries for the zone's area; null when the zone has neither a band nor a probe.

moisture
required
object | null

#372: the soil moisture of the zone's own probes (its probes), read under the zone's scope: one series per probe depth, the basis depth (the first band's, else the first probe's) first, the probes at one depth merged; buckets of an hour up to 14 days, else of a farm day (Asia/Ho_Chi_Minh). Only readings that carry a value are counted (n_missing is 0). Null when the zone names no probe.

bands
required
array<ControlZoneBand>
truncated
required
boolean

True when older runs than the 500 newest, or more than 5000 set_program commands of the range, were left out.

ControlZoneHistoryDay

object

#365: one farm day of a zone. Every value is null when its source is absent; none is ever filled in.

Properties
NameTypeDescription
date
required
string
planned_l
required
number | null

The litres the program in force planned for the zone from its dispatch on: the day's newest program that became a command, did not fail and whose command was not refused, unless the controller no longer ran it (a later row records its withdrawal, a person withdrew it, a withdrawal was asked for after its dispatch, or the controller reported it replaced or cancelled) or a person's own set_program (sent outside the engine, a higher version, not refused nor ended, not withdrawn since) was issued before the day ended (the engine's holding rule over a day, control/in_force.py, shared with the budget read); null without one, or when it planned nothing (blocked, no stage).

applied_l
required
number | null

Litres the controller reported delivered to the zone that day (water.volume_delivered with meta.zone); null when it reported nothing, never 0 for no data.

planned_mm
required
number | null

planned_l over the zone's irrigated area (1 L/m2 = 1 mm), the water given, before efficiency.

applied_mm
required
number | null

applied_l over the zone's irrigated area, the basis of planned_mm.

et0_mm
required
number | null

Reference evapotranspiration of the day at the zone's weather station (FAO-56, #353): the latest stored version of the station day in et0_daily; null unless its status is ok, and without a station or a stored day.

et0_status
required
"ok" | "needs_krs" | "refused" | null

That station day's status: ok, needs_krs (no usable measured radiation: each rule estimates it with its sheet's krs, in the program's provenance) or refused; null without a station or a stored day.

kc_stage
required
number | null

The crop coefficient (Kc) the engine applied to the day's ET0: an et0_budget zone's record in a program of the next day, which sizes that day from this one (the Kc control_water_balance's ETc of the day was booked with); null without one.

rain_mm
required
number | null

The rain the station's inputs summed for the day (a partial day is a lower bound); null without a station or a stored day.

rule
required
object | null

How the newest program row of the day decided the zone; null without one.

program
required
object | null

The newest program row of the day for the controller.

ControlZonePage

object

Properties
NameTypeDescription
items
required
array<ControlZone>

ControlZoneRun

object

#365: one delivery the controller reported for the zone (it reports a run's water when the run ends).

Properties
NameTypeDescription
started_at
required
string (date-time) | null (date-time)

When the controller's accepted of a manual run arrived; null for a program step (a controller does not report a step's start).

ended_at
required
string (date-time)

The delivered-volume reading's time.

litres
required
number
source
required
"manual" | "program_step"

manual: a run_zone of the controller completed within 15 minutes of the range, its final report with the same zone and litres within 15 minutes of the reading and its accepted no later than the reading; else program_step.

command_id
required
string | null

The run_zone, or the set_program the controller accepted last before the reading, its lease not ended and not withdrawn since; null when none is known.

ControlZoneToday

object

#363. A zone of a controller today.

Properties
NameTypeDescription
zone
required
integer
name
required
string | null
state
required
"idle" | "requested" | "running" | "scheduled_now" | "ended" | "refused" | "fault"

From the reports only: a request waiting for the controller is requested, never running; a program step in its window is scheduled_now (the controllers report no step start).

source
required
"run_zone_reply" | "step_water" | "program_reply" | null
since
required
string (date-time) | null (date-time)
expected_end
required
string (date-time) | null (date-time)
reason
required
string | null

The refusal or fault reason token.

today
required
object
moisture
required
object
sheet
optional
null | object

#373: the sheet the zone's enabled rule is bound to, whatever today's band, the rule's state or the sheet's status; null when no enabled rule binds a sheet. status is signed only while today is within the sheet's validity, expired past its last valid day and not_yet_valid before its first, else the sheet's own (draft, superseded, revoked). stage and stage_name are the stage covering today, else null. Optional in the schema, always sent.

nominal_flow_lpm
optional
number | null

Controller today only: the installation's nominal flow (#352 control_zones).

max_daily_l
optional
number | null

Controller today only: the zone's daily cap (#352 control_zones).

ControlZoneUpdate

object

Properties
NameTypeDescription
name
optional
string
irrigated_area_m2
optional
number
nominal_flow_lpm
optional
number
efficiency
optional
number
max_daily_l
optional
number
probes
optional
array<object>
weather_station
optional
object | null
controller_utc_offset
optional
string
field_capacity_pct
optional
number | null

#353: the zone soil's volumetric water content at field capacity (%), a measurement of the site, never a default; given with wilting_point_pct (above it) or not at all. The et0_budget rule's root-zone bucket needs both.

wilting_point_pct
optional
number | null

#353: the zone soil's volumetric water content at the permanent wilting point (%), below field_capacity_pct; given with it or not at all.

Crop

object

A crop of the platform's crop registry.

Properties
NameTypeDescription
code
required
string

The crop code that lots (product) and growing areas (crop) name.

names
required
CropNames
ripeness_scale
required
"levels_1_to_4" | null

The crop's ripeness scale: levels_1_to_4, the four ripeness levels a durian is graded on (1 immature, 2 mature-firm, 3 just ripe, 4 overripe); null when the crop has no ripeness scale.

created_at
required
number

Unix seconds (0 for the crop the platform started with).

updated_at
required
number

Unix seconds of the last change.

CropCreate

object

Properties
NameTypeDescription
code
required
string

The crop code that lots (product) and growing areas (crop) name.

names
required
CropNames
ripeness_scale
optional
"levels_1_to_4" | null

The crop's ripeness scale: levels_1_to_4, the four ripeness levels a durian is graded on (1 immature, 2 mature-firm, 3 just ripe, 4 overripe); null when the crop has no ripeness scale (never for durian, whose ripeness the knocker grades: a null scale for it is 400 invalid_ripeness_scale).

CropDetail

object

A crop of the registry with its rules per destination market and its grading rules.

Properties
NameTypeDescription
code
required
string

The crop code that lots (product) and growing areas (crop) name.

names
required
CropNames
ripeness_scale
required
"levels_1_to_4" | null

The crop's ripeness scale: levels_1_to_4, the four ripeness levels a durian is graded on (1 immature, 2 mature-firm, 3 just ripe, 4 overripe); null when the crop has no ripeness scale.

created_at
required
number

Unix seconds (0 for the crop the platform started with).

updated_at
required
number

Unix seconds of the last change.

markets
required
array<CropMarketRule>
grading_rules
required
array<CropGradingRule>

CropGradingRule

object

The platform's grading rules for one variety of a crop, or for every variety of it (variety null). They apply to a lot whose company has no grading rules of its own for the lot's variety.

Properties
NameTypeDescription
crop
required
string
variety
required
string | null
rules
required
GradingRules
created_at
required
number
updated_at
required
number

CropGradingRulePut

object

Properties
NameTypeDescription
variety
required
string | null

A variety of the crop; null for every variety of it.

rules
required
GradingRules

CropList

object

Properties
NameTypeDescription
items
required
array<Crop>

Every crop of the registry, by code (at most 200).

configured
required
array<string>

The deployment's configured crops (the crops a published code list may name) that have no registry entry: lots and growing areas may name them too, without a sampling rule, a registration protocol or grading rules of their own.

CropMarketRule

object

A crop's rules for one destination market.

Properties
NameTypeDescription
crop
required
string
market
required
string

ISO 3166-1 alpha-2.

registration_protocol
required
boolean

Whether the market's registration protocol applies to the crop: the public lot page then names the protocol for a lot of the crop whose growing area grows it and has a GACC growing-area code.

sampling
required
CropSampling | null

The market's sampling rule; null when it sets none (a lot of the crop for this market is then not sampled).

created_at
required
number
updated_at
required
number

CropMarketRulePut

object

Properties
NameTypeDescription
registration_protocol
required
boolean
sampling
required
CropSampling | null

CropNames

object

The crop's name in Vietnamese, English and Simplified Chinese (each 1 to 100 characters).

Properties
NameTypeDescription
vi
required
string
en
required
string
zh-Hans
required
string

CropSampling

object

A market's sampling rule for the crop: the share of a lot's export fruits sampled, the lower share once the growing area went clean_days without a failed sample, and the analytes a lab tests.

Properties
NameTypeDescription
rule
required
string

The rule's id, unique across crops and markets; every sampling records it.

rule_source
required
string

The http(s) address of the published rule.

base_rate
required
number

0.02 is 2%.

clean_rate
required
number
clean_days
required
integer
analytes
required
array<string>
analytes_source
optional
string | null

The http(s) address that requires these tests; optional.

CropUpdate

object

Properties
NameTypeDescription
names
optional
CropNames
ripeness_scale
optional
"levels_1_to_4" | null

The crop's ripeness scale: levels_1_to_4, the four ripeness levels a durian is graded on (1 immature, 2 mature-firm, 3 just ripe, 4 overripe); null when the crop has no ripeness scale (never for durian, whose ripeness the knocker grades: a null scale for it is 400 invalid_ripeness_scale).

Device

object

A device and its status read model. last_seen, max_seq and last_model come from the device's ingest state (null before its first message); firmware is device.fw of its newest stored envelope that carries one, and battery_pct / battery_v the newest device.battery / device.battery_voltage reading of a status or event envelope, each among its latest 32 stored (accepted or quarantined) envelopes; last_calibrated_at is when its latest succeeded calibrate command completed. ready is true when the device is active, has an active key that may sign for it (its own, or one of an active gateway at its tenant and site) and was last seen within 24 hours.

Properties
NameTypeDescription
device_id
required
string
tenant
required
string
site
required
string

The site segment of the device's ingest route and MQTT topics.

facility
required
string | null

Facility code; null for a device registered before facilities, whose site then stands in for the facility in operator scope.

profile
required
string

Device profile id (without version).

status
required
string

Only active devices are accepted by ingest and the broker.

display_name
required
string | null
vendor_model
required
string | null
serial
required
string | null
created_at
required
number

Unix seconds.

commands
required
array<string>

The downlink commands the device's profile declares, sorted by name: the only names POST /v1/devices/{id}/commands accepts for this device (a facility-scoped operator may issue calibrate only).

last_seen
required
number | null

Unix seconds (server time of the last message).

max_seq
required
integer | null
last_model
required
string | null
firmware
required
string | null
battery_pct
required
number | null
battery_v
required
number | null
last_calibrated_at
required
number | null

Unix seconds.

ready
required
boolean
approval
required
"pending" | "approved" | "rejected"

Platform approval (#201): pending until a platform admin approves or rejects it. Only evidence from an approved device, signed by its own key or an approved gateway's, counts as Device-recorded or above; evidence from a pending or rejected one is stored and counts as Self-declared.

approval_reason
required
string | null

The reason of a rejection; null otherwise.

approval_at
required
number | null

Unix seconds of the last approval decision.

DeviceApproval

object

Properties
NameTypeDescription
keys
required
array<string>

The kids of the identity's waiting keys the platform admin saw in the queue (keys of its DeviceApprovalItem with approval pending), possibly none. Exactly these keys are approved; any other waiting key stays pending. 409 when one is no longer an active key of this device or gateway waiting for approval.

DeviceApprovalItem

object

A device or gateway of any company in the platform's approval queue (#201). The pending queue also lists an approved one with an active key no platform admin approved yet.

Properties
NameTypeDescription
kind
required
"device" | "gateway"
id
required
string

The device or gateway id (one namespace).

tenant
required
string

The company that registered it.

tenant_name
required
string | null
site
required
string
facility
required
string | null
profile
required
string | null

The device profile; null for a gateway.

display_name
required
string | null
registered_by
required
string | null

Who registered it (null before #201, or when the platform provisioned it).

registered_at
required
number | null

Unix seconds; null for an older gateway.

approval
required
"pending" | "approved" | "rejected"
approval_reason
required
string | null
approval_at
required
number | null

Unix seconds of the last decision.

approval_by
required
string | null

Who decided last: a platform admin, provision (the platform's seed) or migration (grandfathered when approval began).

keys
required
array<object>

Its active signing keys (never the public key itself), each with its own approval: a key a company registers after the device or gateway was approved waits for the platform; an approval lists the waiting keys it approves (DeviceApproval).

DeviceApprovalPage

object

Properties
NameTypeDescription
items
required
array<DeviceApprovalItem>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

DeviceCreate

object

Properties
NameTypeDescription
device_id
required
string

Unique across every tenant's devices and gateways. An id starting with agritrace-, in any letter case, is reserved for the platform's own broker identities and refused (400).

profile
required
string

The id of a device profile the server knows; any other id is refused. The profiles, each served as a file: vn.agritrace.air-th-xy-md02 (/developers/downloads/profiles/air-th-xy-md02.json); vn.agritrace.durian-knocker (/developers/downloads/profiles/durian-knocker.json); vn.agritrace.gateway (/developers/downloads/profiles/gateway.json), a gateway's own status heartbeat, refused for a device (invalid profile); vn.agritrace.harvest-app (/developers/downloads/profiles/harvest-app.json); vn.agritrace.irrigation-controller (/developers/downloads/profiles/irrigation-controller.json); vn.agritrace.pack-station (/developers/downloads/profiles/pack-station.json); vn.agritrace.rain-ub-ra-n1 (/developers/downloads/profiles/rain-ub-ra-n1.json); vn.agritrace.reefer-logger (/developers/downloads/profiles/reefer-logger.json); vn.agritrace.scale-serial (/developers/downloads/profiles/scale-serial.json); vn.agritrace.soil-rs485-4in1-ec (/developers/downloads/profiles/soil-rs485-4in1-ec.json); vn.agritrace.soil-rs485-4in1 (/developers/downloads/profiles/soil-rs485-4in1.json).

site
required
string
facility
required
string

A facility code of the caller's tenant.

display_name
optional
string | null
vendor_model
optional
string | null
serial
optional
string | null

DeviceMetadata

object

SENS-B1d (#234): what a device's readings can be judged by: the placement version in force (#225) and the calibrations not superseded. This is the document an EPCIS deviceMetadata link of the device's readings can name: https://txng.theio.vn/v1/devices/{id}/metadata (on this deployment's origin); readable only by the device's company and CropPath, never public. EPCIS exports do not link it yet.

Properties
NameTypeDescription
device_id
required
string
placement
required
DevicePlacement | null

The placement version in force at as_of (an installation, or a removal); null when none has started.

calibrations
required
array<Calibration>

The calibrations not superseded, newest first, at most 1000.

as_of
required
number

The server time the placement in force was read at.

DevicePage

object

Properties
NameTypeDescription
items
required
array<Device>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

DevicePlacement

object

SENS-A2 (#225): one placement version of a device, never changed once recorded: an installation, or a removal (removed_at set, no binding). A version is in force from installed_at (for a removal removed_at, else recorded_at) until valid_until, when the next version starts (null for the current one). Ingest holds an envelope as growing_area_mismatch when the version in force at its time is fixed and bound to another growing area than the one the envelope claims; an envelope timed before the first version is checked against the first version. While a removal is in force, an envelope claiming a growing area raises a device_removed alert and, when the ended installation was fixed, is held (growing_area_mismatch for another area than that installation's, else device_removed).

Properties
NameTypeDescription
device_id
required
string
version
required
integer

1 for the first placement, then 2, 3, ...

mobility
required
"fixed" | "mobile"
key_protection
required
"hardware" | "software"
gnss
required
boolean
growing_area
required
string | null
lat
required
number | null
lon
required
number | null
accuracy_m
required
number | null
fix_at
required
number | null
installed_at
required
number | null
installer
required
string | null
photo_sha256
required
string | null
depth_cm
required
number | null
sensor_serial
required
string | null
note
required
string | null
removed_at
required
number | null

Set on a removal version: when the device was taken out.

recorded_by
optional
string

The CropPath platform admin who recorded it; present for platform admins only.

recorded_at
required
number
valid_until
required
number | null

When the next version starts; null for the current version.

DevicePlacementCreate

object

SENS-A2 (#225): a new placement version of a device, recorded by a platform admin acting for the device's company (X-Tenant). mobility and key_protection are required. A fixed placement must also give the growing area it is bound to (one of the company's), the surveyed install point (lat, lon, accuracy_m) and the commissioning record: photo_sha256 (a JPEG or PNG the company's records hold, uploaded first with PUT /v1/attachments/{sha256} for the same company), fix_at, installed_at and installer. A mobile placement may leave them out. Times are Unix seconds, from 2020-01-01 and at most 300 s ahead of the server clock; fix_at is at most 7 days before installed_at and never after it (300 s of clock drift allowed).

Properties
NameTypeDescription
mobility
required
"fixed" | "mobile"

fixed: a station or probe installed in one place. mobile: a handheld device or phone.

key_protection
required
"hardware" | "software"

The platform admin's statement of where the device keeps its signing key: hardware (a secure element, TPM or attested phone key store) or software. Recorded as stated; not verified by the platform. Owner decision Q3 (#223): location claims count as recorded by a device only with hardware, and never for a device registered before placements existed.

gnss
optional
boolean

The device has its own GNSS receiver. Default false.

growing_area
optional
string

Code of a growing area of the device's company; required for fixed.

lat
optional
number

Install point latitude, WGS84.

lon
optional
number

Install point longitude, WGS84.

accuracy_m
optional
number

Accuracy of the install point fix in metres. lat, lon and accuracy_m come together.

fix_at
optional
number

When the GPS fix of the install point was taken: at most 7 days before installed_at, never after it.

installed_at
optional
number

When the device was installed there: the version is in force from then (from when it was recorded when absent), and may not start before the current version.

installer
optional
string

Who installed it.

photo_sha256
optional
string

SHA-256 of the installer's photo of the installed device (JPEG or PNG).

depth_cm
optional
number

Probe depth in centimetres.

sensor_serial
optional
string

Probe serial number.

note
optional
string

Why it was placed or moved.

DevicePlacementRemoval

object

SENS-A2 (#225): the device was taken out. A new placement version that ends the binding of the installation in force (it keeps that version's mobility, key_protection and gnss; growing area, install point and commissioning record are null). Only a device whose current version is an installation can be removed; a later installation is a new version again. While a removal is in force, an envelope of the device that claims a growing area raises a device_removed alert; when the installation the removal ended was fixed, the envelope is also held: as growing_area_mismatch when it claims another growing area than that installation's, else as device_removed.

Properties
NameTypeDescription
removed_at
required
number

When the device was taken out, Unix seconds: from 2020-01-01, at most 300 s ahead of the server clock, and not before the current version starts.

note
optional
string

Why it was taken out.

DevicePlacements

object

SENS-A2 (#225): a device's placement versions, newest first (at most 1000).

Properties
NameTypeDescription
device_id
required
string
registered_before_placements
required
boolean

The device existed before placements were introduced (owner decision Q3, #223): its location claims stay Self-declared until it is replaced, whatever its placement says.

items
required
array<DevicePlacement>

DeviceRejection

object

Properties
NameTypeDescription
reason
required
string

Shown to the company.

DeviceUpdate

object

Properties
NameTypeDescription
status
optional
"active" | "inactive"
display_name
optional
string | null
vendor_model
optional
string | null
serial
optional
string | null

DidDocument

object

A DID document (W3C DID Core 1.0) of the did:web method: every active and retired key of the facility as a JsonWebKey2020 verification method, each also an assertion method; a revoked key is left out.

Properties
NameTypeDescription
@context
required
array<string>
id
required
string
verificationMethod
required
array<object>
assertionMethod
required
array<string>

EatingWindow

object

When the fruit is expected to be good to eat, counted from the measurement day in Asia/Ho_Chi_Minh; the row of the eating-window table for the effective level, the whole days since the lot's harvest date and the lot's storage band.

Properties
NameTypeDescription
start_days
required
integer
end_days
required
integer
from_date
required
string (date)
to_date
required
string (date)
band
required
"ambient" | "10-13C" | "14-18C"

Storage temperature band of the lot.

warning
required
"immature" | "eat_soon" | "overripe" | null

EatingWindowRow

object

Properties
NameTypeDescription
level
required
integer
min_days
required
integer
max_days
required
integer
band
required
"ambient" | "10-13C" | "14-18C"
start_days
required
integer
end_days
required
integer
warning
required
"immature" | "eat_soon" | "overripe" | null

EmailSettings

object

Properties
NameTypeDescription
notifications
required
boolean

Whether the person gets the notification, alert and recall emails (on until they turn it off). Invitation and password emails are always sent.

language
required
"vi" | "en" | "zh-Hans" | null

The language of the person's emails; null: not known, an email then carries Vietnamese, English and Simplified Chinese.

delivery
required
boolean

Whether this server sends email at all (SMTP configured). When false, one-time links are passed on by hand; when true, each one-time link is also emailed to its person.

EmailSettingsUpdate

object

Properties
NameTypeDescription
notifications
required
boolean
language
optional
"vi" | "en" | "zh-Hans" | null

Omitted or null: not known.

EmailUnsubscribe

object

Properties
NameTypeDescription
token
required
string

The token of the email's link (/login#unsubscribe=<token>).

EmailUnsubscribed

object

Properties
NameTypeDescription
notifications
required
false

Envelope

object

A signed envelope (envelope version 1, spec agritrace.iot/1.0). The server applies the envelope's full schema, served at /developers/downloads/envelope-v1.schema.json; it is deliberately not duplicated here, so this schema is open. An event envelope's eventType and the context keys it requires are those of /developers/downloads/event-types-v1.json; each reading's capability, unit and range are those of /developers/downloads/capabilities-v1.json; device.profile is <profile id>@<profile version> of a device profile below /developers/downloads/profiles/ (see DeviceCreate.profile).

EnvelopeDetail

object

One stored envelope with its signed payload as stored and its signature checked again.

Properties
NameTypeDescription
id
required
string

Envelope id.

device_id
required
string
site
required
string

Site of the ingest route.

facility
required
string | null

The envelope context's facility, null when it names none.

seq
required
integer

The device's sequence number.

kind
required
"telemetry" | "event" | "status"
event_type
required
string | null

Event type; null for telemetry and status.

event_time
required
string

The device's time, as sent.

received_at
required
number

Server receive time, epoch seconds.

status
required
"accepted" | "quarantined" | "rejected_after_review"
reasons
required
array<string>

Why ingest quarantined it; empty when accepted on arrival.

lot
required
string | null

The envelope context's lot.

growing_area
required
string | null

The envelope context's growing area.

payload
required
object

The signed envelope exactly as stored (spec envelope v1).

signature
required
object

valid: the stored key named by sig.kid verifies the stored payload; invalid: it does not (the payload or the key changed since ingest); unknown_key: no stored key has that kid; unsigned: the payload has no sig. The key itself is never returned.

EnvelopePage

object

Properties
NameTypeDescription
items
required
array<EnvelopeSummary>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page. A page with fewer items than the limit, or none, may still have one.

EnvelopeSummary

object

One stored envelope of the device message log (#117): routing and outcome columns only.

Properties
NameTypeDescription
id
required
string

Envelope id.

device_id
required
string
site
required
string

Site of the ingest route.

facility
required
string | null

The envelope context's facility, null when it names none.

seq
required
integer

The device's sequence number.

kind
required
"telemetry" | "event" | "status"
event_type
required
string | null

Event type; null for telemetry and status.

event_time
required
string

The device's time, as sent.

received_at
required
number

Server receive time, epoch seconds.

status
required
"accepted" | "quarantined" | "rejected_after_review"
reasons
required
array<string>

Why ingest quarantined it; empty when accepted on arrival.

lot
required
string | null

The envelope context's lot.

EpcisCaptureReport

object

The outcome of one capture, one result per event in document order.

Properties
NameTypeDescription
capture_id
required
integer

The capture's id (the audit row's entity id).

events
required
integer

Events in the document.

accepted
required
integer

Events stored by this capture.

duplicates
required
integer

Events already held with the same content.

rejected
required
integer

Events refused (nothing written for them).

source
required
"partner_capture"

Provenance of captured events.

tier
required
"self_declared"

Trust tier of captured events (ADR 0001): always Self-declared.

results
required
array<EpcisCaptureResult>

EpcisCaptureResult

object

One event's outcome. step and references only when accepted; code (and usually detail) only when rejected.

Properties
NameTypeDescription
index
required
integer

The event's position in eventList.

event_id
required
string | null

The event's eventID; null when it sent none usable.

status
required
"accepted" | "duplicate" | "rejected"
step
optional
"harvest" | "receive" | "pack" | "ship" | "observe"

The journey step the event records: commissioning is the harvest, receiving, packing, shipping; sensor_reporting (#238) is an observation (observe).

references
optional
array<object>

The tenant's records the event names.

code
optional
"invalid_event" | "unsupported_event_type" | "missing_event_id" | "unsupported_action" | "unsupported_error_declaration" | "unsupported_biz_step" | "event_too_large" | "event_too_deep" | "event_id_conflict" | "no_reference" | "unknown_reference"

Why the event was rejected.

detail
optional
string

The member or the identifier at fault (machine text, not translated).

EpcisDocument

object

An EPCIS 2.0 JSON-LD document; its shape is defined by the EPCIS standard, so the schema is open.

Error

object

Every error body. code is the message head reduced to lower-case snake case.

Properties
NameTypeDescription
error
required
string
code
required
string
items
optional
array<BatchItemError>

A batch request (#170) only: the items that failed, by index. Every invalid item on a 400 invalid_batch; the one item the stored state refused on a batch_rejected, with the status the single-item route gives it.

details
optional
array<AddressToCode>

A seal refused with address_not_coded (#273, owner decision D5) only: each record whose address must be picked from the official list of administrative units (a province and a commune) before the lot can be packed.

ExportLabel

object

What a lot's export carton and pallet labels print for a market, and why they are not ready for export (problems, empty when ready).

Properties
NameTypeDescription
lot
required
string
market
required
string
lot_status
required
string
template_version
required
integer
template
required
ExportLabelTemplate
fields
required
object
pallet
required
object

The selected cartons' totals (the pallet label) and the lot's public URL.

cartons
required
array<ExportLabelCarton>
problems
required
array<"lot_not_packed" | "lot_recalled" | "shipment_market_mismatch" | "fruit_missing" | "origin_missing" | "export_country_missing" | "orchard_missing" | "packing_house_missing" | "producer_missing" | "packing_date_missing" | "address_not_coded" | "orchard_code_not_cross_checked" | "packing_house_code_not_cross_checked" | "no_cartons">
ready
required
boolean
next_cursor
required
string | null

ExportLabelCarton

object

Properties
NameTypeDescription
code
required
string
carton_no
required
integer
net_mass_kg
required
number | null
fruit_count
required
integer
qr_url
required
string (uri)

The carton's public URL: a GS1 Digital Link with the lot's GTIN, else <resolver>/q/<public id>.

label_code
optional
string

#288, with label_code=1 only: the carton's lookup code in its grouped form (three groups of five Crockford base 32 characters), derived from the carton's public id. A person types it on the scan page when the QR code cannot be scanned; GET /v1/public/resolve answers it with the carton's lot.

ExportLabelCodeField

object

The orchard (growing area, PUC code) or the packing house (facility, PHC code).

Properties
NameTypeDescription
name
required
string | null
code
required
string | null

The registration code, only when cross-checked; null otherwise (never printed unchecked).

check
required
"matched" | "no_code" | "no_list" | "not_found" | "mismatch" | "suspended" | "revoked" | "expired"

The code against the published code lists (#150): no_list while no list exists.

cross_checked
required
boolean

Matched on a list that is not stale.

ExportLabelFieldTemplate

object

A field's caption in Chinese and English and whether the label is refused without a value.

Properties
NameTypeDescription
zh
required
string
en
required
string
required
required
boolean

ExportLabelPrint

object

Properties
NameTypeDescription
id
required
integer
lot
required
string
market
required
string
kind
required
"carton" | "pallet"
from
required
integer
to
required
integer
cartons
required
integer
template_version
required
integer
printed_by
required
string
printed_at
required
number

ExportLabelPrintCreate

object

Properties
NameTypeDescription
market
required
string
kind
required
"carton" | "pallet"
from
optional
integer
to
optional
integer
template_version
required
integer

The template version of the label the console read and prints (ExportLabel.template_version); 409 label_changed when another version is in force.

cartons
required
integer

The selection's carton count the console read (ExportLabel.pallet.cartons); 409 label_changed when the selection now holds another count.

ExportLabelTemplate

object

A destination market's label template, text only: the mark on every package and pallet, the export country, the fruit name of each lot product, each field's captions and whether it is required, whether the PUC and PHC codes must be cross-checked, and the rule it follows. Texts are 1 to 120 characters on one line.

Properties
NameTypeDescription
mark
required
ExportLabelText
export_country
required
ExportLabelText
products
required
map<string, ExportLabelText>

The fruit name per lot product (lots.product, e.g. durian).

fields
required
object
require_cross_checked_codes
required
boolean

When true, a label whose PUC or PHC code is not cross-checked against the published code lists is not ready for export.

source
required
string

ExportLabelTemplateList

object

Properties
NameTypeDescription
items
required
array<ExportLabelTemplateView>

ExportLabelTemplateView

object

A market's template in force: version 0 is the built-in default (no edit yet).

Properties
NameTypeDescription
market
required
string
version
required
integer
template
required
ExportLabelTemplate
updated_at
required
number | null
updated_by
required
string | null

ExportLabelText

object

A text of the label in Chinese (zh) and English (en).

Properties
NameTypeDescription
zh
required
string
en
required
string

Facility

object

A facility (packing house) of one tenant. Codes created through the API look like VN-TGPH-021; codes from the migration backfill keep their original spelling.

Properties
NameTypeDescription
code
required
string
tenant
required
string
name
required
string
address
required
string | null
province
required
string | null
district
required
string | null
gacc_phc_code
required
string | null

GACC registration of the packing house.

lines
required
array<string>
source
required
"manual" | "backfill"
approved_at
required
number | null

Unix seconds; null until approved.

slug
required
string
created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

proposed_at
required
number | null

SELF-2-8 (#197): Unix seconds when a company admin proposed the facility (POST /v1/facility-proposals); null for a facility the platform created. A proposal with approved_at null waits for CropPath: no lot, shipment, device, gateway, harvest app key or signing key may name it.

commune
optional
string | null

The commune's official name (xã, phường or đặc khu) when the record is coded; else null. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

province_code
optional
string | null

The province's official 2-digit code, in the list admin_units_version; null when not coded. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

commune_code
optional
string | null

The commune's official 5-digit code, in the list admin_units_version; null when not coded. A code is only meaningful with its version (codes were reused across the 2025 reform). Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

admin_units_version
optional
string | null

The version of the official list the codes were taken from (for example vn-2026-10-17); null without codes. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_before_reform
optional
object | null

The province, district and commune text the record held before it was coded, or the text a request gave through the deprecated text path; kept for good once set. Null for a record entered with codes. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_status
optional
"coded" | "choose_commune" | "needs_commune" | "outside_vietnam" | null

coded: the codes are set from the official list; choose_commune: the old commune was split, a person picks one of address_candidates; needs_commune: no codes yet (given as text, or before the reform), a person picks the commune; outside_vietnam: a company profile in another country, where the codes do not apply. Null for a record not reviewed since the codes were introduced. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_candidates
optional
array<string> | null

For choose_commune: the official commune codes to pick from; else null. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

FacilityCertification

object

#269: a packing-house certification of a facility. Shown to the company's staff only: no trust tier and no public page uses them (architect decision on #269; ADR 0001).

Properties
NameTypeDescription
id
required
integer
facility
required
string
scheme
required
"ISO 22000" | "FSSC 22000" | "BRCGS" | "IFS"

The packing-house certification scheme, compared exactly.

number
required
string

The certificate number.

issuer
required
string

The certifier (certification body) that issued the certificate.

valid_from
required
string (date)

The first valid day.

valid_to
required
string (date)

The last valid day, not before valid_from.

evidence_sha256
required
string

The SHA-256 of the certificate document, a company upload (GET /v1/attachments/{sha256} for the facility's readers; never public).

created_at
required
number

When it was recorded (Unix seconds).

ended_on
required
string (date) | null (date)

The day it stopped being in force (withdrawn, suspended or replaced), from valid_from to valid_to; null while it was not ended.

end_reason
required
string | null

Why it was ended; null while not.

ended_at
required
number | null

When it was ended (Unix seconds); null while not.

status
required
"valid" | "expired" | "not_yet_valid" | "ended"

On today's date in Viet Nam: ended from ended_on, else not_yet_valid before valid_from, expired after valid_to, valid otherwise.

FacilityCertificationCreate

object

#269: a packing-house certification to record on a facility.

Properties
NameTypeDescription
scheme
required
"ISO 22000" | "FSSC 22000" | "BRCGS" | "IFS"

The packing-house certification scheme, compared exactly.

number
required
string

The certificate number.

issuer
required
string

The certifier.

valid_from
required
string (date)
valid_to
required
string (date)

Not before valid_from.

evidence_sha256
required
string

The SHA-256 of the certificate document the company uploaded first with PUT /v1/attachments/{sha256}.

FacilityCertificationEnd

object

#269: the end of a facility's certification.

Properties
NameTypeDescription
ended_on
required
string (date)

The day it stopped being in force, from valid_from to valid_to.

reason
required
string

Why it was ended.

FacilityCertificationList

object

#269: every certification of a facility (at most 100), newest valid_from first.

Properties
NameTypeDescription
items
required
array<FacilityCertification>

FacilityCreate

object

Properties
NameTypeDescription
code
required
string
name
required
string
address
optional
string | null
province
optional
string | null

Deprecated (#273), sunset 1 May 2027: the province as free text. Send province_code and commune_code instead. A body that gives the address as text only is still accepted until the sunset: the record is stored as not yet coded (address_status needs_commune) and the answer carries the Deprecation, Sunset and Link headers.

district
optional
string | null

Deprecated (#273), sunset 1 May 2027: Viet Nam has had no district level since 1 July 2025. Send province_code and commune_code instead; with them district must be absent or null (400 district_with_codes).

province_code
optional
string | null

#273: the province (tỉnh or thành phố trực thuộc trung ương) by its official 2-digit code in the administrative units list in force (getAdminUnits). Sent with commune_code, both or neither; with them province, district and commune must be absent or null and the server writes the official names.

commune_code
optional
string | null

#273: the commune (xã, phường or đặc khu) by its official 5-digit code in the administrative units list in force (getAdminUnits with province). Sent with province_code, both or neither; the commune must lie in that province by the list, never by its digits.

gacc_phc_code
optional
string | null
lines
optional
array<string>
slug
optional
string

FacilityGln

object

#161: a facility's GLN (EPCIS read point and business location of its events).

Properties
NameTypeDescription
facility
required
string
gln
required
string | null

GS1 Global Location Number: 13 digits, the last the GS1 mod-10 check digit; null when none.

FacilityPage

object

Properties
NameTypeDescription
items
required
array<Facility>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

FacilityProposal

object

SELF-2-8 (#197): a company's facility proposal waiting for CropPath, in the platform's queue.

Properties
NameTypeDescription
code
required
string
tenant
required
string
tenant_name
required
string

The proposing company's name.

name
required
string
address
required
string | null
province
required
string | null
district
required
string | null
lines
required
array<string>
slug
required
string

The default slug of the code; the approval may set another.

proposed_at
required
number

Unix seconds.

proposed_by
required
string | null

Who proposed it (the account's email).

FacilityProposalApproval

object

SELF-2-8 (#197): what CropPath sets when it approves a proposal (both optional; the slug is the facility's did:web path).

Properties
NameTypeDescription
slug
optional
string
gacc_phc_code
optional
string | null

FacilityProposalCreate

object

SELF-2-8 (#197): what a company admin gives when proposing a facility. Never the slug or the GACC PHC code: CropPath sets both when it approves the proposal.

Properties
NameTypeDescription
code
required
string
name
required
string
address
optional
string | null
province
optional
string | null

Deprecated (#273), sunset 1 May 2027: the province as free text. Send province_code and commune_code instead. A body that gives the address as text only is still accepted until the sunset: the record is stored as not yet coded (address_status needs_commune) and the answer carries the Deprecation, Sunset and Link headers.

district
optional
string | null

Deprecated (#273), sunset 1 May 2027: Viet Nam has had no district level since 1 July 2025. Send province_code and commune_code instead; with them district must be absent or null (400 district_with_codes).

province_code
optional
string | null

#273: the province (tỉnh or thành phố trực thuộc trung ương) by its official 2-digit code in the administrative units list in force (getAdminUnits). Sent with commune_code, both or neither; with them province, district and commune must be absent or null and the server writes the official names.

commune_code
optional
string | null

#273: the commune (xã, phường or đặc khu) by its official 5-digit code in the administrative units list in force (getAdminUnits with province). Sent with province_code, both or neither; the commune must lie in that province by the list, never by its digits.

lines
optional
array<string>

FacilityProposalPage

object

Properties
NameTypeDescription
items
required
array<FacilityProposal>
next_cursor
required
string | null

FacilityProposalRejected

object

SELF-2-8 (#197): the proposal CropPath rejected (it is deleted, so its code is free again).

Properties
NameTypeDescription
code
required
string
tenant
required
string
name
required
string
reason
required
string

FacilityProposalRejection

object

Properties
NameTypeDescription
reason
required
string

Shown to the company in its activity log.

FacilityUpdate

object

gacc_phc_code and slug: platform_admin only.

Properties
NameTypeDescription
name
optional
string
address
optional
string | null
province
optional
string | null

Deprecated (#273), sunset 1 May 2027: the province as free text. Send province_code and commune_code instead. A body that gives the address as text only is still accepted until the sunset: the record is stored as not yet coded (address_status needs_commune) and the answer carries the Deprecation, Sunset and Link headers.

district
optional
string | null

Deprecated (#273), sunset 1 May 2027: Viet Nam has had no district level since 1 July 2025. Send province_code and commune_code instead; with them district must be absent or null (400 district_with_codes).

province_code
optional
string | null

#273: the province (tỉnh or thành phố trực thuộc trung ương) by its official 2-digit code in the administrative units list in force (getAdminUnits). Sent with commune_code, both or neither; with them province, district and commune must be absent or null and the server writes the official names.

commune_code
optional
string | null

#273: the commune (xã, phường or đặc khu) by its official 5-digit code in the administrative units list in force (getAdminUnits with province). Sent with province_code, both or neither; the commune must lie in that province by the list, never by its digits.

gacc_phc_code
optional
string | null
lines
optional
array<string>
slug
optional
string

FourEyesState

object

INTEGRITY-3 (#203). The selected company's second admin approval: whether its critical actions wait for a second admin, how many active company admins it has (fewer than 2: CropPath support is the second approver), how many requests wait for a decision, and how long a request may wait.

Properties
NameTypeDescription
require_second_admin
required
boolean
admins
required
integer

Active company admins (active membership and account).

pending
required
integer

Requests waiting for a decision (not expired).

expires_after_s
required
integer

Seconds a request may wait (72 hours).

FourEyesUpdate

object

Properties
NameTypeDescription
require_second_admin
required
boolean

Fruit

object

A fruit record: identity, label fields and the measurements bound to it (L3).

Properties
NameTypeDescription
tenant
required
string
code
required
string

Fruit code Q-<lot seq>-<n>, unique within the tenant.

n
required
integer

Position of the fruit in its lot: 1, 2, ... without gaps.

public_id
required
string

128 random bits (hex); the public handle of the fruit, never derived from code or n.

lot
required
string

Lot code.

session
required
string

Measurement session id.

line
required
string

The session's line.

operator
required
string | null

Opaque operator id user-<id> of the signed-in user who allocated it; null for API tokens.

status
required
"awaiting_device" | "recorded" | "overridden" | "rejected" | "remeasured"

Fruit record state; allocation starts at awaiting_device.

labels_printed_at
required
number | null

Unix seconds the label was printed (allocation).

created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

qr_url
required
string (uri)

The QR content: a GS1 Digital Link <base>/01/<gtin>/10/<lot>/21/<serial> (20-character random serial) when the lot has a GTIN and a lot code of at most 20 characters, else <base>/q/<public_id>. The base is the deployment's resolver origin, AGRITRACE_RESOLVER_BASE (default https://txng.theio.vn).

level
required
integer | null

Effective ripeness level (1 Non, 2 Gia, 3 Chin toi, 4 Chin ruc): level_sensory while an override is bound, else level_pred.

level_pred
required
integer | null

The level the knocker sent (produce.ripeness_level); null when it sent none (a mature class is level 2 or 3 and is never guessed).

maturity_class
required
"immature" | "mature" | "overripe" | "defect" | "unknown" | null

The knocker's produce.maturity_class.

confidence
required
number | null

Model confidence 0-1.

model
required
string | null

Model version that made the prediction.

measured_at
required
number | null

Unix seconds of the knock (device event time).

weight_kg
required
number | null

Net mass from the bound scale reading.

level_sensory
required
integer | null

The operator's sensory override (keys 1-4), if bound.

override
required
boolean

A sensory override is bound.

pending_review
required
boolean

Overlay: a bound envelope is quarantined and waits for review.

grade
required
"A" | "B" | "reject" | null

Grade under the tenant's rules for the lot's variety (else the platform default), derived when the fruit was last bound or reviewed; null until a signed knock, a level and a weight are known (a defect or a reject level grades reject at once).

eating_window
required
EatingWindow | null
record_tier
required
"self_declared" | "device_recorded" | "cross_checked" | "lab_verified" | null

Trust tier of the fruit's own record, derived at read time; null until a knock is bound. Cross-checked needs the per-fruit volume quota, not reconciled yet.

knock_envelope_id
required
string | null

The bound knock envelope.

scale_envelope_id
required
string | null

The bound scale envelope.

override_envelope_id
required
string | null

The bound sensory-override envelope.

FruitActionCommand

object

The re-measure's set_session outcome for one device of the fruit's session, as on allocation (SessionCommand), plus skipped with reason session_not_open when the session is not open (nothing is sent).

Properties
NameTypeDescription
device_id
required
string
command_id
required
string | null
status
required
"pending" | "sent" | "failed" | "refused" | "skipped"
reason
required
"not_declared" | "dispatch_failed" | "device_not_found" | "device_not_approved" | "invalid_command" | "session_not_open" | null

FruitActionRequest

object

An operator action on a fruit (L4).

Properties
NameTypeDescription
type
required
"accept" | "remeasure" | "reject" | "override"
level
optional
integer

The sensory ripeness level (keys 1-4); required for override, refused otherwise.

reason
optional
string | null

Optional free text without control characters (U+0000-U+001F, U+007F-U+009F) and with at least one character outside ECMA-262 whitespace (U+FEFF included), stored with the action only (never returned or audited). The pattern is ECMA-262 and ASCII only (\x escapes and ECMA-262's \s/\S), so generated clients copy it verbatim; an engine whose \s is not ECMA-262's (Python re leaves out U+FEFF) must use ECMA-262's set.

idempotency_key
required
string

Client-chosen key, unique per tenant (a UUID fits).

client_ts
required
string

When the operator acted, ISO 8601 with a zone offset; stored as given.

FruitActionResult

object

The stored outcome of an action: the same body for the first request and every replay.

Properties
NameTypeDescription
action
required
object
fruit
required
Fruit
accepted_at
required
number | null

Unix seconds the fruit was first accepted into the lot (this round); null again once the bound measurement changes.

measurement_round
required
integer

Re-measures so far: 0 for the first measurement.

commands
required
array<FruitActionCommand>

set_session per device of the session (re-measure only; empty otherwise).

FruitAllocate

object

No fields: the operator is the caller, the line and lot are the session's.

FruitAllocated

object

The new fruit, its label payload and the set_session outcome per device of the session.

Properties
NameTypeDescription
tenant
required
string
code
required
string

Fruit code Q-<lot seq>-<n>, unique within the tenant.

n
required
integer

Position of the fruit in its lot: 1, 2, ... without gaps.

public_id
required
string

128 random bits (hex); the public handle of the fruit, never derived from code or n.

lot
required
string

Lot code.

session
required
string

Measurement session id.

line
required
string

The session's line.

operator
required
string | null

Opaque operator id user-<id> of the signed-in user who allocated it; null for API tokens.

status
required
"awaiting_device" | "recorded" | "overridden" | "rejected" | "remeasured"

Fruit record state; allocation starts at awaiting_device.

labels_printed_at
required
number | null

Unix seconds the label was printed (allocation).

created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

qr_url
required
string (uri)

The QR content: a GS1 Digital Link <base>/01/<gtin>/10/<lot>/21/<serial> (20-character random serial) when the lot has a GTIN and a lot code of at most 20 characters, else <base>/q/<public_id>. The base is the deployment's resolver origin, AGRITRACE_RESOLVER_BASE (default https://txng.theio.vn).

label
required
FruitLabel
commands
required
array<SessionCommand>

The set_session outcome per device of the session.

level
required
integer | null

Effective ripeness level (1 Non, 2 Gia, 3 Chin toi, 4 Chin ruc): level_sensory while an override is bound, else level_pred.

level_pred
required
integer | null

The level the knocker sent (produce.ripeness_level); null when it sent none (a mature class is level 2 or 3 and is never guessed).

maturity_class
required
"immature" | "mature" | "overripe" | "defect" | "unknown" | null

The knocker's produce.maturity_class.

confidence
required
number | null

Model confidence 0-1.

model
required
string | null

Model version that made the prediction.

measured_at
required
number | null

Unix seconds of the knock (device event time).

weight_kg
required
number | null

Net mass from the bound scale reading.

level_sensory
required
integer | null

The operator's sensory override (keys 1-4), if bound.

override
required
boolean

A sensory override is bound.

pending_review
required
boolean

Overlay: a bound envelope is quarantined and waits for review.

grade
required
"A" | "B" | "reject" | null

Grade under the tenant's rules for the lot's variety (else the platform default), derived when the fruit was last bound or reviewed; null until a signed knock, a level and a weight are known (a defect or a reject level grades reject at once).

eating_window
required
EatingWindow | null
record_tier
required
"self_declared" | "device_recorded" | "cross_checked" | "lab_verified" | null

Trust tier of the fruit's own record, derived at read time; null until a knock is bound. Cross-checked needs the per-fruit volume quota, not reconciled yet.

knock_envelope_id
required
string | null

The bound knock envelope.

scale_envelope_id
required
string | null

The bound scale envelope.

override_envelope_id
required
string | null

The bound sensory-override envelope.

FruitBatchItem

object

A fruit allocated by a batch with its label payload; a batch issues no device command.

Properties
NameTypeDescription
tenant
required
string
code
required
string

Fruit code Q-<lot seq>-<n>, unique within the tenant.

n
required
integer

Position of the fruit in its lot: 1, 2, ... without gaps.

public_id
required
string

128 random bits (hex); the public handle of the fruit, never derived from code or n.

lot
required
string

Lot code.

session
required
string

Measurement session id.

line
required
string

The session's line.

operator
required
string | null

Opaque operator id user-<id> of the signed-in user who allocated it; null for API tokens.

status
required
"awaiting_device" | "recorded" | "overridden" | "rejected" | "remeasured"

Fruit record state; allocation starts at awaiting_device.

labels_printed_at
required
number | null

Unix seconds the label was printed (allocation).

created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

qr_url
required
string (uri)

The QR content: a GS1 Digital Link <base>/01/<gtin>/10/<lot>/21/<serial> (20-character random serial) when the lot has a GTIN and a lot code of at most 20 characters, else <base>/q/<public_id>. The base is the deployment's resolver origin, AGRITRACE_RESOLVER_BASE (default https://txng.theio.vn).

label
required
FruitLabel
level
required
integer | null

Effective ripeness level (1 Non, 2 Gia, 3 Chin toi, 4 Chin ruc): level_sensory while an override is bound, else level_pred.

level_pred
required
integer | null

The level the knocker sent (produce.ripeness_level); null when it sent none (a mature class is level 2 or 3 and is never guessed).

maturity_class
required
"immature" | "mature" | "overripe" | "defect" | "unknown" | null

The knocker's produce.maturity_class.

confidence
required
number | null

Model confidence 0-1.

model
required
string | null

Model version that made the prediction.

measured_at
required
number | null

Unix seconds of the knock (device event time).

weight_kg
required
number | null

Net mass from the bound scale reading.

level_sensory
required
integer | null

The operator's sensory override (keys 1-4), if bound.

override
required
boolean

A sensory override is bound.

pending_review
required
boolean

Overlay: a bound envelope is quarantined and waits for review.

grade
required
"A" | "B" | "reject" | null

Grade under the tenant's rules for the lot's variety (else the platform default), derived when the fruit was last bound or reviewed; null until a signed knock, a level and a weight are known (a defect or a reject level grades reject at once).

eating_window
required
EatingWindow | null
record_tier
required
"self_declared" | "device_recorded" | "cross_checked" | "lab_verified" | null

Trust tier of the fruit's own record, derived at read time; null until a knock is bound. Cross-checked needs the per-fruit volume quota, not reconciled yet.

knock_envelope_id
required
string | null

The bound knock envelope.

scale_envelope_id
required
string | null

The bound scale envelope.

override_envelope_id
required
string | null

The bound sensory-override envelope.

FruitBatchResult

object

The fruits a batch allocated, by n.

Properties
NameTypeDescription
batch_id
required
integer

The stored batch request's id.

count
required
integer
items
required
array<FruitBatchItem>

In request order.

FruitLabel

object

What the label printer prints for the fruit.

Properties
NameTypeDescription
code
required
string
lot
required
string
n
required
integer
line
required
string
operator
required
string | null
printed_at
required
number | null

Unix seconds.

qr_url
required
string (uri)
label_code
optional
string

#326, in the fruit batch's answer with label_code=1 only: the fruit's lookup code (#288) in its grouped form (three groups of five Crockford base 32 characters), derived from the fruit's public id. A label prints it beside the QR code, as the console's 40 x 30 mm label does; a person types it on the scan page when the QR code cannot be scanned, and GET /v1/public/resolve answers it with the fruit.

FruitPage

object

Properties
NameTypeDescription
items
required
array<Fruit>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

FsmaRow

object

One row of the FSMA 204 sortable spreadsheet (GET /v1/fsma.csv, GET /v1/lots/{lot}/fsma.csv; #158): every column on every row, in this order, an empty cell an empty string. One row per critical tracking event, sorted by time. The key data elements of 21 CFR 1 Subpart S, checked column by column against FDA's sortable spreadsheet template.

Properties
NameTypeDescription
traceability_lot_code
required
string

The traceability lot code: the lot's code. On a transformation row, the NEW lot's code (the lot the merge produced, #91).

critical_tracking_event
required
"harvesting" | "receiving" | "cooling" | "initial_packing" | "shipping" | "transformation"

The FSMA 204 critical tracking event: harvesting, receiving, cooling and initial_packing from a signed device event (/developers/downloads/event-types-v1.json), shipping from a signed device event or a departed shipment, transformation from a lot merge (#91).

event_date
required
string (date)

The event's date, YYYY-MM-DD: in the offset the device signed for a device event, in Asia/Ho_Chi_Minh (+07:00) for a departure or a merge.

event_time
required
string

The event's time with its offset, whole seconds, hh:mm:ss+hh:mm (the same offset as event_date).

location
required
string

The code of the facility (or growing area) where the event happened: the device event's facility, the shipment's departure facility, the merge's facility.

quantity
required
number | ""

The quantity: the mass.net reading of a device event, the kilograms of the lot's cartons on a departed shipment, or the kilograms the merge produced (transformation); empty without one.

unit_of_measure
required
string

The quantity's unit: the reading's unit for a device event, kg for a departure or a merge; empty without a quantity.

growing_area
required
string

The growing area code: the device event's, or the lot's for a departure or a merge; empty without one.

parcel
required
string

The parcel the device event names; empty otherwise.

producer
required
string

The producer the device event names; empty otherwise.

device_id
required
string

The id of the device that signed the event; empty on a row the platform recorded (a departure, a merge).

event_id
required
string

The signed device event's envelope id, or the merge's event id on a transformation row (the eventID of its EPCIS TransformationEvent without urn:uuid:); empty on a departure.

commodity
required
string

The lot's product (for example durian); empty when the lot code is not one of the company's lots.

variety
required
string

The lot's variety (for example Ri6); empty without one.

field_name
required
string

The name the grower uses for the row's growing area (FSMA 204: the name of the field or other growing area the food was harvested from); empty when the area has no name. The area's code is in growing_area.

traceability_lot_code_source
required
string

Where the traceability lot code was assigned: the lot's facility, its name and address (street, district, province); empty when the lot code is not one of the company's lots. #273: a facility coded by official administrative unit codes has its commune and province instead (Viet Nam has had no district level since 2025-07-01).

traceability_lot_code_source_reference
required
string

The GS1 GLN of that facility (#161), a reference that may be given instead of the location description; empty without a GLN.

shipper_location_name
required
string

Where the food came from. Shipping: the name of the facility it was shipped from. Receiving: the growing area's name (the farm it came from). Empty on other rows.

shipper_location_address
required
string

That location's address: the facility's street, district and province, or the growing area's commune, district and province. #273: a facility or growing area coded by official administrative unit codes has its commune and province instead (Viet Nam has had no district level since 2025-07-01).

shipper_location_gln
required
string

That location's GS1 GLN (#161); empty without one.

recipient_location_name
required
string

Where the food went. Shipping from a departed shipment: the consignee's legal name (the immediate subsequent recipient, #153). Receiving: the name of the facility that received it. Empty on other rows.

recipient_location_address
required
string

That location's address: the consignee's postal address and country (ISO 3166-1 alpha-2), or the facility's street, district and province. #273: a facility coded by official administrative unit codes has its commune and province instead (Viet Nam has had no district level since 2025-07-01).

recipient_location_gln
required
string

That location's GS1 GLN: the consignee's (#153) or the facility's (#161); empty without one.

reference_document_type
required
string

The types of the departed shipment's documents (#153: phytosanitary_certificate, certificate_of_origin, commercial_invoice, packing_list, customs_declaration, bill_of_lading, air_waybill, test_report, other), sorted, separated by "; "; empty on other rows.

reference_document_number
required
string

The numbers of those documents, in the same order, separated by "; ".

container
required
string

The ISO 6346 container number of the departed shipment; empty otherwise.

input_traceability_lot_code
required
string

Transformation row: the code of the lot the merge used (one row per lot used); empty on other rows.

input_quantity
required
number | ""

Transformation row: the kilograms the merge took from that lot (unit_of_measure kg); empty on other rows.

Gateway

object

Properties
NameTypeDescription
gateway_id
required
string
tenant
required
string
site
required
string
facility
required
string | null
display_name
required
string | null
status
required
string
approval
required
"pending" | "approved" | "rejected"

Platform approval (#201): pending until a platform admin approves or rejects it. Only evidence from an approved device, signed by its own key or an approved gateway's, counts as Device-recorded or above; evidence from a pending or rejected one is stored and counts as Self-declared.

approval_reason
required
string | null

The reason of a rejection; null otherwise.

approval_at
required
number | null

Unix seconds of the last approval decision.

GatewayCreate

object

Properties
NameTypeDescription
gateway_id
required
string

Unique across every tenant's gateways and devices. An id starting with agritrace-, in any letter case, is reserved for the platform's own broker identities and refused (400).

site
required
string
facility
optional
string | null

A facility code of the caller's tenant.

display_name
optional
string | null

GatewayHeartbeat

object

Properties
NameTypeDescription
received_at
required
number

Unix seconds when the server received it.

time
required
string

The gateway's own time of the heartbeat (ISO 8601 with its UTC offset).

seq
required
integer

The gateway's sequence number of the heartbeat.

signed
required
boolean

Signed with one of the gateway's own keys (false only where the server accepts unsigned envelopes).

outbox_depth
required
integer | null

gateway.outbox_depth: messages waiting in the gateway's store-and-forward queue.

dead_letter_count
required
integer | null

gateway.dead_letter_count: messages the server refused for good that the gateway keeps.

link
required
GatewayLink | null

gateway.link: the gateway's uplink as it last observed it.

peripherals_ready
required
array<GatewayPeripheral> | null

gateway.peripherals_ready: each device the gateway serves and whether its driver is ready.

GatewayHeartbeatStatus

object

Properties
NameTypeDescription
gateway_id
required
string
heartbeat
required
GatewayHeartbeat | null

The newest heartbeat; null until the gateway sent one.

GatewayPage

object

Properties
NameTypeDescription
items
required
array<Gateway>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

GatewayPeripheral

object

Properties
NameTypeDescription
device
required
string
ready
required
boolean

GatewayStatusBucket

object

An hourly rollup, or a day's hourly rollups merged.

Properties
NameTypeDescription
bucket_start
required
number

Start of the UTC hour or day, Unix seconds.

samples
required
integer
outbox_depth
required
GatewayStatusStat
dead_letter_count
required
GatewayStatusStat
peripherals_ready
required
GatewayStatusStat

The devices the gateway listed as ready.

peripherals_total
required
GatewayStatusStat

The devices the gateway listed.

link
required
object

The samples per uplink state (a sample without one is in none).

GatewayStatusSample

object

The heartbeat stored for one UTC minute. A value the heartbeat did not carry is null.

Properties
NameTypeDescription
minute
required
number

Start of the UTC minute of reception, Unix seconds.

received_at
required
number

When the server received it, Unix seconds.

time
required
string

The gateway's own time of the heartbeat.

seq
required
integer
signed
required
boolean
outbox_depth
required
integer | null
dead_letter_count
required
integer | null
link_state
required
"connected" | "disconnected" | "unknown" | null
peripherals_ready
required
integer | null

The devices listed as ready.

peripherals_total
required
integer | null

The devices listed.

GatewayStatusSeries

object

#128: a gateway's status series: samples (grain minute) or rollups (hourly, daily), oldest first.

Properties
NameTypeDescription
gateway_id
required
string
grain
required
"minute" | "hourly" | "daily"
bucket_s
required
number

Bucket width in seconds: 60, 3600 or 86400.

from
required
number

Start of the range read, Unix seconds: aligned down to the grain and clipped to what is kept.

to
required
number

End of the range (excluded), Unix seconds.

items
required
array<GatewayStatusSample | GatewayStatusBucket>

Samples for grain minute, rollups otherwise.

GatewayStatusStat

object

One value over a bucket's samples that carried it.

Properties
NameTypeDescription
min
required
integer | null
max
required
integer | null
mean
required
number | null

Null when no sample carried the value.

count
required
integer

The samples that carried the value.

GeofenceVerdict

"inside" | "near" | "outside" | "ambiguous" | "unverifiable" | "no_position" | "no_polygon"

SENS-B1e (#235): a geofence verdict of a position against a growing area's boundary.

GeoJsonPolygon

object

A GeoJSON Polygon or MultiPolygon in WGS 84. Never public: only the owning tenant_admin and platform_admin see it.

Properties
NameTypeDescription
type
required
"Polygon" | "MultiPolygon"
coordinates
required
array<any>

Polygon: closed rings of [longitude, latitude] (at least 4 positions each, first equals last); MultiPolygon: 1 to 64 such polygons. At most 5000 positions and 256 KiB in all.

GlnChange

object | object

Set the GLN (13 digits with its check digit, a number of the company's own GS1 membership, not under the platform's prefix), clear it (null), or allocate the next GLN of the platform's GS1 company prefix (allocate: true).

GradingRule

object

Properties
NameTypeDescription
id
required
integer

Server id (the audit entity id).

tenant
required
string
variety
required
string

The lot variety these rules apply to.

rules
required
GradingRules
updated_at
required
number

Unix seconds.

updated_by
required
string

The principal that last wrote them.

GradingRuleHistory

object

Properties
NameTypeDescription
variety
required
string
items
required
array<GradingRuleVersion>
next_cursor
required
string | null

The next page's cursor; null on the last.

GradingRulePage

object

Properties
NameTypeDescription
items
required
array<GradingRule>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

platform_default
required
GradingRules

The platform default rules, normalized: what a variety without rules of its own (and a lot without a variety) is graded with. An editor starts a new variety from it.

GradingRules

object

Grading rules of one variety. Grade: reject for a defect or a level in reject_levels; otherwise none until a level and a weight are known; A for a level in a_levels with the weight in an A band (inclusive), confidence at least a_min_confidence, nothing pending review and no sensory override conflict; else B. A level cannot be in both lists. The platform default (used for a variety without rules) is A levels [2, 3], reject levels [1, 4], A band 2.0-5.0 kg and confidence 0.8: placeholders until the buyer bands are known.

Properties
NameTypeDescription
a_levels
required
array<integer>
reject_levels
required
array<integer>
a_weight_kg
required
array<array<number>>

[min, max] kg bands, 0 < min < max <= 100, strictly non-overlapping.

a_min_confidence
required
number
eating_window
required
array<EatingWindowRow>

Rows of level x days since cut (min_days..max_days, inclusive) x band; rows of one level and band do not overlap.

GradingRuleVersion

object

One version of a variety's rules: numbered 1, 2, ... per rule, as each PUT wrote it.

Properties
NameTypeDescription
version
required
integer
rules
required
GradingRules
updated_at
required
number

Unix seconds.

updated_by
required
string

Who wrote this version.

Grower

object

A grower (personal data) of one tenant, as the caller may see it.

Properties
NameTypeDescription
id
required
integer
tenant
required
string
name
optional
string

Present only for the owning tenant_admin and platform_admin, or for other readers when public_consent is on.

display_name
required
string

The name with public consent, otherwise Co-op member #<id>.

cooperative
required
string | null
public_consent
required
boolean

Explicit consent to show the grower's name publicly.

consent_at
required
number | null

Unix seconds consent was given; null without consent.

consent_date
required
string (date) | null (date)

The day the grower gave the consent (YYYY-MM-DD, not after today); null without consent. Staff only, never on a public route.

consent_scope
required
string | null

What the consent covers, as recorded from the consent form (staff-only text); null without consent or when not recorded. Never on a public route.

created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

GrowerBatch

object

Up to 1,000 growers.

Properties
NameTypeDescription
items
required
array<GrowerCreate>

GrowerBatchResult

object

The growers a batch created, in request order.

Properties
NameTypeDescription
batch_id
required
integer

The stored batch request's id.

count
required
integer
items
required
array<Grower>

In request order.

GrowerConsent

object

#163. One decision of a grower about one purpose and market (append-only); the latest of a (purpose, market) is the one in force.

Properties
NameTypeDescription
id
required
integer
grower_id
required
integer
purpose
required
"public_name" | "orchard_position"

public_name: the grower's name on the public fruit page; orchard_position: the orchard's position on public pages (no public page shows one today).

market
required
string | null

ISO 3166-1 alpha-2 market the decision is for; null: every market.

decision
required
"granted" | "withdrawn"
channel
required
"paper" | "electronic" | "in_person" | "record_edit" | "migrated" | "data_request"

How the decision reached the company: a signed paper form, an electronic message, in_person or by phone; or, written by the platform, record_edit (the grower form's consent flag), migrated (a consent recorded before #163), data_request (withdrawn while handling the grower's request request_id).

evidence_sha256
required
string | null

SHA-256 of the evidence (the scanned form or the message), or null.

consent_date
required
string (date) | null (date)

The day on the form (YYYY-MM-DD), or null.

scope
required
string | null

What the decision covers (staff-only text), or null.

request_id
required
integer | null

The grower data request handled with this withdrawal (data_request), or null.

recorded_at
required
number

Seconds since 1970 (UTC).

recorded_by
required
string

Who recorded it: an opaque operator id (user-<id>, token-<id>, client-<id>), never an email; system or migration for the platform.

GrowerConsentCreate

object

#163. A grower's decision as staff record it. A grant needs written evidence: channel paper or electronic and evidence_sha256; a withdrawal is accepted however the grower made it.

Properties
NameTypeDescription
purpose
required
"public_name" | "orchard_position"

public_name: the grower's name on the public fruit page; orchard_position: the orchard's position on public pages (no public page shows one today).

market
optional
string | null

ISO 3166-1 alpha-2 market the decision is for; null: every market.

decision
required
"granted" | "withdrawn"
channel
required
"paper" | "electronic" | "in_person"
evidence_sha256
optional
string | null

SHA-256 of the evidence (64 lowercase hex digits); required for a grant.

consent_date
optional
string (date) | null (date)

The day on the form (YYYY-MM-DD), from 2000-01-01, not after today.

scope
optional
string | null

What it covers: one line of at most 200 characters (staff-only).

GrowerConsentPage

object

#163. A grower's consents in force and one page of its consent records, newest first.

Properties
NameTypeDescription
grower_id
required
integer
in_force
required
array<object>

Every (purpose, market) whose latest decision is a grant. The public fruit page names the grower with public_name for the destination market of the shipment its lot is on, or else with public_name for every market (market null); a lot on no shipment has no market, so only the every-market consent names the grower there.

items
required
array<GrowerConsent>
next_cursor
required
string | null

The next page's cursor; null on the last.

GrowerCreate

object

Properties
NameTypeDescription
name
required
string
cooperative
optional
string | null
public_consent
optional
boolean
consent_date
optional
string (date) | null (date)

The day the grower gave the consent (YYYY-MM-DD, not after today). Accepted only when public_consent is (or becomes) true; withdrawing the consent clears it.

consent_scope
optional
string | null

What the consent covers (staff-only text). Accepted only when public_consent is (or becomes) true; withdrawing the consent clears it.

GrowerDataRequest

object

#163. A grower's request about their personal data, as the company received it.

Properties
NameTypeDescription
id
required
integer
grower
required
object
kind
required
"access" | "rectification" | "erasure" | "objection"
channel
required
"paper" | "electronic" | "in_person"
text
required
string

The grower's request as received: plain text, never HTML or markdown.

received_on
required
string (date)
due_on
required
string (date)

The day the answer is due: 30 days after received_on (a proposal pending counsel).

overdue
required
boolean

Open and past due_on (UTC).

status
required
"open" | "handled"
created_at
required
number

Seconds since 1970 (UTC).

created_by
required
string

Who entered it: an opaque operator id, never an email.

handled_at
required
number | null
handled_by
required
string | null

An opaque operator id, or null.

answer
required
string | null

The answer given to the grower (plain text), or null while open.

withdrawn
required
array<object> | null

The consents withdrawn when the request was handled (empty: none), or null while open.

GrowerDataRequestCreate

object

Properties
NameTypeDescription
grower_id
required
integer
kind
required
"access" | "rectification" | "erasure" | "objection"
channel
required
"paper" | "electronic" | "in_person"
received_on
required
string (date)

The day the company received it (YYYY-MM-DD), from 2000-01-01, not after today.

text
required
string

1 to 2000 characters after trimming; line breaks and tabs allowed, no other control characters. Stored and shown as plain text.

GrowerDataRequestHandle

object

Properties
NameTypeDescription
answer
required
string

The answer given to the grower, as plain text (1 to 2000 characters after trimming).

withdraw_public
optional
boolean

Erasure or objection only: also withdraw every consent in force (each recorded as a data_request withdrawal); the name leaves the public fruit page at once.

GrowerDataRequestPage

object

Properties
NameTypeDescription
items
required
array<GrowerDataRequest>
next_cursor
required
string | null

The next page's cursor; null on the last.

GrowerPage

object

Properties
NameTypeDescription
items
required
array<Grower>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

GrowerUpdate

object

Properties
NameTypeDescription
name
optional
string
cooperative
optional
string | null
public_consent
optional
boolean
consent_date
optional
string (date) | null (date)

The day the grower gave the consent (YYYY-MM-DD, not after today). Accepted only when public_consent is (or becomes) true; withdrawing the consent clears it.

consent_scope
optional
string | null

What the consent covers (staff-only text). Accepted only when public_consent is (or becomes) true; withdrawing the consent clears it.

GrowingArea

object

A growing area. The cap is area_ha times yield_kg_per_ha.

Properties
NameTypeDescription
code
required
string
tenant
required
string | null

Owning tenant; null for an area registered before migration 7 or by seed/provisioning (readable by every tenant, writable by platform_admin only).

name
required
string | null
crop
required
string | null
variety
required
string | null
province
required
string | null
district
required
string | null
commune
required
string | null
area_ha
required
number
yield_kg_per_ha
required
number
trees
required
integer | null
planted_year
required
integer | null
grower_id
required
integer | null
gacc_puc_code
required
string | null

GACC registration of the production unit.

source
required
"seed" | "manual"
approved_at
required
number | null

Unix seconds; null until a platform admin approves.

created_at
required
number | null

Unix seconds; null for a seeded (legacy) area.

updated_at
required
number | null

Unix seconds; null for a seeded (legacy) area.

registry_changed_at
required
number | null

Unix seconds of the last change of the crop or variety (L8 #33); an approval older than it no longer covers the record.

cap_kg
required
number

The volume cap in kg: area_ha times yield_kg_per_ha, recomputed on every read (an edit of either input changes it, and its audit row records the cap before and after). Never public.

approval_current
required
boolean

Whether a platform approval covers the record as it is now: given, and newer than registry_changed_at (L8 #33). False until approved, and again after a crop or variety edit until re-approved. A seeded area (source seed) is never approved. Never public.

grower
required
Grower | null
polygon
optional
GeoJsonPolygon | null

Present only for the owning tenant_admin and platform_admin.

province_code
optional
string | null

The province's official 2-digit code, in the list admin_units_version; null when not coded. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

commune_code
optional
string | null

The commune's official 5-digit code, in the list admin_units_version; null when not coded. A code is only meaningful with its version (codes were reused across the 2025 reform). Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

admin_units_version
optional
string | null

The version of the official list the codes were taken from (for example vn-2026-10-17); null without codes. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_before_reform
optional
object | null

The province, district and commune text the record held before it was coded, or the text a request gave through the deprecated text path; kept for good once set. Null for a record entered with codes. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_status
optional
"coded" | "choose_commune" | "needs_commune" | "outside_vietnam" | null

coded: the codes are set from the official list; choose_commune: the old commune was split, a person picks one of address_candidates; needs_commune: no codes yet (given as text, or before the reform), a person picks the commune; outside_vietnam: a company profile in another country, where the codes do not apply. Null for a record not reviewed since the codes were introduced. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

address_candidates
optional
array<string> | null

For choose_commune: the official commune codes to pick from; else null. Only with admin_units=1 on the read (#273); never in a write's answer nor without the parameter.

GrowingAreaCreate

object

Properties
NameTypeDescription
code
required
string
area_ha
required
number
yield_kg_per_ha
required
number
gacc_puc_code
optional
string | null
name
optional
string | null
crop
optional
string | null
variety
optional
string | null
province
optional
string | null

Deprecated (#273), sunset 1 May 2027: the province as free text. Send province_code and commune_code instead. A body that gives the address as text only is still accepted until the sunset: the record is stored as not yet coded (address_status needs_commune) and the answer carries the Deprecation, Sunset and Link headers.

district
optional
string | null

Deprecated (#273), sunset 1 May 2027: Viet Nam has had no district level since 1 July 2025. Send province_code and commune_code instead; with them district must be absent or null (400 district_with_codes).

commune
optional
string | null

Deprecated (#273), sunset 1 May 2027: the commune as free text. Send province_code and commune_code instead; the server then writes the official name here.

province_code
optional
string | null

#273: the province (tỉnh or thành phố trực thuộc trung ương) by its official 2-digit code in the administrative units list in force (getAdminUnits). Sent with commune_code, both or neither; with them province, district and commune must be absent or null and the server writes the official names.

commune_code
optional
string | null

#273: the commune (xã, phường or đặc khu) by its official 5-digit code in the administrative units list in force (getAdminUnits with province). Sent with province_code, both or neither; the commune must lie in that province by the list, never by its digits.

polygon
optional
GeoJsonPolygon | null
trees
optional
integer | null
planted_year
optional
integer | null
grower_id
optional
integer | null

A grower of the area's owning tenant.

GrowingAreaGln

object

#161: a growing area's GLN (EPCIS read point of its events in staff documents; never in a public document).

Properties
NameTypeDescription
growing_area
required
string
gln
required
string | null

GS1 Global Location Number: 13 digits, the last the GS1 mod-10 check digit; null when none.

GrowingAreaPage

object

Properties
NameTypeDescription
items
required
array<GrowingArea>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

GrowingAreaUpdate

object

A tenant_admin of the owner may change name, crop, variety, the address (province_code and commune_code, or the deprecated province, district and commune text), polygon, trees, planted_year and grower_id; a platform_admin also area_ha, yield_kg_per_ha, gacc_puc_code and (once, on an unowned area) tenant.

Properties
NameTypeDescription
name
optional
string | null
crop
optional
string | null
variety
optional
string | null
province
optional
string | null

Deprecated (#273), sunset 1 May 2027: the province as free text. Send province_code and commune_code instead. A body that gives the address as text only is still accepted until the sunset: the record is stored as not yet coded (address_status needs_commune) and the answer carries the Deprecation, Sunset and Link headers.

district
optional
string | null

Deprecated (#273), sunset 1 May 2027: Viet Nam has had no district level since 1 July 2025. Send province_code and commune_code instead; with them district must be absent or null (400 district_with_codes).

commune
optional
string | null

Deprecated (#273), sunset 1 May 2027: the commune as free text. Send province_code and commune_code instead; the server then writes the official name here.

province_code
optional
string | null

#273: the province (tỉnh or thành phố trực thuộc trung ương) by its official 2-digit code in the administrative units list in force (getAdminUnits). Sent with commune_code, both or neither; with them province, district and commune must be absent or null and the server writes the official names.

commune_code
optional
string | null

#273: the commune (xã, phường or đặc khu) by its official 5-digit code in the administrative units list in force (getAdminUnits with province). Sent with province_code, both or neither; the commune must lie in that province by the list, never by its digits.

polygon
optional
GeoJsonPolygon | null
trees
optional
integer | null
planted_year
optional
integer | null
grower_id
optional
integer | null

A grower of the area's owning tenant.

area_ha
optional
number
yield_kg_per_ha
optional
number
gacc_puc_code
optional
string | null
tenant
optional
string

platform_admin only: claim an unowned area for a registered tenant (once).

GrowingAreaVolume

object

Volume.cap_kg, declared_kg (summed across all tenants) and the headroom left.

Properties
NameTypeDescription
growing_area
required
string
season
required
string
declared_kg
required
number
cap_kg
required
number | null

area_ha times yield_kg_per_ha; null when the growing area is unknown or is a tenant-created area not yet approved by a platform admin.

headroom_kg
required
number | null

cap_kg minus declared_kg (negative when over the cap); null when cap_kg is null.

HarvestBatch

object

Up to 1,000 harvest declarations across the tenant's areas.

Properties
NameTypeDescription
items
required
array<HarvestBatchItem>

HarvestBatchItem

object

One declaration; an area and date at most once per batch.

Properties
NameTypeDescription
growing_area
required
string

Code of a growing area the caller may write.

harvest_date
required
string (date)

The harvest date; not later than today.

kg
required
number

Mass harvested on that date.

HarvestBatchResult

object

The declarations a batch stored, in request order.

Properties
NameTypeDescription
batch_id
required
integer

The stored batch request's id.

count
required
integer
items
required
array<HarvestDeclaration>

In request order.

HarvestDeclaration

object

A tenant-entered harvest of a growing area on one date (Self-declared).

Properties
NameTypeDescription
id
required
integer
growing_area
required
string
harvest_date
required
string (date)
season
required
string

The ingest policy's season of the harvest date.

kg
required
number
source
required
"self_declared"
declared_by
required
string

The user who declared it.

declared_at
required
number

Unix time of the declaration.

HarvestDeclarationCreate

object

Properties
NameTypeDescription
harvest_date
required
string (date)

The harvest date; not later than today.

kg
required
number

Mass harvested on that date.

HarvestDeclarationPage

object

Properties
NameTypeDescription
items
required
array<HarvestDeclaration>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

HarvestKey

object

#160: a harvest app install's request to sign harvest records with its own key. The private key is a non-extractable WebCrypto ECDSA P-256 key that never leaves the browser; the public key's PEM is never returned. kid and device_id derive from fingerprint_sha256, the SHA-256 of the key's SubjectPublicKeyInfo DER. Once approved, the device (profile vn.agritrace.harvest-app, site and facility facility) and its active key exist in the fleet, and the install sends its signed harvest envelopes to POST /v1/ingest/{tenant}/{facility}/{device_id}/event/harvest.

Properties
NameTypeDescription
kid
required
string
device_id
required
string
tenant
required
string
facility
required
string

The collection point the install records for.

label
required
string

A name people recognise the install by.

status
required
"pending" | "approved" | "rejected" | "revoked"

pending until a tenant admin decides; revoked once the approved key was revoked (POST /v1/keys/{kid}/revoke). Rejected and revoked are final: the install makes a new key.

fingerprint_sha256
required
string
fingerprint
required
string

First four and last four hex characters.

requested_by
required
string
requested_at
required
number

Unix seconds.

decided_by
required
string | null
decided_at
required
number | null

Unix seconds.

revoked_at
required
number | null

Unix seconds; set only when status is revoked.

revoke_reason
required
"rotation" | "compromise" | null

HarvestKeyPage

object

Properties
NameTypeDescription
items
required
array<HarvestKey>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

HarvestKeyRegister

object

Properties
NameTypeDescription
public_key_pem
required
string

The install's EC P-256 public key as one PEM SubjectPublicKeyInfo block.

facility
required
string

A facility of the caller's tenant (within an operator's facilities).

label
required
string

Health

object

Properties
NameTypeDescription
ok
required
true
outbound_backlog
required
map<string, integer>

Undelivered outbound items per target.

certificates
required
array<CertificateStatus>
read_only
optional
true

Present (true) only in the read-only maintenance mode of the PostgreSQL cutover (AGRITRACE_READ_ONLY=1, #123): every request but GET, and every audited read (the exports), then answers 503 with Retry-After, and warnings says so.

mqtt
optional
object

Present when the MQTT bridge runs.

warnings
optional
array<string>

Present when a certificate is expired or due, MQTT is not connected, or the broker has not granted every uplink subscription of the MQTT bridge.

Help

object

Properties
NameTypeDescription
status_page_url
required
string (uri) | null (uri)

CropPath's status page (an https address), or null: hide the link.

announcements
required
array<LiveAnnouncement>

The announcements showing now, newest first.

IdentityProvider

object

#87. The company's identity provider; never its client secret.

Properties
NameTypeDescription
issuer
required
string (uri)
client_id
required
string
enabled
required
boolean

Whether the company's people can sign in with it now.

created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

linked_accounts
required
integer

Accounts linked to a subject of the provider (by a first sign-in).

IdentityProviderState

object

#87. The company's identity provider (null when none is set up), the company's own redirect URI to register with it ({origin}/login/oidc/{company}; the provider must send the browser back there), and whether this deployment allows sign-in with an identity provider at all (it needs AGRITRACE_PUBLIC_ORIGIN and AGRITRACE_OIDC_ALLOWED_HOSTS).

Properties
NameTypeDescription
available
required
boolean
redirect_uri
required
string | null

Null when the server has no public origin.

provider
required
IdentityProvider | null

IdentityProviderUpdate

object

#87. The company's identity provider as registered there.

Properties
NameTypeDescription
issuer
required
string

The provider's issuer: an https:// URL without query or fragment, on a host this deployment allows; {issuer}/.well-known/openid-configuration must name it.

client_id
required
string
client_secret
optional
string

Required to set a provider up, and whenever the issuer or the client id changes (400 client_secret_is_required); left out otherwise, the stored one is kept. Stored only encrypted and never returned.

enabled
optional
boolean

IngestResult

object

Properties
NameTypeDescription
status
required
"accepted" | "quarantined" | "duplicate" | "rejected"
id
required
string | null

Envelope id; null when the body could not be parsed far enough to read it.

reasons
required
array<string>

Quarantine reasons, or the single rejection reason.

IntegrityAnchor

object

INTEGRITY-2 (#202): one closed UTC day's anchor. The day's records (audit log rows, evidence envelopes, lot seals, reviews, and the envelopes not accepted when the day was anchored) are hashed into one Merkle tree per kind (RFC 9162: leaf SHA-256(0x00 || record), node SHA-256(0x01 || left || right), empty SHA-256(""), leaves in the order of their hash); day_root = SHA-256(0x02 || audit_root || evidence_root || seal_root || review_root || held_root); anchor = SHA-256(prev_anchor || day_root || day as ASCII || audit_count || evidence_count || seal_count || review_count || held_count, each count 8 bytes big-endian). The first day's prev_anchor is 64 zeros. The record encoding is /developers/downloads/integrity-anchors.md; /developers/downloads/verify_anchors.py recomputes it with the Python standard library. Written once, never changed.

Properties
NameTypeDescription
day
required
string

The UTC day the records were written (YYYY-MM-DD).

seq
required
integer

Position in the chain: 0 for the first anchored day, then one per day without gaps.

version
required
1

The encoding version.

prev_anchor
required
string

The previous day's anchor (64 zeros for seq 0).

audit_root
required
string

Root of the day's activity log rows.

evidence_root
required
string

Root of the evidence envelopes received that day (accepted, quarantined or rejected after review).

seal_root
required
string

Root of the lot seals made that day.

review_root
required
string

Root of the reviews made that day (a person's decision on a quarantined envelope) and of the envelopes a pack sent back to quarantine that day (decision requarantine).

held_root
required
string

Root of the day's envelopes that were not accepted when the day was anchored, each with that status. A later status must be that one, a lower one, or a review's outcome; an envelope a pack sent back to quarantine is accepted again only after an approve review later than that.

day_root
required
string
audit_count
required
integer
evidence_count
required
integer
seal_count
required
integer
review_count
required
integer
held_count
required
integer
anchor
required
string
created_at
required
string (date-time)

When the job computed the anchor (UTC).

timestamp
required
IntegrityAnchorTimestamp | null

Null while no TSA is configured or the job has not queued the anchor yet.

IntegrityAnchorPage

object

INTEGRITY-2 (#202): one page of anchors, oldest first.

Properties
NameTypeDescription
version
required
1
genesis
required
string

The prev_anchor of the first day: 64 zeros.

items
required
array<IntegrityAnchor>
next_after
required
string | null

Pass as after for the next page; null on the last page.

IntegrityAnchorTimestamp

object

INTEGRITY-2 (#202): the RFC 3161 timestamp of an anchor (the anchor's 32 bytes are the message imprint, SHA-256). pending while the job has no verified token (the TSA unreachable, or a token that did not verify; it retries); verified once a token was verified against the configured trust store and stored, then final.

Properties
NameTypeDescription
status
required
"pending" | "verified"
gen_time
required
string (date-time) | null (date-time)

The token's genTime (UTC); null while pending.

token
required
string | null

Base64 of the TimeStampToken's DER (a CMS SignedData of a TSTInfo); null while pending. Check it with openssl ts -verify -digest <anchor> -in token.der -token_in -CAfile <TSA root>.

Invitation

object

SELF-1-4 (#185). An invitation link or a password link of the company; never the link or its token.

Properties
NameTypeDescription
id
required
integer
purpose
required
"invite" | "reset"

invite: an invitation to join the company; reset: a password link for a member (email and role are that member's).

email
required
string
role
required
"tenant_admin" | "operator" | "auditor" | "agronomist"
facilities
required
array<string> | null

An operator's facility codes; null = every facility of the company (always null for another role).

display_name
required
string | null
status
required
"pending" | "used" | "expired" | "revoked"

pending: works until expires_at; used: accepted (used_at, used_by); revoked; expired.

created_by
required
string

Who created it (an email, or cli:<user>).

created_at
required
number
expires_at
required
number
used_at
required
number | null
used_by
required
string | null
revoked_at
required
number | null
revoked_by
required
string | null

InvitationCreate

object

Properties
NameTypeDescription
email
required
string

The email the person will sign in with.

role
required
"tenant_admin" | "operator" | "auditor" | "agronomist"
facilities
optional
array<string> | null

Operators only: codes of the company's facilities; null or an empty list = every facility.

display_name
optional
string | null

InvitationList

object

Properties
NameTypeDescription
items
required
array<Invitation>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last.

InvitationRevoked

object

Properties
NameTypeDescription
id
required
integer
status
required
"revoked"

IssuerKey

object

A facility's did:web issuer key (#34). The private key is never returned: it is stored encrypted under the deployment's key-encryption key. key_id is the DID URL a credential cites (<did>#key-<n>).

Properties
NameTypeDescription
facility
required
string
n
required
integer

The key's number within the facility, never reused.

name
required
string
did
required
string

did:web:<AGRITRACE_DID_DOMAIN>:<facility slug>.

key_id
required
string
alg
required
"ES256"
public_jwk
required
PublicJwk
status
required
"active" | "retired" | "revoked"

active: signs. retired: replaced by a rotation, still in the DID document. revoked: compromised, removed from the DID document.

created_by
required
string
created_at
required
number

Unix seconds.

retired_at
required
number | null

Unix seconds.

revoked_at
required
number | null

Unix seconds.

revoke_reason
required
"compromise" | null
revoked_by
required
string | null

IssuerKeyList

object

Every key of the facility by number (at most 100 per facility).

Properties
NameTypeDescription
items
required
array<IssuerKey>

IssuerKeyRevoke

object

Properties
NameTypeDescription
reason
required
"compromise"

Only a compromise revokes; a rotation generates a new key instead.

JudgedPosition

object

SENS-B1e (#235): the latest position of the device judged against the area in the range (WGS84, as the device signed it), with its verdict and when ingest judged it.

Properties
NameTypeDescription
lat
required
number
lon
required
number
acc_m
required
number | null

The accuracy the device reported; null when it reported none.

verdict
required
GeofenceVerdict
checked_at
required
number

Key

object

A device or gateway public key. The PEM is never returned; fingerprint_sha256 is the SHA-256 of the key's SubjectPublicKeyInfo DER and fingerprint its short display form.

Properties
NameTypeDescription
kid
required
string
owner_type
required
"device" | "gateway"
owner_id
required
string
status
required
string

active or revoked; only active keys are accepted by ingest.

created_at
required
number

Unix seconds.

revoked_at
required
number | null

Unix seconds.

revoke_reason
required
"rotation" | "compromise" | null
revoked_by
required
string | null
fingerprint_sha256
required
string
fingerprint
required
string

First four and last four hex characters, e.g. 3f9a…c21e.

approval
required
"pending" | "approved"

#201: pending until a platform admin approves its device or gateway listing this key; only evidence signed with an approved key counts as Device-recorded or above (the console shows it as waiting for CropPath).

KeyCreate

object

Properties
NameTypeDescription
kid
required
string

Unique across every tenant.

owner_type
required
"device" | "gateway"
owner_id
required
string

A device or gateway of the caller's tenant.

public_key_pem
required
string

One PUBLIC KEY PEM block holding an EC P-256 SubjectPublicKeyInfo.

KeyPage

object

Properties
NameTypeDescription
items
required
array<Key>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

KeyRevoke

object

Properties
NameTypeDescription
reason
required
"rotation" | "compromise"

Lab

object

An accredited lab partner (platform record, no tenant). in_force: status active and valid_to today or later (Asia/Ho_Chi_Minh); only labs in force that hold an active key are assigned samples.

Properties
NameTypeDescription
code
required
string
name
required
string
accreditation
required
string
valid_to
required
string (date)

Last day the accreditation is valid.

status
required
"active" | "suspended"
created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

in_force
required
boolean
accreditation_body
required
string | null

Accreditation body, e.g. BoA (VILAS) (#73); null when not recorded.

accreditation_number
required
string | null

Accreditation certificate number (#73); null when not recorded.

accreditation_scope
required
string | null

The accredited scope: the tests the accreditation covers (#73); null when not recorded.

LabApproval

object

#154: a lab's approval for a destination market (e.g. on the list of labs whose cadmium and auramine O reports GACC accepts for Vietnamese durian). A lab result counts toward Lab-verified for the report's market only when an active approval of its lab for that market, valid on the report's signed date (Asia/Ho_Chi_Minh), lists the analyte; otherwise the lab step stops at Cross-checked (reason lab_not_approved_for_market). A withdrawn approval never counts.

Properties
NameTypeDescription
id
required
integer
lab
required
string

Lab code.

market
required
string

Destination market, ISO 3166-1 alpha-2.

approving_body
required
string
reference
required
string

The approval's reference as published (decision or list number).

analytes
required
array<string>

Analyte codes the approval covers, sorted.

valid_from
required
string (date)

First valid day, inclusive.

valid_to
required
string (date)

Last valid day, inclusive.

source_url
required
string | null

Where the list is published (http or https); stored and shown, never fetched.

evidence_sha256
required
string | null

SHA-256 of the list document kept as evidence.

status
required
"active" | "withdrawn"

withdrawn: recorded in error or revoked from the start; it never counts.

in_force
required
boolean

Active and valid today (Asia/Ho_Chi_Minh).

created_at
required
number
created_by
required
string
updated_at
required
number
updated_by
required
string

LabApprovalCreate

object

A new approval (status active). valid_to is on or after valid_from; source_url and evidence_sha256 are optional.

Properties
NameTypeDescription
market
required
string

Destination market, ISO 3166-1 alpha-2.

approving_body
required
string
reference
required
string

The approval's reference as published (decision or list number).

analytes
required
array<string>

Analyte codes the approval covers, sorted.

valid_from
required
string (date)

First valid day, inclusive.

valid_to
required
string (date)

Last valid day, inclusive.

source_url
optional
string | null

Where the list is published (http or https); stored and shown, never fetched.

evidence_sha256
optional
string | null

SHA-256 of the list document kept as evidence.

LabApprovalList

object

Every approval of the lab (at most 100), by market, then newest valid_from first.

Properties
NameTypeDescription
items
required
array<LabApproval>

LabApprovalUpdate

object

Any of the editable fields (the market never changes: record a new approval). null clears source_url or evidence_sha256; status withdrawn withdraws the approval (nothing is deleted).

Properties
NameTypeDescription
approving_body
optional
string
reference
optional
string

The approval's reference as published (decision or list number).

analytes
optional
array<string>

Analyte codes the approval covers, sorted.

valid_from
optional
string (date)

First valid day, inclusive.

valid_to
optional
string (date)

Last valid day, inclusive.

source_url
optional
string | null

Where the list is published (http or https); stored and shown, never fetched.

evidence_sha256
optional
string | null

SHA-256 of the list document kept as evidence.

status
optional
"active" | "withdrawn"

withdrawn: recorded in error or revoked from the start; it never counts.

LabAssignment

object

Properties
NameTypeDescription
id
required
integer
exporter
required
string

Name of the tenant that owns the lot.

lot
required
object
facility
required
object
analytes
required
array<SampleAnalyte>
sample_count
required
integer
selected_at
required
number

Unix seconds.

samples
required
array<SampleItem>
report
required
object | null

The report's number and verdict once submitted (P4, #40), else null.

LabAssignmentDetail

object

One sampling assigned to the caller's lab (#73), with its full report (LabReport, null before one) and the lab's active server-held key for portal entries (portal_key, null when the lab holds none: portal entry is then refused 409).

Properties
NameTypeDescription
id
required
integer
exporter
required
string

Name of the tenant that owns the lot.

lot
required
object
facility
required
object
analytes
required
array<SampleAnalyte>
sample_count
required
integer
selected_at
required
number

Unix seconds.

samples
required
array<SampleItem>
report
required
LabReport | null
portal_key
required
object | null

LabAssignmentPage

object

Properties
NameTypeDescription
items
required
array<LabAssignment>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

LabCompany

object

#278: a company a lab serves.

Properties
NameTypeDescription
lab
required
string

The lab's code.

tenant
required
string

The company's id.

name
required
string

The company's name.

linked_at
required
number

When the link was made (Unix seconds); for a link migration 113 made from the samplings already assigned, the first of them.

LabCompanyList

object

#278: the companies a lab serves, by company id (at most 500).

Properties
NameTypeDescription
items
required
array<LabCompany>

LabCreate

object

Properties
NameTypeDescription
code
required
string
name
required
string
accreditation
required
string

Accreditation scheme and number, e.g. VILAS 118 (ISO/IEC 17025).

valid_to
required
string (date)
accreditation_body
optional
string | null
accreditation_number
optional
string | null
accreditation_scope
optional
string | null

LabHome

object

#286. The lab portal's home for the caller's lab: whether the lab can sign (its status, accreditation, market approvals and keys) and its work, read among its newest 500 samplings: samplings waiting for results, reports whose PDF original was not sent, and reports sent in the last 7 days. No person's name. Each section has state: ok with its figures, or unavailable (OverviewSectionUnavailable) when it could not be read.

Properties
NameTypeDescription
lab
required
object

The caller's lab.

generated_at
required
string (date-time)

When the answer was computed (the server serves it for up to max_age_s).

max_age_s
required
integer

Seconds the server serves one answer.

window
required
object
target_hours
required
integer

The time from the draw to the results the lab aims for; waiting.past_target counts the samplings past it.

sections
required
object

LabHomePdfMissing

object | OverviewSectionUnavailable

#286. Reports stored without their PDF original, oldest first.

LabHomeSent

object | OverviewSectionUnavailable

#286. Reports stored in the last 7 days, newest first.

LabHomeWaiting

object | OverviewSectionUnavailable

#286. Samplings waiting for the lab's results (no report yet), oldest first.

LabInvitationCreate

object

Properties
NameTypeDescription
email
required
string

The lab analyst's email: their sign-in name, not checked by any email.

display_name
optional
string | null

Proposed as the new account's name; the invitee may change it.

LabKey

object

A lab's result-signing public key. The PEM is never returned; fingerprint_sha256 is the SHA-256 of the key's SubjectPublicKeyInfo DER and fingerprint its short display form. custody (#73): lab, the lab holds the private key and registered the public one; server, the platform generated the pair and holds the private key (encrypted, never returned) to sign the results the lab's portal users enter, which therefore never count as signed by the accredited lab (ADR 0001).

Properties
NameTypeDescription
kid
required
string
lab
required
string
status
required
"active" | "revoked"
created_at
required
number

Unix seconds.

revoked_at
required
number | null

Unix seconds.

revoke_reason
required
"rotation" | "compromise" | null
revoked_by
required
string | null
fingerprint_sha256
required
string
fingerprint
required
string
custody
required
"lab" | "server"

LabKeyCreate

object

Properties
NameTypeDescription
kid
required
string

Key id; one namespace with device and gateway keys.

public_key_pem
required
string

EC P-256 public key, PEM SubjectPublicKeyInfo.

LabKeyPage

object

Properties
NameTypeDescription
items
required
array<LabKey>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

LabLogins

object

Who signs in for a lab, and its pending invitations. Never a link or its token.

Properties
NameTypeDescription
members
required
array<object>

Each person with a lab membership for this lab, in any company record, by email (at most 500). active when one of those memberships and the account are active, else disabled (turned off by CropPath support).

invitations
required
array<object>

The lab's invitations still pending (unused, unrevoked, unexpired), newest first.

LabOriginResult

object

One stored origin isotope result (#40 follow-up): passed exactly when it matched.

Properties
NameTypeDescription
sample
required
integer
outcome
required
"match" | "mismatch"
region
required
string
method
required
string
passed
required
boolean

LabOriginResultSubmission

object

An optional origin isotope result of one drawn sample (#40 follow-up): whether the sample's stable isotope profile matches (match) or not (mismatch) the profile of region, the region it was compared with. A match passes; a mismatch fails the sample and the report (the lot's lab hold), like a failed contaminant.

Properties
NameTypeDescription
sample
required
integer

The sample number k of the sampling.

analyte
required
"origin_isotopes"
outcome
required
"match" | "mismatch"
region
required
string

The region the sample was compared with, e.g. Tiền Giang; the same for every origin result of the report.

method
required
string

LabPage

object

Properties
NameTypeDescription
items
required
array<Lab>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

LabPortalEntry

object

What a lab portal user enters (#73): the report number, the SHA-256 of the report's PDF and the results, exactly as a signed LabReportSubmission carries them. The server adds the version, the lab, the sampling and the signing time and signs the document with the lab's active server-held key.

Properties
NameTypeDescription
report_no
required
string

The lab's report number, once per lab.

report_sha256
required
string

SHA-256 of the report's PDF original.

results
required
array<LabReportResultSubmission | LabOriginResultSubmission>

LabPortalKeyCreate

object

Properties
NameTypeDescription
kid
required
string

Key id; one namespace with device and gateway keys.

LabReport

object

The lab's signed report of a sampling: pass/fail per result (sample and analyte), per analyte and for the lot (passed); origin lists its origin isotope results apart (empty without one, #40 follow-up).

Properties
NameTypeDescription
report_no
required
string
lab
required
string
kid
required
string

The lab key that signed it.

key_custody
required
"lab" | "server"

Who holds the key that signed the report (#73): lab, the lab itself (an uploaded signed report); server, the platform, for the lab's portal users (a portal entry, never counted as signed by the accredited lab).

market
required
string

ISO 3166-1 alpha-2 of the market whose limits judged it.

signed_at
required
number

Unix seconds.

report_sha256
required
string
passed
required
boolean
analytes
required
array<object>
results
required
array<LabReportResult>
origin
required
array<LabOriginResult>
submitted_by
required
string
received_at
required
number

Unix seconds.

report_pdf
optional
AttachmentStored | null

#73: the report's PDF original once the lab sent it (PUT /v1/lab/samples/{id}/report-pdf), null before. A staff-only attachment owned by the sampling's tenant: only its tenant-wide staff read the bytes with GET /v1/attachments/{sha256}, a facility-scoped grant does not, so GET /v1/lots/{lot}/samples omits this field for a facility-scoped grant. The lab's own views always carry it. The public record never names or serves it (report_url stays null).

LabReportResult

object

One stored result with the market limit that judged it (null when the market sets none).

Properties
NameTypeDescription
sample
required
integer
analyte
required
LabResultAnalyte
outcome
required
"measured" | "not_detected"
value
required
number | null
unit
required
string
lod
required
number
method
required
string
limit
required
object | null
passed
required
boolean

LabReportResultSubmission

object

One result of one drawn sample. measured: value at least the detection limit; not_detected: no value. Values and detection limits are in mg/kg, the unit of the market's limits.

Properties
NameTypeDescription
sample
required
integer

The sample number k of the sampling.

analyte
required
LabResultAnalyte
outcome
required
"measured" | "not_detected"
value
optional
number
unit
required
"mg/kg"
lod
required
number

Detection limit.

method
required
string

LabReportSubmission

object

A lab report signed like a device envelope: sig.value is ES256 (base64url r || s) over the canonical JSON (keys sorted, no whitespace, UTF-8) of every other member, made with an active key of the assigned lab. Every drawn sample and every analyte of the test scope exactly once; besides, at most one origin isotope result (LabOriginResultSubmission) per drawn sample, all compared with the same region (#40 follow-up).

Properties
NameTypeDescription
v
required
1
lab
required
string

The assigned lab's code; it must be the caller's lab.

sampling
required
integer

The sampling id of the URL.

report_no
required
string

The lab's report number, once per lab.

signed_at
required
string (date-time)

When the lab signed, with its UTC offset; not before the samples were drawn, not more than 300 s ahead of the server clock.

report_sha256
required
string

SHA-256 of the report's PDF original.

results
required
array<LabReportResultSubmission | LabOriginResultSubmission>
sig
required
object

LabResultAnalyte

"cadmium" | "auramine_o"

LabUpdate

object

Properties
NameTypeDescription
name
optional
string
accreditation
optional
string
valid_to
optional
string (date)
status
optional
"active" | "suspended"
accreditation_body
optional
string | null

null clears it.

accreditation_number
optional
string | null

null clears it.

accreditation_scope
optional
string | null

null clears it.

LandCertificate

object

#250: one land certificate with the corners as typed and the converted outline (WGS 84).

Properties
NameTypeDescription
id
required
integer

The certificate's id.

growing_area
required
string
submitted_at
required
number

Unix seconds when the certificate was received.

central_meridian_min
required
integer

The central meridian of the parcel map's projection, in minutes of arc east of Greenwich (e.g. 6345 = 105 degrees 45 minutes): one of the provinces' central meridians of Circular 26/2024/TT-BTNMT Appendix 01.

corners_total
required
integer

The number of corners.

plane_area_m2
required
number

The parcel's area in square metres on the projection plane, from the corners as typed: the figure a certificate prints, so a typing slip shows.

photo_sha256
required
string

SHA-256 of the photo of the certificate page, an image the company uploaded (PUT /v1/attachments/{sha256}): never public; read it with GET /v1/attachments/{sha256}.

polygon_sha256
required
string

SHA-256 (hex) of the converted outline's canonical GeoJSON text (compact, sorted keys, UTF-8): the SHA-256 of the boundary proposal the certificate made, and of the version it becomes once a platform admin approves it.

area_ha
required
number

The converted outline's area in hectares: the ring area on a sphere of the WGS 84 equatorial radius, as the admin console and the boundary walks compute a boundary's area.

registered_area_ha
required
number | null

The growing area's registered area_ha when the certificate was received.

area_difference_ratio
required
number | null

(area_ha - registered_area_ha) / registered_area_ha: negative when the certificate's parcel is smaller than registered; null without a registered size.

walk
required
LandCertificateWalkComparison | null

The certificate against the area's latest boundary walk; null when the area has none.

superseded
required
boolean

Whether the certificate replaced a boundary proposal that was waiting.

corners
required
array<array<number>>

The corners [X, Y] (VN-2000, metres) as typed, without a repeated first corner.

polygon
required
GeoJsonPolygon

LandCertificateCheck

object

#250: the parcel corners of a land-use right certificate to check before its photo is uploaded: LandCertificateCreate without photo_sha256.

Properties
NameTypeDescription
central_meridian_min
required
integer

The central meridian of the parcel map's projection, in minutes of arc east of Greenwich (e.g. 6345 = 105 degrees 45 minutes): one of the provinces' central meridians of Circular 26/2024/TT-BTNMT Appendix 01.

corners
required
array<array<number>>

The corners in order around the parcel, 3 to 200 (the first may be repeated at the end; it is dropped), at least 3 different.

LandCertificateCheckResult

object

#250: a passed check: the outline the certificate would propose, compared with the area's registered size. Nothing is stored.

Properties
NameTypeDescription
corners_total
required
integer

The number of corners.

plane_area_m2
required
number

The parcel's area in square metres on the projection plane, from the corners as typed: the figure a certificate prints, so a typing slip shows.

polygon_sha256
required
string

SHA-256 (hex) of the converted outline's canonical GeoJSON text (compact, sorted keys, UTF-8): the SHA-256 of the boundary proposal the certificate made, and of the version it becomes once a platform admin approves it.

area_ha
required
number

The converted outline's area in hectares: the ring area on a sphere of the WGS 84 equatorial radius, as the admin console and the boundary walks compute a boundary's area.

registered_area_ha
required
number | null

The growing area's registered area_ha when the certificate was received.

area_difference_ratio
required
number | null

(area_ha - registered_area_ha) / registered_area_ha: negative when the certificate's parcel is smaller than registered; null without a registered size.

polygon
required
GeoJsonPolygon

LandCertificateCreate

object

#250: the parcel corners printed on a land-use right certificate's parcel map (VN-2000 plane coordinates) and the photo of the certificate page.

Properties
NameTypeDescription
central_meridian_min
required
integer

The central meridian of the parcel map's projection, in minutes of arc east of Greenwich (e.g. 6345 = 105 degrees 45 minutes): one of the provinces' central meridians of Circular 26/2024/TT-BTNMT Appendix 01.

corners
required
array<array<number>>

The corners in order around the parcel, 3 to 200 (the first may be repeated at the end; it is dropped), at least 3 different.

photo_sha256
required
string

SHA-256 of the photo of the certificate page, an image the company uploaded (PUT /v1/attachments/{sha256}): never public; read it with GET /v1/attachments/{sha256}.

LandCertificatePage

object

Properties
NameTypeDescription
items
required
array<LandCertificateSummary>

Newest first.

next_cursor
required
string | null

LandCertificateSummary

object

#250: a land certificate kept as the evidence of a boundary proposal, without its corners. It is the evidence of the proposal and of the boundary version with the same polygon_sha256: that boundary is "from land certificate".

Properties
NameTypeDescription
id
required
integer

The certificate's id.

growing_area
required
string
submitted_at
required
number

Unix seconds when the certificate was received.

central_meridian_min
required
integer

The central meridian of the parcel map's projection, in minutes of arc east of Greenwich (e.g. 6345 = 105 degrees 45 minutes): one of the provinces' central meridians of Circular 26/2024/TT-BTNMT Appendix 01.

corners_total
required
integer

The number of corners.

plane_area_m2
required
number

The parcel's area in square metres on the projection plane, from the corners as typed: the figure a certificate prints, so a typing slip shows.

photo_sha256
required
string

SHA-256 of the photo of the certificate page, an image the company uploaded (PUT /v1/attachments/{sha256}): never public; read it with GET /v1/attachments/{sha256}.

polygon_sha256
required
string

SHA-256 (hex) of the converted outline's canonical GeoJSON text (compact, sorted keys, UTF-8): the SHA-256 of the boundary proposal the certificate made, and of the version it becomes once a platform admin approves it.

area_ha
required
number

The converted outline's area in hectares: the ring area on a sphere of the WGS 84 equatorial radius, as the admin console and the boundary walks compute a boundary's area.

registered_area_ha
required
number | null

The growing area's registered area_ha when the certificate was received.

area_difference_ratio
required
number | null

(area_ha - registered_area_ha) / registered_area_ha: negative when the certificate's parcel is smaller than registered; null without a registered size.

walk
required
LandCertificateWalkComparison | null

The certificate against the area's latest boundary walk; null when the area has none.

superseded
required
boolean

Whether the certificate replaced a boundary proposal that was waiting.

LandCertificateWalkComparison

object

#250: a certificate against the area's latest boundary walk (#248).

Properties
NameTypeDescription
walk_id
required
integer

The walk's id.

area_ha
required
number

The walked area in hectares.

area_difference_ratio
required
number | null

(certificate area - walked area) / walked area.

centre_offset_m
required
number | null

The distance in metres between the centres of the two outlines (a local approximation, to compare, not a survey).

LiveAnnouncement

object

An announcement showing now in the staff shell.

Properties
NameTypeDescription
id
required
integer
text
required
string

Plain text, one line.

level
required
"info" | "warning"
starts_at
required
number

Shown from this time (seconds since 1970, UTC).

ends_at
required
number | null

Shown until this time; null until expired.

LocationCheck

object

#247 (getAreaLocationCheck): which location check ingest makes now for the company's positions of this area, and the area's commune by point. A position is checked against the area's approved plot boundary when it has one in force (plot_boundary); else, once the platform imported commune boundaries (OpenStreetMap, ODbL 1.0), against the area's registered commune (commune: an alert on a mismatch, never a hold, and the location trust is unchanged); else not at all (none: no plot boundary and either no commune boundaries imported or an area not approved yet). A registered commune no unit of the boundary data is named like (name unmatched, e.g. a name from before the 2025-07-01 reform) gets only commune_unknown; position_communes then shows the post-2025 units the area's positions fell in, to change the area's commune to.

Properties
NameTypeDescription
applies
required
"plot_boundary" | "commune" | "none"

The check ingest makes now for a position of the area.

registered_commune
required
string | null

The commune registered on the area; null: none.

dataset
required
string | null

The key of the commune boundary dataset in force (the one imported last); null: none imported.

name
required
"matched" | "unmatched" | "missing" | null

Whether a unit of the dataset in force is named like the registered commune (missing: no commune registered); null without a dataset.

commune_verdict_counts
required
CommuneVerdictCounts
position_communes
required
array<PositionCommune> | null

The units of the dataset in force that contained the area's judged positions in the range, most first (at most 5); null without a dataset or when the caller is not given positions (only a platform admin and the owning company's operators and admins are).

attribution
required
string | null

"© OpenStreetMap contributors", to show with any commune named here (ODbL); null without a dataset.

copyright
required
string | null

The OpenStreetMap copyright page the attribution links to; null without a dataset.

LoggerCheck

object

The logger cross-check, recomputed by every link, upload and departure: from the seal time (the earliest seal time of the shipment's lots) every reading within setpoint +/- tolerance and no gap above the logger interval up to the departure. Times are Unix seconds. At most 20 gaps and 20 out-of-range readings are listed; all are counted.

Properties
NameTypeDescription
status
required
"missing" | "incomplete" | "out_of_range" | "matched"
readings
required
integer
considered
required
integer

Readings from the seal time on.

first_at
required
number | null
last_at
required
number | null
min_c
required
number | null
max_c
required
number | null
seal_at
required
number | null
until
required
number | null

The departure; null while the shipment is open.

gap_count
required
integer
gaps
required
array<object>
out_of_range_count
required
integer
out_of_range
required
array<object>
complete
required
boolean
within_setpoint
required
boolean

LoggerSeries

object

A temperature series of the shipment's logger, signed ES256 over the canonical JSON (sorted keys, no whitespace, UTF-8) of every member but sig, as a device envelope, with an active key of the device registry owned by the shipment's active logger (sig.kid names it).

Properties
NameTypeDescription
logger
required
string

The shipment's logger device id.

shipment
required
string

The shipment code.

capability
required
"air.temperature"
unit
required
"Cel"
readings
required
array<object>
sig
required
object

LoginRequest

object

Properties
NameTypeDescription
email
required
string
password
required
string

Lot

object

A lot of one tenant (issue #26). code is unique within the tenant and links the lot to envelopes whose signed context names it; seq is the tenant's lot number (fruit codes); public_id is 128 random bits as hex, never derived from the code or seq. Status in wave 5: draft (created), open (a session was opened), closed (service-level close; the route comes with the seal).

Properties
NameTypeDescription
tenant
required
string
code
required
string
seq
required
integer
public_id
required
string
facility
required
string
product
required
string
variety
required
string | null
growing_area
required
string | null
harvest_date
required
string (date) | null (date)
harvest_event_id
required
string | null

Id of the tenant's harvest envelope.

destination
required
string | null
gtin
required
string | null
status
required
"draft" | "open" | "paused" | "closed" | "packed" | "shipped" | "recalled" | "withdrawn"
created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

closed_at
required
number | null

Unix seconds; null until closed.

LotApplication

object

Properties
NameTypeDescription
id
required
string

The application record's envelope id.

applied_at
required
string (date-time)

When the application started (the event's time), UTC.

input
required
string | null

apply.input as recorded: water, fertiliser, pesticide, lime or light (null when the held record has none).

product
required
object | null

apply.product: the product's id (a registration number, GTIN or the farm's own code), batch and trade name when recorded.

product_mass_kg
required
number | null

apply.product_mass in kg, when recorded.

product_volume_l
required
number | null

apply.product_volume in litres, when recorded.

duration_s
required
number | null

apply.duration in seconds, when recorded.

phi_days
required
number | null

apply.phi_days: the pre-harvest interval the product's label gives, in days, as recorded.

interval_ends_at
required
string (date-time) | null (date-time)

When the pre-harvest interval ends, as the check at harvest reads it (the application's end plus the interval); null when the record states none.

status
required
"accepted" | "quarantined"

quarantined: held for review.

reasons
required
array<string>

Why the record is held (empty when accepted).

device_id
required
string

The device or harvest app install that signed it.

operator
required
string | null

context.operator: who applied it, as the company's opaque id.

harvest_app
required
boolean

Entered by hand in the harvest app: Self-declared.

LotApplications

object

Properties
NameTypeDescription
lot
required
string

Lot code.

growing_area
required
string | null

The lot's growing area; null: none, and no records.

from
required
string (date-time) | null (date-time)

Start of the period listed (included), UTC; null without a growing area.

until
required
string (date-time) | null (date-time)

End of the period listed (excluded): the end of the lot's harvest day, UTC; null without a growing area.

items
required
array<LotApplication>
more
required
boolean

More records than items lists: the older ones were left out.

sprays
required
array<object>

#322: the spray records of the lot's growing area (its spray log, GET /v1/growing-areas/{code}/sprays) sprayed from the first day of the period to the harvest day, both included, oldest first (at most 200, the newest kept), each with its withholding status at the harvest day; empty without a growing area. Listed only: they do not hold a harvest.

LotCartonBalance

object

The lot's exportable fruits (L6's export) against those left out of every carton. Stated, not blocking: a lot packs with the gap and keeps it in its packing view.

Properties
NameTypeDescription
exportable_fruits
required
integer

Fruits recorded or overridden with grade A or B.

exportable_kg
required
number

Their measured weights (unweighed fruits add none).

uncartoned_fruits
required
integer

Exportable fruits in no carton.

uncartoned_kg
required
number

Their measured weights.

violation
required
"fruit_not_cartoned" | null

fruit_not_cartoned: an exportable fruit is in no carton; null when every exportable fruit is cartoned.

LotCloseCheck

object

A lot's close check (O6, #64): the operator console's close dialog. Times are Unix seconds.

Properties
NameTypeDescription
lot
required
string

Lot code.

status
required
"draft" | "open" | "paused" | "closed" | "packed" | "shipped" | "recalled" | "withdrawn"
sealed
required
boolean

Whether the lot has its seal.

counts
required
object

The lot's final counts.

sessions
required
object

Measurement sessions of the lot not closed yet; the close closes a paused one.

issuer_key
required
string | null

The DID URL of the facility's active issuer key, the one the close signs with; null without one.

timestamping
required
boolean

Whether an external timestamp authority (RFC 3161) is configured: the seal's manifest hash is then timestamped by the periodic job.

blockers
required
array<"already_sealed" | "not_sealable" | "fruits_pending_review" | "session_open" | "envelopes_not_synced" | "no_issuer_key" | "lot_too_large">

Why the close cannot be confirmed now, in this order; empty when nothing blocks. envelopes_not_synced: a fruit awaits its device record or an envelope of the lot is quarantined.

seal
required
null | object

LotCloseRequest

object

What the operator confirms before signing: the lot's fruit records as the console showed them.

Properties
NameTypeDescription
confirm_counts
required
object

LotCodeSuggestion

object

Properties
NameTypeDescription
code
required
string

A code createLot accepts, not used by the company when it was suggested: LO-YYMMDD-NNN.

LotCreate

object

The owner is the tenant the caller acts for; seq, public_id and status are set by the server.

Properties
NameTypeDescription
code
required
string
facility
required
string

A facility of the caller's tenant (within an operator's facilities).

product
optional
string
variety
optional
string | null
growing_area
optional
string | null

A growing-area code the tenant may read (its own or an unowned one).

harvest_date
optional
string (date) | null (date)

YYYY-MM-DD, at most one day after today (UTC).

harvest_event_id
optional
string | null

Id of a stored harvest envelope of the tenant.

destination
optional
string | null
gtin
optional
string | null

GTIN-14 with a valid GS1 check digit.

LotGs1Carton

object

Properties
NameTypeDescription
code
required
string
carton_no
required
integer
epc
required
string
element_string
required
string | null

(01)<gtin>(10)<lot>(21)<serial>; null without a GTIN.

digital_link
required
string | null

LotGs1Labels

object

#161: what the lot's GS1 labels print. The lot-level element string and Digital Link exist when the lot has a GTIN and its code fits AI 10 (20 characters); the public resolver answers the Digital Link once the lot is sealed (sealed).

Properties
NameTypeDescription
lot
required
string
gtin
required
string | null
sealed
required
boolean
element_string
required
string | null

(01)<gtin>(10)<lot>

digital_link
required
string | null

<resolver base>/01/<gtin>/10/<lot>

cartons
required
array<LotGs1Carton>
pallets
required
array<LotGs1Pallet>
next_cursor
required
string | null

LotGs1Pallet

object

Properties
NameTypeDescription
sscc
required
string

GS1 Serial Shipping Container Code: 18 digits, the last the GS1 mod-10 check digit.

element_string
required
string
lot_cartons
required
integer
first_carton
required
integer

The lowest number of the lot's cartons on the pallet.

last_carton
required
integer

The highest number of the lot's cartons on the pallet.

cartons
required
integer

Every carton on the pallet, of any lot. The export pallet label prints the pallet's (00) when the pallet holds exactly the cartons the label is printed for.

LotMergeInput

object

One lot the merge consumes, with the kilograms taken from it.

Properties
NameTypeDescription
lot
required
string

Code of a lot of the caller's tenant (closed, packed or shipped, never merged before, not on hold, of the output lot's product).

quantity_kg
required
number

Kilograms taken from this lot; for a packed lot at most its packed net mass plus the mass tolerance.

LotMergeRequest

object

A lot merge (#91): the input lots and the kilograms the output lot (the path's lot) holds.

Properties
NameTypeDescription
inputs
required
array<LotMergeInput>

2 to 50 distinct lots, never the output lot itself.

output_kg
required
number

Kilograms of the output lot. Mass balance: it differs from the sum of the inputs' quantity_kg by at most mass_tolerance (5 %) of that sum.

LotPacking

object

A lot's packing (issue #37): totals, seal numbers (newest first, at most 50) and the mass balance with every violation counted (at most 50 listed, in carton order).

Properties
NameTypeDescription
lot
required
string
status
required
"draft" | "open" | "paused" | "closed" | "packed" | "shipped" | "recalled" | "withdrawn"
packed_at
required
number | null

Unix seconds of the pack event (the first seal).

cartons
required
integer
fruits
required
integer
net_mass_kg
required
number

Sum of the cartons' net masses.

fruit_mass_kg
required
number

Sum of the packed fruits' measured weights.

seal_numbers
required
array<object>
mass_balance
required
object

LotPage

object

Properties
NameTypeDescription
items
required
array<Lot>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

LotRecall

object

The recall or withdrawal of a lot (P5, #41) and its outbound notice, stored for the outbound adapter (#90) and not sent yet. recalled_by is an opaque operator id (user-<id>, token-<id> or legacy-<keyed hash>), never an email or a name; cartons and shipments are what the trace found at the recall.

Properties
NameTypeDescription
kind
required
"recall" | "withdrawal"
status
required
"recalled" | "withdrawn"
reason
required
RecallReason
scope
required
"consumer" | "retail" | "wholesale"
note
required
string
prior_status
required
"draft" | "open" | "paused" | "closed" | "packed" | "shipped"
recalled_by
required
string
recalled_at
required
number

Unix seconds.

cartons
required
integer
shipments
required
integer
notice
required
object | null

LotRecallRequest

object

A recall or withdrawal of the whole lot (P5, #41). kind recall moves the lot to recalled, withdrawal to withdrawn; scope is the recall depth (21 CFR 7.42(b)(1)); note is staff text, never public, never in the audit row or the outbound notice.

Properties
NameTypeDescription
kind
required
"recall" | "withdrawal"
reason
required
RecallReason
scope
required
"consumer" | "retail" | "wholesale"
note
optional
string

LotSampling

object

The one sampling of a lot: the rule and the rates it was computed from, the population (the lot's export fruits), the lab the system assigned, the test scope and the fruits drawn.

Properties
NameTypeDescription
lot
required
string
lab
required
object
rule
required
object
population
required
integer
sample_count
required
integer
analytes
required
array<SampleAnalyte>
selected_by
required
string
selected_at
required
number

Unix seconds.

samples
required
array<SampleItem>
report
required
LabReport | null

The lab's signed report (P4, #40), null until the lab submits it.

LotSamplingRead

object

Properties
NameTypeDescription
sampling
required
LotSampling | null

LotSeal

object

A lot's seal (L10, #35): the signed credential of its manifest and what identifies it. credential is a compact JWS (VC-JOSE: protected header alg ES256, kid the issuer key's DID URL, typ vc+jwt, cty vc) whose payload is a W3C verifiable credential (VC 2.0, type AgriTraceLotSeal, issuer the facility's did:web) with the lot's manifest as credentialSubject: the lot's facts, every fruit record with the SHA-256 of its stored record and its bound envelope ids, every envelope of the lot with the SHA-256 of its stored payload and its signing key, the totals, the packing, the lab report, the shipment and the trust snapshot. The signature verifies with the key listed in https://<domain>/<slug>/did.json. manifest_sha256 is the SHA-256 of the JWS payload bytes. sealed_by is an opaque operator id, never an email or a name: user-<id> for a signed-in user, token-<id> for an API token (its row id), legacy- and 16 hex digits of an HMAC under the server's secret for a legacy token. Times are Unix seconds.

Properties
NameTypeDescription
lot
required
string

Lot code.

status
required
"closed" | "packed" | "shipped" | "recalled" | "withdrawn"

The lot's status now.

sealed_at
required
number
sealed_by
required
string
key_id
required
string

The signing key's DID URL (<did>#key-<n>).

manifest_sha256
required
string
fruit_count
required
integer
event_count
required
integer
credential
required
string

LotSummary

object

Lot summary (L6, #31).

Properties
NameTypeDescription
lot
required
string

Lot code.

status
required
"draft" | "open" | "paused" | "closed" | "packed" | "shipped" | "recalled" | "withdrawn"
count
required
integer

Fruits with a device record: status recorded or overridden, or rejected with at least one bound device envelope (knock, scale or override). Fruits awaiting a device and fruits rejected before any measurement are reported apart.

awaiting_device
required
integer

Fruits labelled but without a device record yet.

rejected_unmeasured
required
integer

Fruits rejected before any device envelope was bound (no device record); not in count, levels or grades.

kg
required
number

Sum of the scale weights of the counted fruits, rounded to 3 decimals.

weighed
required
integer

Counted fruits that have a scale weight.

levels
required
object

Counted fruits per effective ripeness level (the sensory level when overridden, else the device level); unknown without a level.

grades
required
object

Counted fruits per grade; a fruit with status rejected counts as reject.

overrides
required
integer

Counted fruits with a sensory override.

avg_confidence
required
number | null

Mean device confidence of the counted fruits that have one, 4 decimals; null when none has one.

pending_review
required
integer

Fruits of the lot with a bound envelope still in quarantine.

export
required
object

Counted fruits graded A or B and not rejected, and their weight.

volume
required
GrowingAreaVolume | null

Volume headroom of the lot's growing area for the season of its harvest date (as GET /v1/growing-areas/{code}/volume); null when the lot has no growing area.

LotTrace

object

The affected set of a lot (P5, #41): backward to its facility, growing area and harvest; forward to its cartons (all counted, at most 500 listed in carton order, truncated when more exist) and the shipment carrying it, and through the chain of lot merges (#91) to every lot holding its fruit: the lot a merge produced from it, the lot a merge produced from that one, and so on (a merged lot can be closed and merged again), at most 8 merges: those lots' cartons are counted and listed with the lot's own (after them, in chain order), and the shipment is the first found along the chain, the lot's own first; the other lots of the tenant from the same growing area and harvest date (at most 50, by code). The harvest is the lot's accepted signed harvest event carrying a mass (signed_event), else the growing area's declaration for the harvest date (area_declaration: the whole area's kg), else only the date. On request (getLotTrace merges=1, #259) the trace also names the lots the merges link: forward.merged_into, the lots of the chain after this one in chain order, backward.merged_from, the input lots of the merge that produced this one (empty when no merge did), and each listed carton's lot.

Properties
NameTypeDescription
lot
required
object
recall
required
LotRecall | null
backward
required
object
forward
required
object
related_lots
required
object

LotTransformation

object

A lot merge (#91; the transform event type, FSMA 204 transformation CTE). Its EPCIS 2.0 TransformationEvent is in the staff EPCIS document of each of its lots.

Properties
NameTypeDescription
event_id
required
string (uuid)

The merge's id: the eventID of its TransformationEvent is urn:uuid:<event_id>, and the records export rows of the merge carry it.

lot
required
string

The output lot's code.

facility
required
string

The facility the merge happened at: the output lot's.

inputs
required
array<LotMergeInput>

The lots the merge consumed, by code.

input_kg
required
number

The sum of the inputs' quantity_kg.

output_kg
required
number

The output lot's kilograms.

mass_tolerance
required
number

The share of input_kg by which output_kg may differ (0.05).

recorded_at
required
number

When the merge was recorded (Unix seconds).

LotTransformations

object

The lot merges a lot took part in (#91).

Properties
NameTypeDescription
produced_by
required
LotTransformation | null

The merge that produced the lot; null when no merge did.

consumed_by
required
LotTransformation | null

The merge that consumed the lot; null when no merge did.

LotTrust

object

Properties
NameTypeDescription
lot
required
string

Lot code.

snapshot
required
null | object
queued
required
boolean

The lot waits for a recompute.

holds
required
array<object>

The latest recorded holds, newest first.

history
required
array<object>
next_cursor
required
string | null

LotUpdate

object

Descriptive fields only; code, facility, seq, public_id, tenant and status are immutable here.

Properties
NameTypeDescription
product
optional
string
variety
optional
string | null
growing_area
optional
string | null

A growing-area code the tenant may read (its own or an unowned one).

harvest_date
optional
string (date) | null (date)

YYYY-MM-DD, at most one day after today (UTC).

harvest_event_id
optional
string | null

Id of a stored harvest envelope of the tenant.

destination
optional
string | null
gtin
optional
string | null

GTIN-14 with a valid GS1 check digit.

MapPoint

object

SENS-B1e (#235): a placement's surveyed install point (WGS84).

Properties
NameTypeDescription
lat
required
number
lon
required
number
accuracy_m
required
number

MarketLimit

object

One market limit entry: the maximum (kind max, value in mg/kg) or ban (kind banned, no value) of an analyte in a product for a destination market, from valid_from (Asia/Ho_Chi_Minh) until a later entry of the same market, product and analyte supersedes it. status on today's date: in_force (the entry that applies today), scheduled (from a later date) or superseded. Entries are never edited: a lab result keeps a copy of the limit it was judged with.

Properties
NameTypeDescription
id
required
integer
market
required
string

ISO 3166-1 alpha-2.

product
required
string

As lots.product.

analyte
required
string
kind
required
"max" | "banned"
value
required
number | null

The maximum; null for a ban.

unit
required
"mg/kg"
valid_from
required
string (date)
source
required
string

The regulation it cites.

created_at
required
number

Unix seconds.

created_by
required
string

Who recorded it (migration: the seeded entries).

status
required
"in_force" | "scheduled" | "superseded"

MarketLimitCreate

object

A new entry. value is required for max (above 0, at most 1000 mg/kg) and must be absent or null for banned. valid_from from today (Asia/Ho_Chi_Minh) to 10 years ahead: an entry never reaches back. The unit is always mg/kg.

Properties
NameTypeDescription
market
required
string
product
required
string
analyte
required
string
kind
required
"max" | "banned"
value
optional
number | null
valid_from
required
string (date)
source
required
string

MarketLimitPage

object

Properties
NameTypeDescription
items
required
array<MarketLimit>
today
required
string (date)

The date status is computed for.

next_cursor
required
string | null

The next page's cursor; null on the last.

Me

object

Properties
NameTypeDescription
user
required
User
memberships
required
array<Membership>
csrf_token
required
string
tenant
required
string | null

Tenant the request acts for; null when the user has no membership.

roles
required
array<string>
tenant_name
optional
string | null

#282 (always present in this answer): the name of the tenant the request acts for (tenant), for the console's top bar; null when that company has no registered name (for example a platform admin acting for a company id that is not registered), and the console then shows tenant.

lab_name
optional
string | null

#282 (always present in this answer): for a lab user (roles holds lab), the name of its lab (the membership's lab_id); null otherwise.

two_factor
optional
TwoFactorState

MeasurementSession

object

A measurement session of one lot on one line (not a login session). At most one open or paused session holds a line, and a device is in at most one open or paused session.

Properties
NameTypeDescription
id
required
string
tenant
required
string
lot
required
string

Lot code.

facility
required
string

The lot's facility.

line
required
string
status
required
"open" | "paused" | "closed"
opened_by
required
string

The principal that opened the session.

opened_at
required
number

Unix seconds.

paused_at
required
number | null

Unix seconds of the last pause.

closed_at
required
number | null

Unix seconds.

updated_at
required
number

Unix seconds.

devices
required
array<string>

Devices chosen when the session opened.

MeasurementSessionList

object

Every measurement session of one lot, newest first.

Properties
NameTypeDescription
items
required
array<MeasurementSession>

MeasurementSessionOpen

object

Properties
NameTypeDescription
line
required
string
devices
optional
array<string>

Active devices of the lot's facility. Default: every one whose profile declares set_session.

MeasurementSessionOpened

object

The new measurement session and the set_session outcome per chosen device.

Properties
NameTypeDescription
id
required
string
tenant
required
string
lot
required
string

Lot code.

facility
required
string

The lot's facility.

line
required
string
status
required
"open" | "paused" | "closed"
opened_by
required
string

The principal that opened the session.

opened_at
required
number

Unix seconds.

paused_at
required
number | null

Unix seconds of the last pause.

closed_at
required
number | null

Unix seconds.

updated_at
required
number

Unix seconds.

devices
required
array<string>

Devices chosen when the session opened.

commands
required
array<SessionCommand>

Member

object

SELF-1-4 (#185). Someone who belongs to the company. Never a password, a token or a session.

Properties
NameTypeDescription
user_id
required
integer
email
required
string

The email the person signs in with.

display_name
required
string | null
role
required
"tenant_admin" | "operator" | "auditor" | "agronomist" | null

The member's role in this company; null when the person holds only platform-managed roles here (a lab user).

facilities
required
array<string> | null

An operator's facility codes; null = every facility of the company (always null for another role).

other_roles
required
array<"lab" | "platform_admin">

Platform-managed roles held in this company: shown, never changed here.

lab_id
required
string | null

The lab of a lab membership.

status
required
"active" | "disabled"

disabled: turned off for this company (the person keeps every other company).

account_status
required
"active" | "disabled"

The account itself, managed by CropPath only.

last_sign_in_at
required
number | null

Unix seconds of the newest session CropPath still keeps (sessions are deleted 30 days after they end); null: none in that time.

joined_at
required
number | null

Unix seconds; null for a membership older than #184.

two_factor
required
boolean

SELF-1-6 (#187): the member's two-step sign-in is on.

locked
required
boolean

SELF-2-10 (#199): the member is locked out of signing in now (too many wrong passwords or two-step codes; the lock ends by itself after 15 minutes or when a company admin unlocks it). Never how many failures they had.

MemberList

object

Properties
NameTypeDescription
items
required
array<Member>
active_admins
required
integer

How many company admins are active, with an active account (the last-admin rule).

MemberSessionsRevoke

object

Properties
NameTypeDescription
reason
optional
string

Required from a platform admin (CropPath support): one line, kept in the company's activity log. Ignored for a company admin.

MemberSessionsRevoked

object

Properties
NameTypeDescription
user_id
required
integer
sessions_revoked
required
integer

How many live sessions of the member were ended.

Membership

object

Properties
NameTypeDescription
tenant
required
string
role
required
string

e.g. tenant_admin, platform_admin, operator, lab, auditor.

facilities
required
array<string> | null

null means every facility of the tenant.

lab_id
required
string | null

MemberUnlockResult

object

SELF-2-10 (#199). The member's sign-in lockout was cleared.

Properties
NameTypeDescription
user_id
required
integer
locked
required
false
was_locked
required
boolean

The member was locked out when the request ran (false: there was nothing to clear but a count of earlier failures, which is cleared too). Never how many failures they had.

MemberUpdate

object

Properties
NameTypeDescription
role
required
"tenant_admin" | "operator" | "auditor" | "agronomist"
facilities
optional
array<string> | null

Operators only: codes of the company's facilities; null or an empty list = every facility.

NationalPortalFiling

object

The national-portal filing of the accepted envelopes of the shipment's lots (#299): the outbound rows of the national portal's own target only (a local EPCIS file archive or another EPCIS repository never counts), queue rows, delivered, pending, failing (pending after a failed attempt); filed when there is a row and every one is delivered. With no national portal target configured there is no row and filed is false.

Properties
NameTypeDescription
rows
required
integer
delivered
required
integer
pending
required
integer
failing
required
integer
filed
required
boolean

Notification

object

Properties
NameTypeDescription
id
required
integer
kind
required
NotificationKind
params
required
NotificationParams
created_at
required
number

Unix seconds.

read_at
required
number | null

When the caller read it; null while unread.

NotificationKind

"invitation_accepted" | "invitation_expiring" | "webhook_disabled" | "api_token_expiring" | "facility_approved" | "facility_refused" | "growing_area_approved" | "report_filed" | "signing_key_missing" | "alarm_raised"

What happened. invitation_accepted {email, role}; invitation_expiring {email, role, expires_at}; webhook_disabled {subscription_id, description, failures}; api_token_expiring {token_id, name, expires_at}; facility_approved {code, name}; facility_refused {code, name, reason}; growing_area_approved {code, name}; report_filed {report_id, lot, category}; signing_key_missing {facility, name, open_lots}; alarm_raised {alarm_id, alarm_kind, priority, device, zone, area} (#361: an urgent or warning alarm of the irrigation cockpit was raised, to the company's admins, the operators of its facility getting the email only; GET /v1/alarms/{id}). Clients show an unknown kind generically: new kinds may be added.

NotificationPage

object

Properties
NameTypeDescription
items
required
array<Notification>
unread
required
integer

The caller's unread notifications in this company.

next_cursor
required
string | null

The next page's cursor; null on the last.

NotificationParams

object

The kind's parameters (see NotificationKind): identifiers, names and times only, never rendered text.

Properties
NameTypeDescription
email
optional
string

The invited person's sign-in email.

role
optional
"tenant_admin" | "operator" | "auditor" | "agronomist"

The invited role.

expires_at
optional
number

When the invitation or token expires (Unix seconds).

subscription_id
optional
integer

The webhook subscription turned off.

description
optional
string

The webhook's own description (may be empty).

failures
optional
integer

Failed delivery attempts in a row.

token_id
optional
integer
name
optional
string | null

The token's, facility's or growing area's name.

code
optional
string

The facility or growing area code.

reason
optional
string

Why CropPath refused the facility proposal.

report_id
optional
integer
lot
optional
string

The lot code a public report names.

category
optional
"label_peeled" | "scanned_many" | "ripeness_off" | "other"
facility
optional
string

The facility code missing a signing key.

open_lots
optional
integer

Its lots not closed yet (draft, open or paused).

alarm_id
optional
integer

#361: the alarm raised (GET /v1/alarms/{id}).

alarm_kind
optional
string

#361: the alarm's catalog kind.

priority
optional
"urgent" | "warning" | "notice"

#361: the alarm's priority.

device
optional
string | null

#361: the alarm's device.

zone
optional
integer | null

#361: the alarm's controller zone.

area
optional
string | null

#361: the alarm's growing area code.

NotificationsMarkedRead

object

Properties
NameTypeDescription
marked
required
integer
unread
required
integer

NotificationUnreadCount

object

Properties
NameTypeDescription
unread
required
integer

OAuthClient

object

An OAuth2 API client of the tenant as the admin console lists it: never the secret, never its hash. Unix seconds.

Properties
NameTypeDescription
id
required
integer
client_id
required
string

The public client identifier the integration authenticates with.

name
required
string

The operator's label (not unique).

role
required
"tenant_admin" | "operator" | "auditor"
scopes
required
array<"aggregate_read" | "attachment_read" | "attachment_upload" | "command_read" | "device_admin" | "device_command" | "device_read" | "envelope_read" | "epcis_capture" | "facility_edit" | "facility_read" | "fruit_action" | "grading_rule_read" | "grading_rule_write" | "growing_area_edit" | "growing_area_read" | "issuer_key_admin" | "lot_read" | "lot_recall" | "lot_write" | "market_limit_read" | "recall_read" | "records_export" | "report_triage" | "review" | "tenant_read" | "trace_read" | "webhook_admin">
facilities
required
array<string> | null

An operator client's facility codes; null: every facility.

created_by
required
string
created_at
required
number
last_token_at
required
number | null

When it last got a token; null: never.

revoked_at
required
number | null
revoke_reason
required
string | null
revoked_by
required
string | null
status
required
"active" | "revoked"

OAuthClientAllowedIps

object

#205: 1 to 20 distinct networks in CIDR form, IPv4 or IPv6 (a bare address is its /32 or /128; host bits set are refused), or null for any source. The key is required.

Properties
NameTypeDescription
allowed_ips
required
array<string> | null

OAuthClientCreate

object

role: tenant_admin, operator or auditor. scopes: distinct permissions the role can hold (credential management, platform and lab permissions are never granted). facilities: an operator client only, 1 to 64 distinct facility codes of the tenant; absent or null, every facility.

Properties
NameTypeDescription
name
required
string
role
required
"tenant_admin" | "operator" | "auditor"
scopes
required
array<"aggregate_read" | "attachment_read" | "attachment_upload" | "command_read" | "device_admin" | "device_command" | "device_read" | "envelope_read" | "epcis_capture" | "facility_edit" | "facility_read" | "fruit_action" | "grading_rule_read" | "grading_rule_write" | "growing_area_edit" | "growing_area_read" | "issuer_key_admin" | "lot_read" | "lot_recall" | "lot_write" | "market_limit_read" | "recall_read" | "records_export" | "report_triage" | "review" | "tenant_read" | "trace_read" | "webhook_admin">
facilities
optional
array<string> | null

OAuthClientCreated

object

The new client and, in client_secret, its secret: this response is the only place it ever appears. Store it now; a lost secret means revoking the client and registering a new one.

Properties
NameTypeDescription
client
required
OAuthClient
client_secret
required
string

OAuthClientDetail

object

#205: an API client as the credential view shows it: the fields of OAuthClient plus its expiry, allowed sources, last use and write scopes. Never the secret, its hash or a client address. Unix seconds.

Properties
NameTypeDescription
id
required
integer
client_id
required
string

The public client identifier the integration authenticates with.

name
required
string

The operator's label (not unique).

role
required
"tenant_admin" | "operator" | "auditor"
scopes
required
array<"aggregate_read" | "attachment_read" | "attachment_upload" | "command_read" | "device_admin" | "device_command" | "device_read" | "envelope_read" | "epcis_capture" | "facility_edit" | "facility_read" | "fruit_action" | "grading_rule_read" | "grading_rule_write" | "growing_area_edit" | "growing_area_read" | "issuer_key_admin" | "lot_read" | "lot_recall" | "lot_write" | "market_limit_read" | "recall_read" | "records_export" | "report_triage" | "review" | "tenant_read" | "trace_read" | "webhook_admin">
facilities
required
array<string> | null

An operator client's facility codes; null: every facility.

created_by
required
string
created_at
required
number
last_token_at
required
number | null

When it last got a token; null: never.

revoked_at
required
number | null
revoke_reason
required
string | null
revoked_by
required
string | null
status
required
"active" | "revoked"
expires_at
required
number | null

When the client stops getting tokens and its tokens stop working (Unix seconds); null only for a client an older server registered, which counts as expired.

expired
required
boolean

True from expires_at on (or without one): renew it to use it again.

allowed_ips
required
array<string> | null

The networks (CIDR form, IPv4 or IPv6) the client may call from; null: any source.

last_used_at
required
number | null

When it last got a token or called the API (calls are recorded at most once a minute, and shown within seconds); null: never.

last_used_ip_hash
required
string | null

A keyed hash (HMAC-SHA256) of the address of that last use, never the address: equal values mean the same source.

write_scopes
required
array<"aggregate_read" | "attachment_read" | "attachment_upload" | "command_read" | "device_admin" | "device_command" | "device_read" | "envelope_read" | "epcis_capture" | "facility_edit" | "facility_read" | "fruit_action" | "grading_rule_read" | "grading_rule_write" | "growing_area_edit" | "growing_area_read" | "issuer_key_admin" | "lot_read" | "lot_recall" | "lot_write" | "market_limit_read" | "recall_read" | "records_export" | "report_triage" | "review" | "tenant_read" | "trace_read" | "webhook_admin">

The client's scopes that open a write (a route other than GET).

broad_scope
required
boolean

True when write_scopes is not empty: the client can change the company's records.

OAuthClientDetailPage

object

Properties
NameTypeDescription
items
required
array<OAuthClientDetail>
next_cursor
required
string | null

The next page's cursor; null on the last.

OAuthClientPage

object

Properties
NameTypeDescription
items
required
array<OAuthClient>
next_cursor
required
string | null

The next page's cursor; null on the last.

OAuthClientRenew

object

#205: the new lifetime, counted from now. Absent: 365 days.

Properties
NameTypeDescription
expires_in_days
optional
integer

OAuthClientRevoke

object

Properties
NameTypeDescription
reason
required
string

Why it is revoked, one line.

OAuthError

object

The error body of the OAuth2 endpoints (RFC 6749 §5.2): error the RFC error code, equal to code, and error_description the text. A request refused before the endpoint ran (a bad X-Request-Id, the rate limit, an Idempotency-Key header) gets the API's usual body, error and code only.

Properties
NameTypeDescription
error
required
string
error_description
optional
string
code
required
string

OAuthRevokeRequest

object

RFC 7009 §2.1. client_id and client_secret only when the client does not use HTTP Basic.

Properties
NameTypeDescription
token
required
string
token_type_hint
optional
string
client_id
optional
string
client_secret
optional
string

OAuthToken

object

RFC 6749 §5.1.

Properties
NameTypeDescription
access_token
required
string
token_type
required
"Bearer"
expires_in
required
integer

Seconds.

scope
required
string

The scopes granted, space separated.

OAuthTokenRequest

object

RFC 6749 §4.4.2. client_id and client_secret only when the client does not use HTTP Basic. scope: space-separated permissions, a subset of the client's; absent, all of them.

Properties
NameTypeDescription
grant_type
required
"client_credentials"
scope
optional
string
client_id
optional
string
client_secret
optional
string

OidcCallback

object

#87. What the identity provider sent back to the company's redirect URI, and that company.

Properties
NameTypeDescription
state
required
string
code
required
string
company
required
string

The company of the redirect URI the provider sent the browser back to ({origin}/login/oidc/{company}); it must be the company the sign-in was started for.

iss
optional
string

The iss parameter of the provider's redirect (RFC 9207), when it sent one: it must be the provider's issuer.

OidcStart

object

#87. The company whose identity provider the person signs in with.

Properties
NameTypeDescription
company
required
string

The company's id.

OidcStarted

object

#87. Where to send the browser: the company's identity provider, with the authorization code flow's parameters (state, nonce, the PKCE code_challenge with method S256, the company's own redirect URI and scope openid email). The sign-in must finish (POST /v1/auth/oidc/callback) before expires_at, in the same browser.

Properties
NameTypeDescription
authorization_url
required
string (uri)
expires_at
required
number

Unix seconds (10 minutes after the start).

Onboarding

object

SELF-1-8 (#189). The selected company's getting-started checklist: every step computed from its own records, counts only. Only hidden is stored.

Properties
NameTypeDescription
tenant
required
string
complete
required
boolean

Every required step is done.

hidden
required
boolean

A company admin hid the checklist (the console then stops showing it on /admin).

hidden_at
required
number | null

Unix seconds when it was hidden; null while shown.

steps
required
array<OnboardingStep>

Every step, in the order a new company works through them.

OnboardingStep

object

SELF-1-8 (#189). One step of the getting-started checklist, judged from the company's own records.

Properties
NameTypeDescription
id
required
"profile" | "second_admin" | "admin_two_factor" | "facility" | "growing_areas" | "operators" | "issuer_keys" | "devices" | "first_lot" | "first_sealed_lot" | "first_label" | "integrations"

profile: the company profile holds a legal name, an address and a tax number (count of 3 filled). second_admin: at least two active company admins (count: admins). admin_two_factor: every active company admin has two-step sign-in on (count of total admins). facility: an approved facility (count approved of total; waiting_for_platform while none is approved; a company cannot create facilities in Phase 1). growing_areas: an approved growing area with a grower of the company (count approved of total areas; waiting_for_platform while every area with a grower is unapproved). operators: an active operator (count). issuer_keys: every approved facility has an active signing key (count of total approved facilities). devices: an active device seen within 7 days (count of total active devices). first_lot, first_sealed_lot: a lot, a sealed lot (count). first_label: a fruit or carton label printed or an export label print logged. integrations (optional): an active API token, API client or webhook (count).

required
required
boolean

false for an optional step (integrations): the checklist is complete without it.

status
required
"done" | "to_do" | "waiting_for_platform"

waiting_for_platform: the company did its part and waits for CropPath (an approval).

count
required
integer | null

The number the step is judged by, where one helps.

total
required
integer | null

What count is out of, where it applies.

link
required
string

The console screen (path and hash) where the step is done.

OnboardingUpdate

object

Properties
NameTypeDescription
hidden
required
boolean

true hides the checklist, false shows it again.

OutboundBacklog

object

Properties
NameTypeDescription
targets
required
array<OutboundTarget>

Every configured target, and any other target with events waiting, by name.

OutboundTarget

object

B9 (#21): the company's undelivered events for one outbound target (a national system, a buyer's EPCIS repository, an archive).

Properties
NameTypeDescription
target
required
string

The target's name, as the deployment configures it.

pending
required
integer

Accepted events waiting to be delivered.

held
required
integer

Events not delivered because they are no longer accepted (for example sent back to quarantine by a pack), which wait until a review accepts them again.

failing
required
integer

Pending events whose delivery failed at least once.

next_attempt_at
required
number | null

Unix seconds: the earliest next delivery attempt of a pending event; null when none is pending.

max_attempts
required
integer

The most failed attempts of one waiting event.

last_error
required
string | null

The error of the waiting event that failed most often (the latest next attempt among equals); null when none failed. One delivery batch carries several companies' events and a partner's error body can echo any of them, so a company sees only a tenant-neutral summary: HTTP <status> when the partner answered with an HTTP error, else delivery_error. A platform admin sees the full text (at most 500 characters).

OverviewSectionUnavailable

object

#274. A section of an overview that could not be read: one of its queries failed. Only that section fails; the other sections answer.

Properties
NameTypeDescription
state
required
"unavailable"
reason
required
"query_failed"

Pallet

object

#161: a pallet of a facility, identified by its SSCC, with the cartons on it.

Properties
NameTypeDescription
sscc
required
string

GS1 Serial Shipping Container Code: 18 digits, the last the GS1 mod-10 check digit.

facility
required
string
epc
required
string

https://id.gs1.org/00/<sscc>

element_string
required
string

GS1-128 element string, (00)<sscc>.

cartons
required
array<PalletCarton>
created_by
required
string
created_at
required
number

Unix seconds.

updated_at
required
number

Unix seconds.

PalletCarton

object

Properties
NameTypeDescription
code
required
string
lot
required
string
epc
required
string

The carton's EPC: its SGTIN Digital Link when its lot has a GTIN, else urn:agritrace:carton:<code>.

PalletCartons

object

Properties
NameTypeDescription
cartons
required
array<string>
expected_cartons
optional
array<string>

The precondition (#267): the codes of every carton the writer read on the pallet (Pallet.cartons, all lots, any order). When given, the set is refused with 409 pallet_changed if the pallet now holds other cartons, so a change made since that read is never overwritten. Without it the set replaces what the pallet holds.

PalletCreate

object

Without sscc, the next SSCC of the platform's GS1 company prefix is allocated.

Properties
NameTypeDescription
facility
required
string
sscc
optional
string

An SSCC of the company's own GS1 membership.

PalletPage

object

Properties
NameTypeDescription
items
required
array<PalletSummary>
next_cursor
required
string | null

PalletSummary

object

Properties
NameTypeDescription
sscc
required
string

GS1 Serial Shipping Container Code: 18 digits, the last the GS1 mod-10 check digit.

facility
required
string
epc
required
string
element_string
required
string
carton_count
required
integer
created_by
required
string
created_at
required
number
updated_at
required
number

Passkey

object

#87. One of the signed-in user's passkeys: never its credential id, public key or user handle.

Properties
NameTypeDescription
id
required
integer
nickname
required
string

The owner's name for it; empty when none was given.

algorithm
required
"ES256" | "RS256" | "EdDSA"
transports
required
array<"ble" | "hybrid" | "internal" | "nfc" | "smart-card" | "usb">

How the browser said the authenticator connects (hints).

attestation_format
required
string
created_at
required
number

Unix seconds.

last_used_at
required
number | null

Unix seconds of the last sign-in with it.

clone_warning_at
required
number | null

When a sign-in with it was refused because its signature counter did not move forward: the authenticator may have been copied. Remove the passkey if you did not expect this.

PasskeyCreationOptions

object

#87. public_key: PublicKeyCredentialCreationOptions for navigator.credentials.create(), binary values as base64url (challenge, user.id, excludeCredentials[].id).

Properties
NameTypeDescription
public_key
required
object

PasskeyList

object

Properties
NameTypeDescription
items
required
array<Passkey>

PasskeyLogin

object

#87. The answer of navigator.credentials.get(): the credential's rawId, response.clientDataJSON, response.authenticatorData, response.signature and response.userHandle, each base64url (padding optional).

Properties
NameTypeDescription
credential_id
required
string
client_data_json
required
string
authenticator_data
required
string
signature
required
string
user_handle
required
string

PasskeyRegistration

object

#87. The answer of navigator.credentials.create(): response.clientDataJSON and response.attestationObject, base64url (padding optional), and response.getTransports().

Properties
NameTypeDescription
client_data_json
required
string
attestation_object
required
string
transports
optional
array<string>

Unknown names are dropped.

nickname
optional
string

PasskeyRename

object

Properties
NameTypeDescription
nickname
required
string

PasskeyRequestOptions

object

#87. public_key: PublicKeyCredentialRequestOptions for navigator.credentials.get(), the challenge as base64url; no allowed credentials (the authenticator offers the person's passkeys for this site).

Properties
NameTypeDescription
public_key
required
object

PasswordChanged

object

Properties
NameTypeDescription
csrf_token
required
string

PasswordChangeRequest

object

Properties
NameTypeDescription
current_password
required
string
new_password
required
string
code
optional
string

#187: the 6-digit code from the authenticator app; required (or backup_code) when the account has two-step sign-in.

backup_code
optional
string

#187: one unused backup code, instead of code.

PasswordRecovered

object

Properties
NameTypeDescription
backup_codes_left
required
integer

The account's unused backup codes after this one.

second_factor
required
"required"

The next sign-in asks for the second step after the password.

PasswordRecoveryRequest

object

Properties
NameTypeDescription
email
required
string

The email used to sign in.

backup_code
required
string

One unused backup code of the account (SELF-1-6, #187), as printed: any case, spaces and hyphens allowed.

new_password
required
string

PersonalData

object

SELF-2-9 (#198). What the platform holds about the signed-in member in the selected company. Never a secret: no password hash, session token, address hash, user agent or two-step secret.

Properties
NameTypeDescription
user_id
required
integer
email
required
string
display_name
required
string | null
company
required
object
roles
required
array<"tenant_admin" | "operator" | "auditor" | "agronomist" | "lab" | "platform_admin">

The member's roles in this company, the company-managed ones first.

facilities
required
array<string> | null

An operator's facility codes; null for every facility or for another role.

lab_id
required
string | null

The lab of a lab membership, or null.

membership_status
required
"active" | "disabled"
account_status
required
"active" | "disabled"
account_created_at
required
number

Seconds since 1970 (UTC).

joined_at
required
number | null

When the member joined this company, or null when not recorded.

notice_accepted_at
required
number | null

When the member accepted the staff privacy notice (at the invitation), or null.

two_factor
required
boolean

Whether two-step sign-in is on (never its secret).

recent_sign_ins
required
array<number>

The times of the account's most recent sign-ins that the database still keeps, newest first (sign-ins are per account, not per company).

agronomist
optional
Agronomist | null

#351: with agronomist=1 only: the caller's row of the platform's agronomist registry, or null without one.

PersonalDataRequest

object

SELF-2-9 (#198). A member's request about their personal data, as the member sees it (never who handled it).

Properties
NameTypeDescription
id
required
integer
kind
required
"access" | "correction"

access: see more of the personal data held; correction: correct it.

text
required
string

Plain text, as typed (trimmed): never HTML or markdown; line breaks are kept.

status
required
"open" | "handled"

open (new) or handled (a company admin dealt with it; final).

created_at
required
number

Seconds since 1970 (UTC).

handled_at
required
number | null

When a company admin marked it handled, or null.

PersonalDataRequestCreate

object

Properties
NameTypeDescription
kind
required
"access" | "correction"
text
required
string

1 to 2000 characters after trimming; line breaks and tabs allowed, no other control characters. Stored and shown as plain text.

PersonalDataRequestPage

object

Properties
NameTypeDescription
items
required
array<PersonalDataRequest>
next_cursor
required
string | null

The next page's cursor; null on the last.

PlatformOverview

object

#274. The platform overview for platform admins: the service's health, its traffic, the ingest and the queues, the work waiting on CropPath, sign-in security and the companies. The per-minute figures and the traffic are this server's, from when it started (process.started_at). Each section has state: ok with its figures, or unavailable (OverviewSectionUnavailable) when it could not be read.

Properties
NameTypeDescription
generated_at
required
string (date-time)

When the answer was computed (the server serves it for up to max_age_s).

max_age_s
required
integer

Seconds the server serves one answer.

process
required
object
sections
required
object

PlatformOverviewCompanies

object | OverviewSectionUnavailable

#274. The companies: at most 50, those that need attention first (open high alerts, open support requests, the daily API quota at its warning level), then by id.

PlatformOverviewCompany

object

#274. One company's figures: its name and code and counts, never a person's data.

Properties
NameTypeDescription
id
required
string
name
required
string
sandbox
required
boolean

A hosted sandbox company.

offboarding
required
"leaving" | "left" | null

Whether the company is leaving or has left CropPath; null otherwise.

members_active
required
integer
admins_active
required
integer

Active company admins.

devices_registered
required
integer

Devices of every status.

messages_last_hour
required
integer | null

Device messages stored in the last hour; null until the server has measured an hour.

api_calls_today
required
integer

API calls this UTC day.

api_day_percent
required
integer

api_calls_today as a percentage of the daily API call quota.

open_high_alerts
required
integer

Open alerts of severity high.

support_open
required
integer

Support requests open.

PlatformOverviewHealth

object | OverviewSectionUnavailable

#274. The service's health, as getAdminHealth reports it, with the last integrity anchor, the last evidence archive and the platform's own open alerts.

PlatformOverviewIngest

object | OverviewSectionUnavailable

#274. The device message ingest of this server since it started, the device messages stored per minute (about: a quarantine review or a correction counts too) and the ingest backlog.

PlatformOverviewIrrigation

object | OverviewSectionUnavailable

#363. The irrigation fleet's health across companies (decision D10: no litres, no zone names).

PlatformOverviewQueues

object | OverviewSectionUnavailable

#274. The queues the platform works through.

PlatformOverviewSecurity

object | OverviewSectionUnavailable

#274. Sign-in security.

PlatformOverviewTraffic

object | OverviewSectionUnavailable

#274. The requests this server answered since it started (since).

PlatformOverviewWaiting

object | OverviewSectionUnavailable

#274. The work waiting on CropPath.

PlatformSupportRequest

object

A support request in the platform's queue.

Properties
NameTypeDescription
id
required
integer
tenant
required
string

The company the request came from.

user
required
SupportRequestUser
subject
required
string

Plain text, as typed (trimmed).

body
required
string

Plain text, as typed (trimmed): never HTML or markdown; line breaks are kept.

record_id
required
string | null

The record the request is about (a lot code, device id, public id, ...), or null.

status
required
"open" | "in_progress" | "answered" | "closed"

open (new), in_progress (CropPath is on it), answered (CropPath replied and waits for the company) or closed.

reply
required
string | null

CropPath's reply (plain text), or null.

created_at
required
number

Seconds since 1970 (UTC).

updated_at
required
number

When the request was sent or CropPath last changed it.

updated_by
required
string | null

The platform admin who last changed it; null until then.

PlatformSupportRequestPage

object

Properties
NameTypeDescription
items
required
array<PlatformSupportRequest>
next_cursor
required
string | null

The next page's cursor; null on the last.

PolygonHistory

object

Properties
NameTypeDescription
pending
required
PolygonProposal | null
items
required
array<PolygonVersion>

The approved versions, newest first.

next_cursor
required
string | null

PolygonProposal

object

SENS-A1 (#224): a company admin's change of an approved growing area's boundary, waiting for a platform admin. The proposed boundary and who proposed it are present only for the owning tenant_admin and platform_admin.

Properties
NameTypeDescription
polygon_sha256
required
string | null

SHA-256 of the proposed boundary; null proposes removing it.

proposed_at
required
number
polygon
optional
GeoJsonPolygon | null
proposed_by
optional
string | null

PolygonProposalApproval

object

Properties
NameTypeDescription
polygon_sha256
required
string | null

The SHA-256 of the proposal reviewed (null for a proposed removal): a proposal replaced meanwhile is refused (409).

PolygonProposalPage

object

Properties
NameTypeDescription
items
required
array<PolygonProposalQueueItem>
next_cursor
required
string | null

PolygonProposalQueueItem

object

SENS-A1 (#224): a company's boundary proposal in the platform's queue, with the boundary in force.

Properties
NameTypeDescription
code
required
string
tenant
required
string
tenant_name
required
string
name
required
string | null
polygon
required
GeoJsonPolygon | null

The proposed boundary; null proposes removing it.

polygon_sha256
required
string | null

Name it when approving (POST /v1/polygon-proposals/{code}/approve).

proposed_at
required
number
proposed_by
required
string | null
current_version
required
integer | null

The latest approved version, null when none.

current_polygon_sha256
required
string | null

SHA-256 of the boundary in force; null when none.

current_polygon
required
GeoJsonPolygon | null

The boundary in force (the latest approved version's); null when none. Shown beside the proposed boundary so a widening is seen before it is approved.

PolygonProposalRejected

object

SENS-A1 (#224): the boundary proposal CropPath rejected; the boundary in force stays.

Properties
NameTypeDescription
code
required
string
tenant
required
string
polygon_sha256
required
string | null
proposed_at
required
number
proposed_by
required
string | null
reason
required
string

PolygonProposalRejection

object

Properties
NameTypeDescription
reason
required
string

Shown to the company in its activity log.

PolygonVersion

object

SENS-A1 (#224): one boundary of a growing area that the platform approved. A version never changes and is addressed by (growing_area, version); it is in force from valid_from until the next version's valid_from. The boundary and who proposed and approved it are present only for the owning tenant_admin and platform_admin; other readers get the SHA-256 and times only.

Properties
NameTypeDescription
growing_area
required
string
version
required
integer

1, 2, ... per growing area.

polygon_sha256
required
string | null

SHA-256 (hex) of the boundary's canonical GeoJSON text (compact, sorted keys, UTF-8); null when this version removed the boundary.

valid_from
required
number

Unix seconds from which this version is in force.

origin
required
"migration" | "area_approval" | "proposal" | "platform_edit"

How the version came about: recorded when the boundary was locked (migration 69), approved with the area, a company's proposal the platform approved, or a platform admin's own edit.

polygon
optional
GeoJsonPolygon | null

Present only for the owning tenant_admin and platform_admin; null: no boundary.

proposed_at
optional
number | null

Present only for the owning tenant_admin and platform_admin.

proposed_by
optional
string | null

Present only for the owning tenant_admin and platform_admin.

approved_by
optional
string | null

Present only for the owning tenant_admin and platform_admin.

PositionCommune

object

#247: a commune-level unit of the boundary data that contained some of the area's judged positions.

Properties
NameTypeDescription
name
required
string

The unit's name in OpenStreetMap.

osm_relation
required
integer

The unit's OpenStreetMap relation id.

positions
required
integer

How many of the area's judged positions in the range it contained.

ProductGtin

object

#161: the GTIN of one of the company's trade items (product, variety, grade; null: any variety, an ungraded item). A lot created without a GTIN takes the GTIN of its ungraded (product, variety).

Properties
NameTypeDescription
product
required
string
variety
required
string | null
grade
required
string | null
gtin
required
string

14 digits with the GS1 check digit.

allocated
required
boolean

Allocated from the platform's GS1 company prefix.

created_by
required
string
created_at
required
number

Unix seconds.

ProductGtinCreate

object

Without gtin, the next GTIN of the platform's GS1 company prefix is allocated.

Properties
NameTypeDescription
product
required
string
variety
optional
string | null
grade
optional
string | null
gtin
optional
string

A GTIN of the company's own GS1 membership (14 digits, check digit).

ProductGtinList

object

Properties
NameTypeDescription
items
required
array<ProductGtin>

ProgramHoldRelease

object

#367: the hold released before its end, and how many of the controller's enabled rules were made due (the engine composes them on its next run).

Properties
NameTypeDescription
released
required
object
rules_due
required
integer

ProgramWithdrawal

object

#367: the withdrawal recorded as owed (and whether it was handed to the transport), the control program now withdrawn, and the end of the engine's hold. The controller's reports, never this answer, say the program stopped.

Properties
NameTypeDescription
withdrawal
required
object
control_program
required
object | null

The control program withdrawn; null when the controller held no control program in force (a set_program sent by hand, nothing on the controller any more, or a second withdrawal).

hold_until
required
string (date-time) | null (date-time)

The end of the engine's hold on the controller: the next farm-local midnight, or a later hold already set (RFC 3339 UTC).

ProgramWithdrawalRequest

object

#367: why the person withdraws the controller's program, and the program they saw.

Properties
NameTypeDescription
reason
required
string

Why (required): 1 to 500 characters after trimming, without control characters but tab and newline, and without format characters (Unicode category Cf).

control_program_id
optional
integer

The control program the person saw (optional); it must be one of the device's programs. Whatever the controller holds now is withdrawn.

PublicAnalyte

"cadmium" | "auramine_o" | "origin_isotopes"

PublicCode

string

PublicCommuneMap

object

#293: the commune map of the record's growing area: one SVG image of the commune the record already names in words (its OpenStreetMap boundary on map tiles CropPath renders itself), never the orchard. Precision is the commune: no orchard point or boundary, no packing house. Present only when exactly one commune of the OpenStreetMap commune dataset in force matches the area's commune (by the official name of its commune code when it has one, else by its registered name; among several communes of that name, the one that holds the area's approved boundary, else the one that holds more than half of its judged positions) and a tile dataset is imported; otherwise the member is null. The image carries the attribution "© OpenMapTiles © OpenStreetMap contributors", and a page showing it must show the same text near it, linked to https://openmaptiles.org/ and https://www.openstreetmap.org/copyright.

Properties
NameTypeDescription
url
required
PublicSameOriginPath

The image's same-origin path, /v1/public/maps/{style}/{tileset}/{communes}/{osm_id}.svg (GET /v1/public/maps/{style}/{tileset}/{communes}/{osm_id}.svg). It names the drawing's version, the tile dataset, the commune dataset and the commune's OpenStreetMap relation only: never the growing area, its code or a GLN.

osm_relation
required
integer

The commune's OpenStreetMap relation id: https://www.openstreetmap.org/relation/{osm_relation} is its page on OpenStreetMap.

PublicConformityCredential

string

#142: a VC-JOSE compact JWS (W3C Securing Verifiable Credentials using JOSE and COSE, Recommendation 2025-05-15): protected header {alg ES256, kid: the lab key's DID URL did:web:<domain>:labs:<lab code>#<kid>, typ vc+jwt, cty vc}, payload a VC 2.0 credential that is a UNTP Digital Conformity Credential 0.6.1 (@context [https://www.w3.org/ns/credentials/v2, https://test.uncefact.org/vocabulary/untp/dcc/0.6.1/]), signature r || s (64 bytes, so 86 base64url characters). See /developers/downloads/verify.md.

PublicCorrections

object

INTEGRITY-4 (#204): how often the journey steps of a public lot (or, for measurement on a fruit's page, the fruit) were corrected before the lot's seal. Counts and local dates only.

Properties
NameTypeDescription
sealed
required
boolean

The lot is sealed (closed, or later): no record of it can be corrected any more. False while it is open, when more corrections may follow.

public_since
required
PublicIsoDate | null

The local date the lot was first public (its first measurement session opened); null when it has none.

steps
required
array<object>

One entry per step with at least one correction, in this order: registration, harvest, measurement, details.

PublicCredential

string

X3 (#44): a VC-JOSE compact JWS (W3C Securing Verifiable Credentials using JOSE and COSE, Recommendation 2025-05-15): protected header {alg ES256, kid: the issuer key's DID URL, typ vc+jwt, cty vc}, payload a VC 2.0 credential, signature r || s (64 bytes, so 86 base64url characters). The payload is a UNTP 0.7.0 credential (@context [https://www.w3.org/ns/credentials/v2, https://vocabulary.uncefact.org/untp/0.7.0/context/]) for a lot sealed since #162: a Digital Product Passport, or the packing facility's Digital Facility Record; a passport sealed before is a UNTP Digital Product Passport 0.6.1 (@context [https://www.w3.org/ns/credentials/v2, https://test.uncefact.org/vocabulary/untp/dpp/0.6.1/]), served as stored. See /developers/downloads/verify.md.

PublicCurrentStatus

object

#177: the current public status of a record, as its own record states it now: status, status_since, status_reason and trust.tier (as tier).

Properties
NameTypeDescription
status
required
PublicStatus
status_since
required
PublicIsoDateTime | null
status_reason
required
RecallReason | null
tier
required
PublicTrustTier

PublicCustomsDossier

object

X4 (#45): the code file for China customs (the customs dossier) of a public lot that is packed (so sealed, L8 #33) and on a shipment to the CN market. sealed holds the lot, carton and registry facts frozen when the lot was packed (their members depend on format: a lot packed since addresses are coded by official administrative unit codes, with its packing house or growing area coded, has format 2, #273), and seal their SHA-256 seal digest recorded then, so a registry edit after packing never changes the dossier. The rest is projected from the lot's public record (PublicLot), except producer, the lot's company as its company profile names it now (#186). No field outside the Public Data Allowlist appears: no GACC registration value, seal number, coordinates, grower, container or device. The growing-area and packing-house codes are the tenant's registry entries on the platform (registry_entry gives their tier and source), not GACC registration numbers. The body is the RFC 8785 JSON Canonicalization Scheme (JCS) form of the document, in UTF-8: no whitespace, members sorted by the UTF-16 code units of their names, strings escaped as ECMAScript's JSON.stringify does and numbers in ECMAScript's Number-to-String form (0.00001, not 1e-05; 12, not 12.0). It holds no per-read value and is byte-identical for the same stored facts; digest.value is the SHA-256 (hex) of the JCS form of the document without digest.

Properties
NameTypeDescription
format
required
"agritrace-customs-dossier/1" | "agritrace-customs-dossier/2"

The format of the document, that of its sealed record: agritrace-customs-dossier/1 for a lot packed before addresses were coded by official administrative unit codes, or since then with neither its packing house nor its growing area coded (its sealed facts name the district), agritrace-customs-dossier/2 for a lot packed since then with its packing house or growing area coded (#273: Viet Nam has had no district level since 1 July 2025; its sealed facts name the commune and province with their official codes and admin_units_version). A document keeps its format for good. Only sealed differs between the two: a consumer that reads its members switches on format; the seal digest is checked the same way in both.

lang
required
"vi" | "zh-Hans" | "en"
status
required
PublicStatus
trust_tier
required
PublicTrustTier
public_id
required
PublicCode
origin_country
required
PublicText
sealed
required
object | object

The lot, carton and registry facts frozen when the lot was packed, exactly as stored: a registry edit after packing never changes them. seal.value is the SHA-256 of their JCS form, whatever the format. Their members depend on format (#273): format 1 names the district, format 2 the commune and province with their official codes. The locality parts are the lot page's localities, unjoined.

seal
required
object

The seal digest recorded when the lot was packed: the SHA-256 (hex) of the JCS form of sealed. basis is transition when it was taken in the pack transaction, migration when the lot was packed before sealed records existed and its facts were captured from the registry when the platform was upgraded.

registry_entry
required
object | null

The trust tier and source of the growing-area and packing-house codes: those of the lot's registration step (PublicLotJourneyStep registration; Self-declared from the tenant's own registry entry until a signed or registry source exists, L8 #33), or null when the lot has no growing area. The codes are the tenant's entries on the platform, not GACC orchard (PUC) or packing-house (PHC) registration numbers.

lab_report
required
object | null
shipment
required
object
protocol
required
PublicText | null

The Durian Protocol's name in lang when sealed.durian_protocol is true, else null.

producer
required
CompanyProducer | null

#186: the lot's company as its company profile names it now (legal name and address), null until the company saves a profile. Not part of sealed: a profile edit changes this member and digest, never sealed or seal.

digest
required
object

PublicDeviceApproval

object

#201: whether the devices whose evidence this step reads are approved by CropPath. approved false: evidence of a device CropPath has not approved is counted as Self-declared. approved_on: the local date of the latest approval, null when one was approved before approvals were recorded.

Properties
NameTypeDescription
approved
required
boolean
approved_on
required
PublicIsoDate | null

PublicDownloads

object

Properties
NameTypeDescription
epcis_url
required
PublicSameOriginPath | null
credential_url
required
PublicSameOriginPath | null

X3 (#44): the fruit's UNTP credential (GET /v1/public/fruits/{publicId}/credential), present when the fruit's lot was sealed with public documents and its issuer key is not revoked; null otherwise. A fruit's epcis_url stays null: its events are in its lot's document, which the credential links.

PublicEpcisDocument

object

X3 (#44): an EPCIS 2.0 document (GS1 EPCIS 2.0.0, JSON-LD). Its full schema is GS1's (https://ref.gs1.org/standards/epcis/2.0.0/epcis-json-schema.json); this names only its frame. @context is the GS1 context, then this platform's agri: namespace.

Properties
NameTypeDescription
@context
required
array<any>
type
required
"EPCISDocument"
schemaVersion
required
"2.0"
creationDate
required
string

The seal time, UTC.

epcisBody
required
object

PublicEvidenceSource

"manual" | "registered_app" | "device" | "lab" | "registry" | "logger"

PublicFruit

object

Properties
NameTypeDescription
status
required
PublicStatus
status_since
required
PublicIsoDateTime | null
status_reason
required
RecallReason | null

P5 (#41): the reason category of a recalled or withdrawn lot (RecallReason), null otherwise. Never the recall's note, depth or who recalled it.

public_id
required
PublicCode
code
required
PublicCode
crop
required
"durian"
variety
required
PublicText
harvested_on
required
PublicIsoDate
harvest_place
required
PublicText | null
carton_no
required
integer | null
lot
required
object
trust
required
object
scan
required
object | null
measurement
required
object
origin
required
object
journey
required
array<PublicFruitJourneyStep>
downloads
required
PublicDownloads
report
required
object

PublicFruitJourneyStep

object | object | object | object | object

PublicIsoDate

string (date)

PublicIsoDateTime

string (date-time)

PublicIssuer

object

Properties
NameTypeDescription
did
required
string
key_id
required
string

PublicJwk

object

A P-256 public key as a JWK (RFC 7518 §6.2.1).

Properties
NameTypeDescription
kty
required
"EC"
crv
required
"P-256"
x
required
string
y
required
string

PublicLabLimit

object | object

PublicLabMarketApproval

object

Properties
NameTypeDescription
market
required
PublicMarket
approved
required
boolean

True when an active approval of the lab for this market, valid on the signed date, lists every tested analyte. False: the lab is not on the approved list for the market (for at least one analyte), so the results cannot count as Lab-verified for that market and the lab step is at most Cross-checked (reason lab_not_approved_for_market).

reference
required
PublicText | null

The approval's reference as published (several joined by "; "); null when not approved.

PublicLabResult

object | object | object

PublicLinkset

object

#162: an IETF link set (RFC 9264) as UNTP's Identity Resolver (UNTP 0.7.0) returns it: one context per thing the code names (the record, then a fruit's lot), each an anchor and its link relations, every relation a list of targets. Relation types: dpp (a UNTP Digital Product Passport), dfr (the packing facility's UNTP Digital Facility Record), dcc (the lab's UNTP Digital Conformity Credential), https://gs1.org/voc/traceability (the lot's EPCIS 2.0 document) and https://gs1.org/voc/pip (a public page, one per language).

Properties
NameTypeDescription
linkset
required
array<object>

PublicLinkTarget

object

#162: a link target (RFC 9264).

Properties
NameTypeDescription
href
required
string

The target URL.

title
required
string

What the target is.

type
optional
string

The target's media type.

hreflang
optional
array<string>

The target's language, for a public page.

PublicLot

object

Properties
NameTypeDescription
status
required
PublicStatus
status_since
required
PublicIsoDateTime | null
status_reason
required
RecallReason | null

P5 (#41): the reason category of a recalled or withdrawn lot (RecallReason), null otherwise. Never the recall's note, depth or who recalled it.

public_id
required
PublicCode
code
required
PublicCode
crop
required
string
crop_name
optional
string

#156: the registry's name of the lot's crop (crop, a code of the crop registry) in lang; only with crop_profile=1.

ripeness_scale
optional
"levels_1_to_4" | null

#156: the crop's ripeness scale; null for a crop graded on none, whose lot has no ripeness section (ripeness null) and no public fruit records; only with crop_profile=1.

variety
required
PublicText
origin_country
required
PublicText
fruit_count
required
integer
net_mass_kg
required
number
carton_count
required
integer | null
packed_on
required
PublicIsoDate | null
harvested_on
required
PublicIsoDate
facility
required
object
growing_area
required
object | null
export
required
object | null
trust
required
object
verification
required
object
journey
required
array<PublicLotJourneyStep>
ripeness
required
object | null
lab
required
object | null
downloads
required
PublicLotDownloads
issuer
required
PublicIssuer | null

PublicLotDownloads

object

Properties
NameTypeDescription
epcis_url
required
PublicSameOriginPath | null

X3 (#44): the lot's EPCIS 2.0 document (GET /v1/public/lots/{publicId}/epcis.jsonld), present once the lot was sealed with public documents; null otherwise.

credential_url
required
PublicSameOriginPath | null

X3 (#44): the lot's UNTP credential (GET /v1/public/lots/{publicId}/credential), present when the lot was sealed with public documents, its issuer key is not revoked and the lab key its conformity claims cite is not revoked for compromise; null otherwise (then issuer is null too).

customs_dossier_url
required
PublicSameOriginPath | null

X4 (#45): the HTML print view of the lot's code file for China customs (its customs dossier, GET /v1/public/lots/{publicId}/customs-dossier/print?lang=…), present only for a packed lot on a shipment to the CN market; null otherwise.

PublicLotFruit

object

U5 (#58): one public fruit of a lot, from an explicit allowlist. Never a tenant, database id, fruit number, session, line, operator, envelope, device id or key.

Properties
NameTypeDescription
public_id
required
PublicCode

The fruit's public id (its record: /{locale}/q/{public_id}).

code
required
PublicCode

The fruit code printed on its label.

ripeness_level
required
integer

The effective level (L3): the operator's sensory level when overridden, else the device's.

model_confidence
required
number

The device model's confidence, 0..1.

weight_kg
required
number

The bound scale reading, kg.

grade
required
"A" | "B" | "reject"

The grade (L3).

tier
required
PublicTrustTier

As the fruit record's trust.tier: min(the lot's read-time tier, the fruit's own record tier), capped by the fruit's own quarantine hold. A sensory override makes it Self-declared.

sensory_override
required
boolean

An operator replaced the device's level (always true in group overridden, false in measured).

recording_url
required
PublicSameOriginPath | null

The original tap recording (GET /v1/public/fruits/{publicId}/recordings/{sha256}); null when the knock has no stored recording.

PublicLotFruitPage

object

U5 (#58): one page of a public lot's fruits in one group, in fruit order.

Properties
NameTypeDescription
lot
required
object
group
required
"measured" | "overridden"
total
required
integer

Public fruits of the lot in this group.

items
required
array<PublicLotFruit>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

PublicLotJourneyStep

object | object | object | object | object | object

PublicMarket

object

Properties
NameTypeDescription
country_code
required
string
short_name
required
PublicText
authority
required
PublicText

PublicPeak

array<any>

PublicPeriod

object | object

PublicResolution

object

What a scanned or typed code names (#139): open /{locale}/l/{public_id} for a lot and /{locale}/q/{public_id} for a fruit. locale_hint is the locale segment of a scanned record URL, else null.

Properties
NameTypeDescription
kind
required
"lot" | "fruit"
public_id
required
string
locale_hint
required
"vi" | "zh" | "en" | null

PublicSameOriginPath

string

PublicSatelliteCheck

object

Properties
NameTypeDescription
source
required
PublicText
image_date
required
PublicIsoDate
area_matches_registration
required
boolean
deforestation_detected
required
boolean

PublicStatus

"normal" | "recalled" | "withdrawn" | "on_hold" | "under_review"

PublicText

string

PublicTrustTier

"self_declared" | "device_recorded" | "cross_checked" | "lab_verified"

QuarantinedEnvelope

object

Properties
NameTypeDescription
id
required
string
device_id
required
string
seq
required
integer
kind
required
string
event_type
required
string | null
event_time
required
string
lot
required
string | null
growing_area
required
string | null
reasons
required
array<string>

ReauthRequest

object

Properties
NameTypeDescription
password
required
string
code
optional
string

SELF-1-6 (#187): the 6-digit code from the authenticator app; required (or backup_code) when the account has two-step sign-in.

backup_code
optional
string

SELF-1-6 (#187): one unused backup code, instead of code.

RecallExport

object

The FSMA-204-style sortable record of a lot's affected records (P5, #41): one row per critical tracking event in time order: harvesting (at the growing area: the signed harvest event's mass, else the area's declared kg for the date, else empty), initial_packing (one per carton, at the lot's facility and pack time) and shipping (one per carton on the departed shipment, at the departure facility), and transformation (#91: a lot merge the lot took part in, at the merge's facility and time: one row per input lot with the kg taken from it and one of the lot it produced with its kg). Through the chain of merges the record follows the fruit both ways: backward, the merge that produced the lot, the merges that produced its inputs, and so on, with each input lot's harvest (breadth first, at most 8 levels and 64 merges); forward, the merge that consumed the lot, the merge that consumed the lot it produced, and so on (at most 8 merges), with the cartons and shipment of each lot they produced. A row of another lot than the requested one carries that lot's code and product. Times are local (Asia/Ho_Chi_Minh, +07:00). Columns: traceability_lot_code, critical_tracking_event, event_date, event_time, location, location_description, product_description, quantity, unit_of_measure, carton, fruit_count, shipment, container, destination, border_gate, recall_kind, recall_reason. An empty cell is an empty string. Each row property documents its unit and format. At most 186,855 rows.

Properties
NameTypeDescription
format
required
"agritrace-recall-export/1"
lot
required
string
generated_at
required
string (date-time)
recall
required
object | null
columns
required
array<"traceability_lot_code" | "critical_tracking_event" | "event_date" | "event_time" | "location" | "location_description" | "product_description" | "quantity" | "unit_of_measure" | "carton" | "fruit_count" | "shipment" | "container" | "destination" | "border_gate" | "recall_kind" | "recall_reason">
rows
required
array<object>

RecallList

object

#322: the company's recalls and withdrawals, newest first, with their counts.

Properties
NameTypeDescription
items
required
array<object>
total
required
integer

Every recall and withdrawal of the company (items lists the newest 100).

notices_pending
required
integer

Their outbound notices not sent yet.

RecallReason

"contamination" | "pathogen" | "foreign_matter" | "labelling" | "quality" | "regulatory" | "traceability" | "other"

The reason category of a recall or withdrawal (P5, #41), the only part of it the public pages show: contamination (a chemical residue or contaminant over its limit), pathogen (microbial), foreign_matter, labelling (wrong or missing label or origin information), quality (spoilage or a quality defect), regulatory (a market's rule not met), traceability (the evidence cannot be relied on), other.

RecordsExport

object

The records-request export of one lot (W1-3, #152): one sortable sheet for an authority (Circular 17/2021 Art. 6: one step back, one step forward) or a buyer (FSMA 204's electronic sortable spreadsheet within 24 hours). Rows in time order: the critical tracking events (harvesting, receiving, cooling, initial_packing per carton, shipping per carton), the sealed record, every lab result, the recall when any, and every open or escalated hold of the lot. Times are local (+07:00). Bounded: at most 1,000 signed device events (receiving, cooling, packing, shipping) (truncated when more exist), 9,999 cartons and 384 lab results.

Properties
NameTypeDescription
format
required
"agritrace-records-export/1"
lot
required
string
status
required
"draft" | "open" | "paused" | "closed" | "packed" | "shipped" | "recalled" | "withdrawn"

The lot's status when the export was taken.

generated_at
required
string (date-time)
truncated
required
boolean

True when the lot has more than 1,000 signed device events (receiving, cooling, packing, shipping) and only the first 1,000 are listed.

sealed_record
required
object | null

The registry facts frozen at the pack event (sealed_lot.py) with their seal digest and basis; null while the lot is not packed.

columns
required
array<"record_type" | "traceability_lot_code" | "critical_tracking_event" | "event_date" | "event_time" | "record_source" | "event_id" | "location" | "location_description" | "location_address" | "location_registration" | "product_description" | "quantity" | "unit_of_measure" | "area_declared_kg" | "carton" | "fruit_count" | "supplier_name" | "supplier_organisation" | "supplier_code" | "supplier_address" | "supplier_registration" | "harvest_date" | "shipment" | "container" | "seal_number" | "destination" | "border_gate" | "consignee_name" | "consignee_address" | "consignee_country" | "consignee_gln" | "consignee_gacc_record" | "reference_document_type" | "reference_document_number" | "lab_key_custody" | "lab_market" | "sample" | "analyte" | "result_outcome" | "result_value" | "result_unit" | "limit_kind" | "limit_value" | "limit_source" | "verdict" | "sealed_digest" | "sealed_basis" | "recall_kind" | "recall_reason" | "recall_scope" | "hold_kind" | "hold_status" | "device_events_truncated">

The column names in order (the CSV header): every RecordsExportRow property.

rows
required
array<RecordsExportRow>

RecordsExportRange

object

One page of the records-request export of the tenant's lots created in [start, end) (W1-3, #152): the rows of each lot of the page, lot by lot in creation order, as RecordsExport lists them. A page holds at most 50 lots whose cartons together stay within 9,999 (always at least one lot); next_cursor names the next page.

Properties
NameTypeDescription
format
required
"agritrace-records-export-range/1"
start
required
string (date-time)
end
required
string (date-time)
generated_at
required
string (date-time)
lots
required
array<string>

The lot codes of this page, in creation order.

next_cursor
required
string | null

The cursor of the next page; null on the last page.

truncated
required
boolean

True when a lot of the page had more than 1,000 signed device events (receiving, cooling, packing, shipping).

columns
required
array<"record_type" | "traceability_lot_code" | "critical_tracking_event" | "event_date" | "event_time" | "record_source" | "event_id" | "location" | "location_description" | "location_address" | "location_registration" | "product_description" | "quantity" | "unit_of_measure" | "area_declared_kg" | "carton" | "fruit_count" | "supplier_name" | "supplier_organisation" | "supplier_code" | "supplier_address" | "supplier_registration" | "harvest_date" | "shipment" | "container" | "seal_number" | "destination" | "border_gate" | "consignee_name" | "consignee_address" | "consignee_country" | "consignee_gln" | "consignee_gacc_record" | "reference_document_type" | "reference_document_number" | "lab_key_custody" | "lab_market" | "sample" | "analyte" | "result_outcome" | "result_value" | "result_unit" | "limit_kind" | "limit_value" | "limit_source" | "verdict" | "sealed_digest" | "sealed_basis" | "recall_kind" | "recall_reason" | "recall_scope" | "hold_kind" | "hold_status" | "device_events_truncated">

The column names in order (the CSV header): every RecordsExportRow property.

rows
required
array<RecordsExportRow>

RecordsExportRow

object

One row of a records-request export (W1-3, #152): every column on every row, an empty cell an empty string. Each property documents which row kinds fill it, its unit and its format.

Properties
NameTypeDescription
record_type
required
"cte" | "transformation_input" | "sealed_record" | "lab_result" | "recall" | "hold"

The row kind: cte (a critical tracking event), transformation_input (#91: a lot a merge consumed, with the kg taken from it; its critical_tracking_event is transformation), sealed_record (the registry facts frozen at the pack event), lab_result (one result of the lot's signed lab report), recall, or hold (an open or escalated hold of the lot, at its opening time). The CSV also starts, when a lot's signed device events were cut, with a truncation_notice row per cut lot; a JSON row never has that kind.

traceability_lot_code
required
string

The lot code (the traceability lot code of every row).

critical_tracking_event
required
"harvesting" | "receiving" | "cooling" | "transformation" | "initial_packing" | "shipping" | ""

The critical tracking event of a cte row: harvesting (at the growing area), receiving and cooling (signed device events at their facility), initial_packing (one per carton at the lot's facility, and a device's signed pack event at its facility) or shipping (one per carton on the departed shipment, at the departure facility, and a device's signed ship event at its facility), or transformation (#91: a lot merge, on the cte row of the lot it produced and on each transformation_input row, at the merge's facility and time, all with the merge's event_id); empty for the other row kinds.

event_date
required
string (date)

The row's local date (Asia/Ho_Chi_Minh), YYYY-MM-DD: the event, the pack time (sealed_record), the report's signing time (lab_result) or the recall time.

event_time
required
string

The local time with its offset, whole seconds, hh:mm:ss+07:00; empty for a harvest known only by its date.

record_source
required
"signed_device_event" | "self_declared" | "system_record" | "sealed_record" | "signed_lab_report" | ""

How the row's fact was recorded: signed_device_event (a signed device or harvest event), self_declared (the growing area's harvest declaration), system_record (the per-carton packing and shipping records, recall), sealed_record or signed_lab_report; empty for a harvest date without any record. A staff label, not a public trust tier.

event_id
required
string

The signed event's envelope id (harvesting from a signed event, receiving, cooling, and a device's signed packing or shipping event); the merge's id on a transformation row (#91); empty otherwise.

location
required
string

Where: the growing area code (harvesting), the facility code (receiving, cooling, packing, shipping, sealed_record) or the lab code (lab_result); empty for the recall row or an unknown place.

location_description
required
string

The growing area's commune, district and province, the facility's name or the lab's name; empty when unknown. #273: a growing area coded by official administrative unit codes has its commune and province instead (Viet Nam has had no district level since 2025-07-01).

location_address
required
string

The facility's address, district and province, or the growing area's commune, district and province, comma-separated; empty when unknown. #273: a facility or growing area coded by official administrative unit codes has its commune and province instead (Viet Nam has had no district level since 2025-07-01).

location_registration
required
string

The GACC packing-house (PHC) code of the facility or growing-area (PUC) code of the area, as the tenant's registry records it; empty when none.

product_description
required
string

The lot's product and variety, space-separated (e.g. durian Ri6).

quantity
required
number | ""

The quantity in kilograms (unit_of_measure kg), at most 3 decimals: the lot's signed harvest mass (never an area's declaration, see area_declared_kg), the mass a signed device event carries (receiving, cooling, packing, shipping), a carton's net mass, the sealed lot's net mass, or a merge's kilograms (#91: taken from an input, or of the output); empty without one.

unit_of_measure
required
"kg" | ""

kg when quantity is given, else empty.

area_declared_kg
required
number | ""

Harvesting row without a signed harvest mass only: the growing area's self-declared harvest in kilograms for the harvest date (the area's harvest declaration). It is the AREA's figure for the day, shared by every lot of that area and day, not this lot's mass: never add it across lots. Empty on every other row.

carton
required
string

The carton code (initial_packing, shipping); empty otherwise.

fruit_count
required
integer | ""

The fruits in the carton (initial_packing, shipping) or in the sealed lot (sealed_record); empty otherwise.

supplier_name
required
string

One step back (Circular 17/2021 Art. 6 supplier): the grower of the lot's growing area, a grower of the lot's own tenant only, as its member label (Co-op member #<id>); empty when none. Never the grower's legal name, for any role or consent: the name may appear only for an allowed role whose grower's recorded consent scope covers traceability or authority disclosure, and no such scope value is defined yet (#152).

supplier_organisation
required
string

The grower's cooperative; empty when none.

supplier_code
required
string

The growing area code (the sealed record's frozen code on its row); empty without an area.

supplier_address
required
string

The growing area's commune, district and province, comma-separated; empty when unknown. #273: a growing area coded by official administrative unit codes has its commune and province instead (Viet Nam has had no district level since 2025-07-01).

supplier_registration
required
string

The growing area's GACC growing-area (PUC) code; empty when none.

harvest_date
required
string

The lot's harvest date, YYYY-MM-DD; empty when not recorded.

shipment
required
string

One step forward: the shipment code (shipping); empty otherwise.

container
required
string

The ISO 6346 container number (shipping); empty otherwise.

seal_number
required
string

The lot's seal number on the shipment (shipping); empty otherwise.

destination
required
string

The destination market, ISO 3166-1 alpha-2 (shipping); empty otherwise.

border_gate
required
string

The border gate the shipment heads for (shipping); empty otherwise.

consignee_name
required
string

The shipment's consignee (immediate subsequent recipient); empty until the shipment records one (#153).

consignee_address
required
string

The consignee's address; empty until recorded (#153).

consignee_country
required
string

The consignee's country, ISO 3166-1 alpha-2; empty until recorded (#153).

consignee_gln
required
string

The consignee's GS1 GLN; empty until recorded (#153).

consignee_gacc_record
required
string

The importer's GACC registration number; empty until recorded (#153).

reference_document_type
required
"test_report" | "phytosanitary_certificate" | "certificate_of_origin" | "commercial_invoice" | "packing_list" | ""

The reference document's type: test_report on a lab_result row (the shipment's documents once #153 records them); empty otherwise.

reference_document_number
required
string

The reference document's number: the lab's report number on a lab_result row; empty otherwise.

lab_key_custody
required
"lab" | "server" | ""

Who holds the key that signed the lab report: lab (uploaded) or server (portal entry); empty on other rows.

lab_market
required
string

The market whose limits judged the report, ISO 3166-1 alpha-2; empty on other rows.

sample
required
integer | ""

The sample number k (lab_result); empty otherwise.

analyte
required
string

The analyte (lab_result), e.g. cadmium, auramine_o; empty otherwise.

result_outcome
required
"measured" | "not_detected" | ""

measured or not_detected (lab_result); empty otherwise.

result_value
required
number | ""

The measured value in result_unit (lab_result, measured); empty otherwise.

result_unit
required
string

The unit the lab signed (lab_result), e.g. mg/kg; empty otherwise.

limit_kind
required
"max" | "banned" | ""

The market limit that judged the result: max or banned; empty when the market sets none or on other rows.

limit_value
required
number | ""

The maximum in result_unit (limit_kind max); empty otherwise.

limit_source
required
string

The source of the limit as it stood when the report was judged; empty when none.

verdict
required
"pass" | "fail" | ""

pass or fail (lab_result); empty otherwise.

sealed_digest
required
string

The SHA-256 (lower-case hex) of the sealed record (sealed_record); empty otherwise.

sealed_basis
required
"transition" | "migration" | ""

How the sealed record was taken: transition (inside the pack transaction) or migration; empty otherwise.

recall_kind
required
"recall" | "withdrawal" | ""

recall or withdrawal (recall row); empty otherwise.

recall_reason
required
RecallReason | ""

The recall's reason category (recall row); empty otherwise.

recall_scope
required
"consumer" | "retail" | "wholesale" | ""

The recall depth: consumer, retail or wholesale (recall row); empty otherwise.

hold_kind
required
"report" | "quarantine" | "key_compromise" | "lab_failure" | "rejected_component" | ""

The hold's kind (hold row): an open public report, a quarantined component, a device key revoked for compromise, a failing lab result or a rejected component; empty otherwise. ADR 0001: a hold caps what the lot's evidence shows (a compromised key caps it at Self-declared), so read the lot's signed rows with its holds.

hold_status
required
"open" | "escalated" | ""

The hold's status (hold row): open or escalated (still unresolved); empty otherwise. Resolved and withdrawn holds are not listed.

device_events_truncated
required
"true" | "false"

On every row: "true" when this row's lot has more than 1,000 signed device events (receiving, cooling, packing, shipping) and the sheet lists only the first 1,000, else "false". The CSV carries it, and starts with a truncation_notice row per cut lot, so a forwarded file still says it is incomplete; the document's truncated says the same for the whole document.

RecoveryLinkCreate

object

Properties
NameTypeDescription
reason
required
string

Why (one line); written to the company's activity log.

RegistryList

object

An imported published PUC/PHC code list (#150). On the import's answer, superseded names the list it replaced (null for the first of its kind, market and crop).

Properties
NameTypeDescription
id
required
integer
kind
required
"puc" | "phc"

puc: growing-area codes; phc: packing-house codes.

market
required
string

The destination market whose protocol the codes are registered for (ISO 3166-1 alpha-2).

crop
required
string

One of the platform's crops (AGRITRACE_REGISTRY_CROPS; by default coconut, dragon_fruit, durian, jackfruit, mango).

source_url
required
string

The page the list was downloaded from.

source_sha256
required
string

SHA-256 of the file the authority published (its spreadsheet or PDF), which the admin converted into the stored CSV. The server computed it when the original was uploaded (PUT /v1/registry-sources/{sha256}); it ties a Cross-checked registration step back to the authority's own file.

source_media_type
required
"application/pdf" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "text/csv" | null

The media type of the authority's original file source_sha256 names (GET /v1/registry-lists/{id}/source).

published_on
required
string (date) | null (date)

The date the authority published the list, when known.

file_name
required
string
file_sha256
required
string

SHA-256 of the stored file.

file_size
required
integer
entry_count
required
integer
imported_at
required
number

Unix seconds.

imported_by
required
string
superseded_by
required
integer | null
superseded_at
required
number | null

When a later import superseded the list, or when it was retired (then superseded_by is null).

retired_by
required
string | null

Who retired the list (POST /v1/registry-lists/{id}/retire); null unless retired.

retire_reason
required
string | null

Why the list was retired; null unless retired.

current
required
boolean

Neither superseded by a later import nor retired.

stale
required
boolean

Current and older than the configured age.

superseded
optional
integer | null

Only on the import's answer: the id of the list this import superseded.

RegistryListDetail

object

Properties
NameTypeDescription
id
required
integer
kind
required
"puc" | "phc"

puc: growing-area codes; phc: packing-house codes.

market
required
string

The destination market whose protocol the codes are registered for (ISO 3166-1 alpha-2).

crop
required
string

One of the platform's crops (AGRITRACE_REGISTRY_CROPS; by default coconut, dragon_fruit, durian, jackfruit, mango).

source_url
required
string

The page the list was downloaded from.

source_sha256
required
string

SHA-256 of the file the authority published (its spreadsheet or PDF), which the admin converted into the stored CSV. The server computed it when the original was uploaded (PUT /v1/registry-sources/{sha256}); it ties a Cross-checked registration step back to the authority's own file.

source_media_type
required
"application/pdf" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "text/csv" | null

The media type of the authority's original file source_sha256 names (GET /v1/registry-lists/{id}/source).

published_on
required
string (date) | null (date)

The date the authority published the list, when known.

file_name
required
string
file_sha256
required
string

SHA-256 of the stored file.

file_size
required
integer
entry_count
required
integer
imported_at
required
number

Unix seconds.

imported_by
required
string
superseded_by
required
integer | null
superseded_at
required
number | null

When a later import superseded the list, or when it was retired (then superseded_by is null).

retired_by
required
string | null

Who retired the list (POST /v1/registry-lists/{id}/retire); null unless retired.

retire_reason
required
string | null

Why the list was retired; null unless retired.

current
required
boolean

Neither superseded by a later import nor retired.

stale
required
boolean

Current and older than the configured age.

status_counts
required
object
max_age_days
required
integer

RegistryListEntry

object

One row of an imported list: code normalised (NFKC, no whitespace, dashes as '-', upper case), code_raw as written in the file.

Properties
NameTypeDescription
code
required
string
code_raw
required
string
status
required
"active" | "suspended" | "revoked"
holder
required
string | null
province
required
string | null
district
required
string | null
commune
required
string | null
area_ha
required
number | null
valid_from
required
string (date) | null (date)
valid_to
required
string (date) | null (date)

RegistryListEntryPage

object

Properties
NameTypeDescription
items
required
array<RegistryListEntry>
next_cursor
required
string | null

RegistryListImport

object

Properties
NameTypeDescription
kind
required
"puc" | "phc"
market
required
"CN"

A destination market the platform ships to (ISO 3166-1 alpha-2).

crop
required
string

The list's crop: one of the platform's crops (AGRITRACE_REGISTRY_CROPS; by default coconut, dragon_fruit, durian, jackfruit, mango; the Vietnamese names of those are accepted), as GET /v1/registry-lists lists them in crops. Any other crop is refused, and so is an import that would make more than 200 lists current.

source_url
required
string
source_sha256
required
string

SHA-256 of the file the authority published (its spreadsheet or PDF), downloaded from source_url, before the admin converted it to this CSV. It must name an original already uploaded with PUT /v1/registry-sources/{sha256}, whose hash the server computed; any other value is refused. Required: a Cross-checked step must trace back to the authority's own file.

published_on
optional
string (date) | null (date)
file_name
required
string
file_base64
required
string

The CSV file, base64-encoded.

RegistryListPage

object

Properties
NameTypeDescription
items
required
array<RegistryList>
max_age_days
required
integer
crops
required
array<string>

The crops an import may name, sorted (AGRITRACE_REGISTRY_CROPS; by default the D7 crops).

next_cursor
required
string | null

The next page's cursor; null on the last.

RegistryListRetire

object

Properties
NameTypeDescription
reason
required
string

Why the list is retired: 1 to 200 characters on one line.

RegistryMatch

object

A registered code and its check against the current lists.

Properties
NameTypeDescription
code
required
string

The growing area's or facility's own code.

tenant
required
string | null
name
required
string | null
crop
required
string | null

The growing area's crop; null for a facility.

registered_code
required
string

The PUC or PHC as entered.

normalized_code
required
string | null
result
required
"matched" | "no_code" | "no_list" | "not_found" | "mismatch" | "suspended" | "revoked" | "expired"
stale
required
boolean
list_id
required
integer | null

The list that decided (null for mismatch, no_list, no_code).

list_crop
required
string | null

RegistryMatchPage

object

Properties
NameTypeDescription
items
required
array<RegistryMatch>
max_age_days
required
integer
next_cursor
required
string | null

RegistrySourceStored

object

The authority's original file of a code list as the server stored it: sha256 is computed from the bytes.

Properties
NameTypeDescription
sha256
required
string
media_type
required
"application/pdf" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "text/csv"
size
required
integer

Rejection

object

B9 (#21): a device message the server refused (not stored as a record). The payload itself is never returned: raw, untrusted device bytes.

Properties
NameTypeDescription
id
required
integer
route
required
string | null

The ingest route the message came on, {tenant}/{site}/{device}/{kind}[/{eventType}] as the sender wrote it (not proof of who sent it).

envelope_id
required
string | null

The envelope id, when one could be read.

reason
required
string

Why it was refused, for example bad_signature, malformed.

received_at
required
number

Unix seconds.

payload_bytes
required
integer

Size of the stored payload (at most 65,536 bytes are kept).

RejectionPage

object

Properties
NameTypeDescription
items
required
array<Rejection>
next_cursor
required
string | null

The next page's cursor; null on the last page.

Report

object

A public mismatch report as staff triage sees it, with the contact (null when none was given or once erased, 90 days after the resolution). Times are Unix seconds.

Properties
NameTypeDescription
id
required
integer
fruit
required
object
lot
required
object
category
required
ReportCategory
note
required
string
contact
required
string | null
status
required
"open" | "resolved"
outcome
required
"confirmed" | "unfounded" | "duplicate" | null
created_at
required
number
resolved_at
required
number | null

ReportCategory

"label_peeled" | "scanned_many" | "ripeness_off" | "other"

What does not match: label_peeled (the label was peeled or replaced), scanned_many (the code was scanned many times: a copied label is suspected), ripeness_off (the ripeness does not match the record), other.

ReportChallenge

object

A proof-of-work challenge for a public mismatch report (#46, report_challenge.py). Find a solution (1 to 32 ASCII letters and digits; a decimal counter will do) such that SHA-256 of <challenge>:<solution> (UTF-8) starts with difficulty zero bits, and send both with the report within expires_in seconds. Signed by the backend (<id>.<bits>.<expires>.<HMAC-SHA256>), single-use (a challenge files one report) and refused once the deployment's difficulty (AGRITRACE_REPORT_POW_BITS) changes.

Properties
NameTypeDescription
challenge
required
string
difficulty
required
integer
expires_in
required
integer

ReportDetail

object

A public mismatch report as staff triage sees it (Report) with the reported fruit's scan history (A8, #74). Scans are logged only by the web server's own render of the public fruit page (scans.py) and keep only a coarse place (country, region, city from the CDN's geolocation, any of them null when not forwarded) and a device class; there are no coordinates, and never an address or its hash. Times are Unix seconds.

Properties
NameTypeDescription
id
required
integer
fruit
required
object
lot
required
object
category
required
ReportCategory
note
required
string
contact
required
string | null
status
required
"open" | "resolved"
outcome
required
"confirmed" | "unfounded" | "duplicate" | null
created_at
required
number
resolved_at
required
number | null
scans
required
object

ReportPage

object

Properties
NameTypeDescription
items
required
array<Report>
next_cursor
required
string | null

The next page's cursor; null on the last.

ReportReceipt

object

A report was received. Nothing of the report is echoed. #177: fruit and lot are the current public status of the reported fruit and of its lot (the report's hold), read from the origin when the report was filed, so the page can show them at once although an edge-cached record may still show the old status; null when the record is not public.

Properties
NameTypeDescription
status
required
"received"
fruit
required
PublicCurrentStatus | null
lot
required
PublicCurrentStatus | null

ReportResolution

object

confirmed (the mismatch was real and has been dealt with), unfounded (the fruit matches its record) or duplicate (another report covers it). Every outcome resolves the report.

Properties
NameTypeDescription
outcome
required
"confirmed" | "unfounded" | "duplicate"

ReportSubmission

object

A public mismatch report on a public fruit. No other field is accepted (no photo: no public upload route exists). note keeps line breaks and no other control character; contact is one line. Both are trimmed; an empty contact is none. The contact is stored for staff triage only, never returned on a public route, and erased 90 days after the report is resolved.

Properties
NameTypeDescription
publicId
required
string

The public id of the fruit (its page's).

category
required
ReportCategory
note
optional
string
contact
optional
string | null
challenge
required
string

A ReportChallenge's challenge.

solution
required
string

ResidueCertificate

object

#157: a lot's lab results judged against its destination market (see getLotResidueCertificate).

Properties
NameTypeDescription
lot
required
string
product
required
string
report
required
object | null

The lab report; null while the lab has not reported.

market
required
string | null

The destination market the results are judged against.

market_from
required
"shipment" | "lot" | "report" | null

Where the market comes from: the lot's shipment, the lot's own destination, or the lab report.

limits_on
required
string (date) | null (date)

The report's signed date (Asia/Ho_Chi_Minh), the day the limits are read for.

verdict
required
"pass" | "fail" | "incomplete" | null
analytes
required
array<ResidueCertificateAnalyte>
required_analytes
required
array<string>
missing_analytes
required
array<string>

ResidueCertificateAnalyte

object

Properties
NameTypeDescription
analyte
required
string
samples
required
integer

The number of results (one per drawn sample).

outcome
required
"measured" | "not_detected"

measured when a sample measured it, else not_detected.

value
required
number | null

The highest measured value; null when not detected.

lod
required
number | null

The highest detection limit of the results; null when measured.

unit
required
"mg/kg"
limit
required
object | null

The limit the analyte was judged with; null when the market sets none.

verdict
required
"pass" | "fail" | "no_limit"

ReviewRequest

object

Properties
NameTypeDescription
decision
required
"approve" | "reject"
note
optional
string

Optional; recorded with the review.

ReviewResult

object

Properties
NameTypeDescription
id
required
string
status
required
"accepted" | "rejected_after_review"

SampleAnalyte

"cadmium" | "auramine_o"

SampleItem

object

Properties
NameTypeDescription
k
required
integer

Sample number within the lot's sampling.

fruit
required
string

Fruit code as printed on the label.

status
required
"selected" | "received" | "passed" | "failed"

SandboxAccount

object

A new sandbox company and its API token (#218). The token is shown this once: only its SHA-256 is stored.

Properties
NameTypeDescription
tenant_id
required
string

The new company's id, the tenant every record of the token belongs to.

api_token
required
string

An API token of the company, role tenant_admin, sent as Authorization: Bearer. Shown once.

expires_at
required
number

When the token stops working: 24 hours after the creation, Unix seconds.

base_url
required
string (uri)

The sandbox API's address: the requests go to <base_url>/v1/....

SandboxAccountCreate

object

The body of a sandbox account request (#218): empty, or an empty object. The sandbox chooses everything.

SatelliteCheck

object

A satellite check of a growing area.

Properties
NameTypeDescription
id
required
integer
growing_area
required
string
image_date
required
string (date)
provider
required
string
result
required
"match" | "mismatch" | "inconclusive"

Whether the image matches the registered area.

cultivated_ha
required
number | null
deforestation
required
boolean
confidence
required
number | null
image_sha256
required
string | null

SHA-256 of the image attachment; the blob itself is stored elsewhere.

source
required
"manual" | "automatic"

manual for every check recorded through this API.

created_at
required
number

Unix seconds.

SatelliteCheckCreate

object

Properties
NameTypeDescription
image_date
required
string (date)
provider
required
string
result
required
"match" | "mismatch" | "inconclusive"
cultivated_ha
optional
number | null
deforestation
required
boolean
confidence
optional
number | null
image_sha256
optional
string | null

SatelliteCheckPage

object

Properties
NameTypeDescription
items
required
array<SatelliteCheck>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

SealRequest

object

Properties
NameTypeDescription
seal_no
required
string

SecondFactorChallenge

object

SELF-1-6 (#187). The password was right and the account has two-step sign-in: no session yet. Send ticket with a code to POST /v1/auth/login/second-factor before expires_at.

Properties
NameTypeDescription
second_factor
required
"required"
ticket
required
string

32 random bytes (base64url), valid 5 minutes, for one sign-in and at most 5 codes. Only its SHA-256 is stored.

expires_at
required
number

Unix seconds.

SecondFactorLogin

object

Properties
NameTypeDescription
ticket
required
string
code
optional
string

The 6-digit code from the authenticator app (spaces allowed).

backup_code
optional
string

One unused backup code instead (any case, spaces and hyphens allowed).

SecondFactorSession

object

SELF-1-6 (#187). A session opened by the code step: the AuthSession fields plus what proved the second factor.

Properties
NameTypeDescription
user
required
User
memberships
required
array<Membership>
csrf_token
required
string
two_factor
optional
TwoFactorState
second_factor
required
"code" | "backup_code"

What proved the second factor.

backup_codes_left
required
integer

Unused backup codes left (tell the user when it runs low).

SensorSeries

object

SENS-B1e (#235): the hourly, daily (UTC) or farm-day (local_daily, #365) summaries of one capability in a growing area, from the caller's company's devices only, one series per depth (no depth first, then ascending).

Properties
NameTypeDescription
growing_area
required
string
capability
required
string
unit
required
string | null

The vocabulary's UCUM unit of the capability.

grain
required
"hourly" | "daily" | "local_daily"
bucket_s
required
number

Bucket width in seconds: 3600 or 86400.

from
required
number

Start of the range, Unix seconds.

to
required
number

End of the range (excluded), Unix seconds.

truncated
required
boolean

True when the answer reached the bucket cap (5000 buckets in all): the later depths or buckets were left out.

series
required
array<SensorSeriesDepth>
time_zone
optional
"Asia/Ho_Chi_Minh"

local_daily only: the farm time zone whose days the buckets are.

day_starts_at
optional
number

local_daily only: the local midnight (Unix seconds) that starts the farm day holding from, the first bucket a day may have.

SensorSeriesBucket

object

SENS-B1e (#235): one hourly or daily bucket of a sensor series, as the summary of the reading record stores it. The statistics take only the readings flagged pass or not evaluated that have a value; every reading counts in n_total and in its flag's count (QARTOD flags: 1 pass, 2 not evaluated, 3 suspect, 4 fail, 9 missing).

Properties
NameTypeDescription
bucket_start
required
number

Start of the UTC hour or day, or (local_daily) of the farm day: its local midnight. Unix seconds.

min
required
number | null

Null when count is 0.

max
required
number | null

Null when count is 0.

mean
required
number | null

The sum of the values over count; null when count is 0.

count
required
integer

Values in the statistics.

n_total
required
integer

Every reading of the bucket.

n_pass
required
integer

Readings flagged 1 (pass).

n_not_evaluated
required
integer

Readings flagged 2 (not evaluated).

n_suspect
required
integer

Readings flagged 3 (suspect).

n_fail
required
integer

Readings flagged 4 (fail).

n_missing
required
integer

Readings flagged 9 (missing value).

SensorSeriesDepth

object

SENS-B1e (#235): the buckets of one depth, oldest first.

Properties
NameTypeDescription
depth_cm
required
number | null

The readings' depth in cm; null for readings without a depth.

buckets
required
array<SensorSeriesBucket>

SeqGap

object

B9 (#21): an open range of sequence numbers a device has not sent yet (inclusive). It closes, and leaves the list, when the missing messages arrive.

Properties
NameTypeDescription
device_id
required
string
start_seq
required
integer

First missing sequence number.

end_seq
required
integer

Last missing sequence number.

missing
required
integer

How many numbers are missing: end_seq - start_seq + 1.

opened_at
required
number

Unix seconds: when the server first saw the gap.

alerted
required
boolean

Whether the gap has been open long enough to raise a seq_gap alert.

SeqGapPage

object

Properties
NameTypeDescription
items
required
array<SeqGap>
next_cursor
required
string | null

The next page's cursor; null on the last page.

ServerEpoch

object

A signed server epoch value (SENS-B2c, #239). sig is over the canonical JSON of epoch, issuedAt and kid; publicKeyJwk is outside the signed part.

Properties
NameTypeDescription
epoch
required
string

The value a device cites in context.epoch: 128 random bits as lower-case hex.

issuedAt
required
string (date-time)

When the server issued it (UTC, milliseconds).

kid
required
string

The epoch key's id: epoch- and the first 16 hex digits of the SHA-256 of its public key (SubjectPublicKeyInfo DER).

sig
required
object
publicKeyJwk
required
PublicJwk

SessionCommand

object

The set_session outcome for one chosen device: pending (recorded, no transport configured), sent, failed (the transport refused it; the device's command list shows the failed row), refused (refused before any command was recorded: device_not_found when the device is missing, of another tenant or outside the caller's facilities, device_not_approved (#242) when the platform has not approved the device or no active approved key reaches it, its own or an approved gateway's at its site, invalid_command when its profile or the params do not allow it) or skipped (its profile does not declare set_session).

Properties
NameTypeDescription
device_id
required
string
command_id
required
string | null
status
required
"pending" | "sent" | "failed" | "refused" | "skipped"
reason
required
"not_declared" | "dispatch_failed" | "device_not_found" | "device_not_approved" | "invalid_command" | null

SessionFeed

object

Properties
NameTypeDescription
items
required
array<SessionFeedItem>
next_after
required
integer

The rx_seq of the last item, or the given after when there is none.

session_status
required
"open" | "paused" | "closed"
devices
required
array<Device>

The devices stored on the session, by id.

scale
required
null | object

Scale live weight: the newest mass.net reading of the session's devices, or null.

pending
required
object

Fruits of the session still awaiting a device, and those under review.

SessionFeedItem

object

One fruit upsert: the fruit as it is now and the rx_seq of its latest change.

Properties
NameTypeDescription
rx_seq
required
integer
fruit
required
Fruit

SessionsRevoked

object

Properties
NameTypeDescription
sessions_revoked
required
integer

How many live sessions were ended.

Shipment

object

Properties
NameTypeDescription
code
required
string
facility
required
string
container
required
string
border_gate
required
string
destination
required
string
setpoint_c
required
number
tolerance_c
required
number
logger_interval_minutes
required
integer
logger
required
object
status
required
"open" | "departed"
created_by
required
string
created_at
required
number
departed_by
required
string | null
departed_at
required
number | null
lots
required
array<ShipmentLot>
logger_check
required
LoggerCheck
national_portal
required
NationalPortalFiling
upload
optional
object

Only in the answer of an upload: the stored upload, its readings and how many were new.

consignee
required
Consignee | null
documents
required
array<ShipmentDocument>
paperwork
required
ShipmentPaperwork
amendments
required
array<ShipmentAmendment>

ShipmentAmendment

object

A change made after the departure: the consignee or the document list before and after it.

Properties
NameTypeDescription
id
required
integer
kind
required
"consignee" | "documents"
reason
required
string
before
required
object

The consignee (or null) or the document list before the change.

after
required
object

The consignee or the document list after the change.

amended_by
required
string
amended_at
required
number

ShipmentConsigneeSet

object

Properties
NameTypeDescription
consignee
required
ConsigneeInput
reason
optional
string

Required once the shipment departed (the change is kept as an amendment); accepted and not kept before.

ShipmentCreate

object

Properties
NameTypeDescription
code
required
string

Unique within the tenant (a lot code's pattern).

facility
required
string

The departure facility: one of the tenant's, within the caller's facilities.

container
required
string

ISO 6346 container number; its check digit must be valid.

border_gate
required
string

The border gate the shipment heads for (a display string).

destination
required
"CN"

Destination market, ISO 3166-1 alpha-2.

setpoint_c
required
number

Reefer setpoint, Cel.

tolerance_c
optional
number

Deviation from the setpoint a logger reading may show, Cel.

logger_interval_minutes
optional
integer

The longest interval the logger may leave between readings.

logger
required
object

The independent temperature logger: an active device of the tenant's registry at the departure facility whose profile declares air.temperature (vn.agritrace.reefer-logger). The device and its keys are registered by a device admin; the shipment stores no key.

ShipmentDepart

object

An empty object.

ShipmentDocument

object

Properties
NameTypeDescription
type
required
"phytosanitary_certificate" | "certificate_of_origin" | "commercial_invoice" | "packing_list" | "customs_declaration" | "bill_of_lading" | "air_waybill" | "test_report" | "other"
number
required
string
issued_on
required
string (date)
attachment_sha256
required
string | null
added_by
required
string
added_at
required
number

ShipmentDocumentInput

object

Properties
NameTypeDescription
type
required
"phytosanitary_certificate" | "certificate_of_origin" | "commercial_invoice" | "packing_list" | "customs_declaration" | "bill_of_lading" | "air_waybill" | "test_report" | "other"
number
required
string
issued_on
required
string (date)

YYYY-MM-DD, from 2000-01-01 to tomorrow (Asia/Ho_Chi_Minh).

attachment_sha256
optional
string | null

A PDF the tenant uploaded (PUT /v1/attachments/{sha256}); staff-only.

ShipmentDocumentsSet

object

Properties
NameTypeDescription
documents
required
array<ShipmentDocumentInput>

The whole list, each (type, number) once; it replaces the stored one.

reason
optional
string

Required once the shipment departed (the change is kept as an amendment); accepted and not kept before.

ShipmentLot

object

Properties
NameTypeDescription
lot
required
string
status
required
string
cartons
required
integer
seal_no
required
string

The lot's seal number when it was linked.

sealed_at
required
number
current_seal_no
required
string | null

The lot's seal number now.

seal_matches
required
boolean
added_by
required
string
added_at
required
number

ShipmentPaperwork

object

The destination market's paperwork rule (CN: the consignee, the phytosanitary certificate and the test report) and what is still missing. The departure is refused (409 missing_paperwork) while anything is missing.

Properties
NameTypeDescription
required
required
array<string>
missing
required
array<string>
complete
required
boolean

ShipmentSscc

object

#161: the SSCC of a shipment's container load; null until set.

Properties
NameTypeDescription
shipment
required
string
sscc
required
string | null

GS1 Serial Shipping Container Code: 18 digits, the last the GS1 mod-10 check digit.

epc
required
string | null
element_string
required
string | null

SignedInSession

object

SELF-2-1 (#190). One live session of the signed-in user: what the browser told CropPath about itself, read into well-known names, and when it was opened and last used, to the minute. Never the session's token, its hash, its CSRF token, the client's IP address or the raw user agent.

Properties
NameTypeDescription
id
required
integer

The session's id: pass it to revokeMySession.

browser
required
string | null

The browser, such as Chrome, Safari, Firefox, Edge, Cốc Cốc, Zalo or Samsung Internet; null when it could not be told.

os
required
string | null

The operating system: Windows, macOS, iOS, Android, ChromeOS or Linux; null when it could not be told.

mobile
required
boolean

Whether the browser said it runs on a phone.

created_at
required
integer

When the session was opened (sign-in), Unix seconds rounded down to the minute.

last_seen_at
required
integer

When the session was last used, Unix seconds rounded down to the minute (recorded at most once a minute).

current
required
boolean

Whether this is the session making the request.

SignedInSessionList

object

Properties
NameTypeDescription
items
required
array<SignedInSession>

The live sessions, the current one first, then the most recently used.

SignedInSessionRevoked

object

Properties
NameTypeDescription
id
required
integer
revoked
required
true

SprayRecord

object

A spray record with its withholding status.

Properties
NameTypeDescription
id
required
integer
growing_area
required
string
sprayed_on
required
string (date)
product
required
string
active_ingredient
required
string | null
withholding_days
required
integer
evidence_sha256
required
string | null
created_at
required
number

Unix seconds.

safe_from
required
string (date)

sprayed_on plus withholding_days: the first day a harvest is allowed.

evaluated_on
required
string (date)

The harvest date the status was judged against (today's UTC date when none was given).

withholding_status
required
"ok" | "violated"

violated when sprayed_on <= evaluated_on < safe_from.

SprayRecordCreate

object

Properties
NameTypeDescription
sprayed_on
required
string (date)
product
required
string
active_ingredient
optional
string | null
withholding_days
required
integer
evidence_sha256
optional
string | null

SprayRecordPage

object

Properties
NameTypeDescription
items
required
array<SprayRecord>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

SsccChange

object | object

Set the SSCC (a number of the company's own GS1 membership, not under the platform's prefix), or allocate the next SSCC of the platform's GS1 company prefix.

StationActionRecord

object

#85: an operator's action recorded offline at an edge station, signed with the station's key.

Properties
NameTypeDescription
v
required
1
id
required
string (uuid)
type
required
"accept" | "remeasure" | "print"
gateway
required
string
seq
required
integer

The station's action counter: replay order.

delegation
required
string
operator
required
string
fruit
required
string
round
optional
integer

A re-measure only: the round the station numbered.

recorded_at
required
string (date-time)

The station's time, ISO 8601 with a zone offset.

time_source
optional
"gnss" | "ntp" | "unsynced"

The station's clock state. unsynced (the station found its clock off): the action is placed in the delegation by since_claim_s alone, and refused (403 unsynced_clock) without it.

since_claim_s
optional
integer

Whole seconds (0 to 2^31 - 1) since the station claimed the delegation, by its monotonic clock, rounded up; above the delegation's length plus 300 s the action is refused (403 delegation_expired), whatever recorded_at says.

after
optional
array<string (uuid)>

The fruit's envelopes the station recorded before the action.

sig
required
StationSignature

StationActionResult

object

Properties
NameTypeDescription
id
required
string
type
required
"accept" | "remeasure" | "print"
outcome
required
"applied"
seq
required
integer
fruit
required
object

StationClaim

object

Properties
NameTypeDescription
delegation
required
object
labels
required
array<StationLabel>
last_seq
required
integer | null

The highest seq the cloud recorded from the station (null before its first action): the station's action counter moves above it before it records.

time
required
number

The cloud's time (Unix seconds): the station counts the delegation's end from it on its monotonic clock.

StationClaimRequest

object

Properties
NameTypeDescription
gateway
required
string
time
required
string (date-time)

The station's time, ISO 8601 with a zone offset.

code
required
string
sig
required
StationSignature

StationDelegation

object

#85: a station sign-in (Unix times).

Properties
NameTypeDescription
id
required
string
gateway
required
string
operator
required
string

The operator's opaque id (user-<id>).

state
required
"pending" | "unclaimed" | "active" | "expired" | "revoked"

pending: the code not typed yet; unclaimed: the code expired unused; active: claimed by the station; expired: past expires_at; revoked.

issued_at
required
number
code_expires_at
required
number
expires_at
required
number
claimed_at
required
number | null
revoked_at
required
number | null

StationDelegationList

object

Properties
NameTypeDescription
items
required
array<StationDelegation>

StationLabel

object

What the station's printer queue prints a fruit's 40 x 30 mm label from (#66, #92).

Properties
NameTypeDescription
code
required
string
lot
required
string
n
required
integer
round
required
integer

The fruit's measurement round.

status
required
string
qr_url
required
string (uri)
label_code
optional
string

#326, with label_code=1 only: the fruit's lookup code (#288) in its grouped form (three groups of five Crockford base 32 characters), derived from the fruit's public id. The station's fruit label prints it beside the QR code; a person types it on the scan page when the QR code cannot be scanned, and GET /v1/public/resolve answers it with the fruit.

StationSignature

object

ES256 over the canonical JSON of every member but sig (an envelope's signature).

Properties
NameTypeDescription
alg
required
"ES256"
kid
required
string
value
required
string

StationSignIn

object

#85: a new station sign-in with its one-time code (shown only in this answer).

Properties
NameTypeDescription
id
required
string
gateway
required
string
operator
required
string

The operator's opaque id (user-<id>).

state
required
"pending" | "unclaimed" | "active" | "expired" | "revoked"

pending: the code not typed yet; unclaimed: the code expired unused; active: claimed by the station; expired: past expires_at; revoked.

issued_at
required
number
code_expires_at
required
number
expires_at
required
number
claimed_at
required
number | null
revoked_at
required
number | null
code
required
string

Typed on the station's screen within 10 minutes.

StationSignInRequest

object

#85: a station sign-in; lifetime_s its length (default the most, one shift).

Properties
NameTypeDescription
lifetime_s
optional
integer

StationSync

object

Properties
NameTypeDescription
delegations
required
map<string, "active" | "revoked" | "expired" | "unknown">
labels
required
array<StationLabel>
last_seq
required
integer | null

The highest seq the cloud recorded from the station (null before its first action).

time
required
number

StationSyncRequest

object

Properties
NameTypeDescription
gateway
required
string
time
required
string (date-time)

The station's time, ISO 8601 with a zone offset.

delegations
optional
array<string>
sig
required
StationSignature

StoredEnvelope

object

A stored envelope (envelope version 1, see Envelope: its schema is served at /developers/downloads/envelope-v1.schema.json, its event types at /developers/downloads/event-types-v1.json; open here) plus the server-added _status.

Properties
NameTypeDescription
_status
required
string

SupportRequest

object

A support request as its company sees it (never who at CropPath changed it).

Properties
NameTypeDescription
id
required
integer
tenant
required
string

The company the request came from.

user
required
SupportRequestUser
subject
required
string

Plain text, as typed (trimmed).

body
required
string

Plain text, as typed (trimmed): never HTML or markdown; line breaks are kept.

record_id
required
string | null

The record the request is about (a lot code, device id, public id, ...), or null.

status
required
"open" | "in_progress" | "answered" | "closed"

open (new), in_progress (CropPath is on it), answered (CropPath replied and waits for the company) or closed.

reply
required
string | null

CropPath's reply (plain text), or null.

created_at
required
number

Seconds since 1970 (UTC).

updated_at
required
number

When the request was sent or CropPath last changed it.

SupportRequestCreate

object

Properties
NameTypeDescription
subject
required
string

1 to 200 characters after trimming; no line breaks or other control characters.

body
required
string

1 to 5000 characters after trimming; line breaks and tabs allowed, no other control characters. Stored and shown as plain text.

record_id
optional
string | null

Optional: at most 100 letters, digits and . _ : / # -, starting with a letter or digit; blank or null for none.

SupportRequestPage

object

Properties
NameTypeDescription
items
required
array<SupportRequest>
next_cursor
required
string | null

The next page's cursor; null on the last.

SupportRequestUpdate

object

A status, a reply, or both.

Properties
NameTypeDescription
status
optional
"open" | "in_progress" | "answered" | "closed"

open (new), in_progress (CropPath is on it), answered (CropPath replied and waits for the company) or closed.

reply
optional
string | null

Plain text; line breaks allowed; null or blank clears it.

SupportRequestUser

object

The member who sent the request.

Properties
NameTypeDescription
id
required
integer
email
required
string
display_name
required
string | null

Tenant

object

Properties
NameTypeDescription
id
required
string
name
required
string
source
required
"manual" | "backfill"
created_at
required
number

Unix seconds.

members
required
integer

SELF-1-3 (#184): how many people hold an active membership of the tenant (each counted once); SELF-1-4 (#185): a membership the company turned off does not count.

admins
required
integer

SELF-1-3 (#184): how many of them are active company admins whose account is active (SELF-1-4, #185).

offboarding
required
CompanyOffboarding

SELF-2-4 (#193): whether the company is leaving CropPath.

platform
optional
boolean

#282: present only with listTenants platform=1. true for a company that can never be marked as leaving CropPath: the company of CropPath's platform admins (it holds a platform admin's membership; startCompanyOffboarding answers 409 platform company) and (#283) the company record of CropPath's lab logins (croppath-labs; 409 lab logins company).

TenantAdmin

object

Properties
NameTypeDescription
user_id
required
integer
email
required
string

The email the admin signs in with.

display_name
required
string | null
status
required
"active" | "disabled"

TenantAdminList

object

Properties
NameTypeDescription
items
required
array<TenantAdmin>

TenantCreate

object

Properties
NameTypeDescription
id
required
string
name
required
string

TenantPage

object

Properties
NameTypeDescription
items
required
array<Tenant>
next_cursor
required
string | null

Pass as cursor for the next page; null on the last page.

TrustReason

object

A machine-readable explanation: a stable code and its parameters, no prose.

Properties
NameTypeDescription
code
required
string

A stable reason code of the trust engine (trust.Code).

params
required
map<string, string | integer>

TrustTier

"self_declared" | "device_recorded" | "cross_checked" | "lab_verified"

Trust tiers, lowest first.

TwoFactorCode

object

Properties
NameTypeDescription
code
required
string

The 6-digit code the app shows now.

TwoFactorDisable

object

Properties
NameTypeDescription
password
required
string
code
optional
string

The 6-digit code from the app; or send backup_code.

backup_code
optional
string
set_up_again
optional
boolean

Turning it off to set the app up again at once (a new phone): allowed even when the account must use two-step sign-in.

TwoFactorReset

object

Properties
NameTypeDescription
reason
optional
string

Required from a platform admin (CropPath support): one line, kept in the company's activity log. Ignored for a company admin.

TwoFactorResetResult

object

Properties
NameTypeDescription
user_id
required
integer
two_factor
required
false
sessions_revoked
required
integer

The member's sessions ended by the reset.

TwoFactorSetup

object

SELF-1-6 (#187). A new secret for the authenticator app, in this response only: show otpauth_uri as a QR code (never log it or send it anywhere else) and secret as text to type in.

Properties
NameTypeDescription
secret
required
string

160 random bits in base32 (RFC 4648, no padding).

otpauth_uri
required
string

otpauth://totp/CropPath:<email>?secret=...&issuer=CropPath

issuer
required
"CropPath"
account
required
string
digits
required
6
period
required
30

TwoFactorState

object

SELF-1-6 (#187). The signed-in user's own two-step sign-in. Never the secret or a code.

Properties
NameTypeDescription
enabled
required
boolean

The authenticator app is on for this account.

backup_codes_left
required
integer

Unused backup codes (0 when the app is off).

verified
required
boolean

This session proved a second factor (a code at sign-in, at re-authentication or when the app was turned on).

required
required
boolean

This account must use two-step sign-in when acting for the selected company (a platform admin; a company admin after the deadline; a member of a company that requires it). When it is true and verified is false, every company route answers 403 two_factor_required and the console shows the setup screen.

deadline
required
number | null

For a company admin before the deadline: the Unix time from which two-step sign-in is required (the console prompts until then); null otherwise.

UiTelemetryBeacon

object

A browser beacon (#81): a page kind, the page's Core Web Vitals in the browser's units and the uncaught errors it saw. At least one measure or error. No URL, id, message or stack.

Properties
NameTypeDescription
page
required
"landing" | "lot" | "fruit" | "fruit_results" | "privacy" | "accessibility" | "staff" | "other"

The kind of page, never its URL.

lcp_ms
optional
number

Largest Contentful Paint, milliseconds.

cls
optional
number

Cumulative Layout Shift (largest session window).

inp_ms
optional
number

Interaction to Next Paint, milliseconds.

errors
optional
array<object>

User

object

Properties
NameTypeDescription
id
required
integer
email
required
string
display_name
required
string | null

VerdictCounts

object

SENS-B1e (#235): how many positions of the device got each geofence verdict in the range.

Properties
NameTypeDescription
inside
required
integer
near
required
integer
outside
required
integer
ambiguous
required
integer
unverifiable
required
integer
no_position
required
integer
no_polygon
required
integer

VerdictMap

object

SENS-B1e (#235): the growing area's devices with their geofence verdicts over a range of reception times.

Properties
NameTypeDescription
growing_area
required
string
from
required
number

Start of the range of reception times, Unix seconds.

to
required
number

End of the range (included), Unix seconds.

coordinates_shown
required
boolean

Whether the install points and judged positions are given to this caller.

truncated
required
boolean

True when more than 500 devices matched: the rest, by device id, were left out.

devices
required
array<VerdictMapDevice>

Ordered by device id.

polygon
optional
GeoJsonPolygon | null

The area's boundary, present only for the owning tenant_admin and platform_admin (as the growing-area read); null: no boundary.

VerdictMapDevice

object

SENS-B1e (#235): one device of the caller's company bound to the area or judged against it in the range.

Properties
NameTypeDescription
device_id
required
string
profile
required
string
placement
required
VerdictMapPlacement | null

Null for a device without a placement.

verdict_counts
required
VerdictCounts
latest_verdict
required
GeofenceVerdict | null
latest_verdict_at
required
number | null

When ingest judged the latest position (its reception).

latest_position
optional
JudgedPosition | null

Present only when coordinates_shown (a platform admin, or an operator or admin of the area's owning company); never public. Null when no position was judged in the range.

VerdictMapPlacement

object

SENS-B1e (#235): the device's current placement version.

Properties
NameTypeDescription
version
required
integer
mobility
required
"fixed" | "mobile"
growing_area
required
string | null

The area the version binds the device to.

bound_here
required
boolean

The version is an installation bound to this area.

depth_cm
required
number | null
installed_at
required
number | null
removed_at
required
number | null

Set when the current version is a removal.

install_point
optional
MapPoint | null

Present only when coordinates_shown (a platform admin, or an operator or admin of the area's owning company); never public. Null for a version without one.

Volume

object

Properties
NameTypeDescription
growing_area
required
string
season
required
string
declared_kg
required
number
cap_kg
required
number | null

area_ha times yield_kg_per_ha; null when the growing area is unknown or is a tenant-created area not yet approved by a platform admin.

WebhookDelivery

object

One delivery of one event to the subscription: pending (attempted at next_attempt_at), delivered (a 2xx answer) or failed (12 attempts over about 21 hours, or the subscription was disabled). Unix seconds.

Properties
NameTypeDescription
id
required
integer
subscription_id
required
integer
event_id
required
string

The webhook-id header: the same on every attempt and redelivery.

event_type
required
WebhookEventType
status
required
"pending" | "delivered" | "failed"
attempts
required
integer

Since the delivery was queued or redelivered.

next_attempt_at
required
number | null
last_attempt_at
required
number | null
last_status
required
integer | null

The last attempt's HTTP status; null: none.

last_error
required
string | null

Why the last attempt failed: http_status (a non-2xx answer, a redirect included), blocked_address (the host resolved to an address that is not public), dns_failure, connect_failed, tls_error, timeout (10 seconds for the whole attempt), protocol_error, invalid_url, secret_unavailable, subscription_disabled, internal_error.

created_at
required
number
delivered_at
required
number | null

WebhookDeliveryPage

object

Properties
NameTypeDescription
items
required
array<WebhookDelivery>
next_cursor
required
string | null

The next page's cursor; null on the last.

WebhookEventLabResultRecorded

object

The body of a lab_result.recorded delivery (compact JSON, UTF-8).

Properties
NameTypeDescription
id
required
string

Equals webhook-id.

type
required
"lab_result.recorded"
created_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

tenant
required
string
data
required
WebhookLabResultRecordedData

WebhookEventLotRecalled

object

The body of a lot.recalled delivery (compact JSON, UTF-8).

Properties
NameTypeDescription
id
required
string

Equals webhook-id.

type
required
"lot.recalled"
created_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

tenant
required
string
data
required
WebhookLotRecalledData

WebhookEventLotSealed

object

The body of a lot.sealed delivery (compact JSON, UTF-8).

Properties
NameTypeDescription
id
required
string

Equals webhook-id.

type
required
"lot.sealed"
created_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

tenant
required
string
data
required
WebhookLotSealedData

WebhookEventLotTrustTierChanged

object

The body of a lot.trust_tier_changed delivery (compact JSON, UTF-8).

Properties
NameTypeDescription
id
required
string

Equals webhook-id.

type
required
"lot.trust_tier_changed"
created_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

tenant
required
string
data
required
WebhookTrustTierChangedData

WebhookEventLotWithdrawn

object

The body of a lot.withdrawn delivery (compact JSON, UTF-8).

Properties
NameTypeDescription
id
required
string

Equals webhook-id.

type
required
"lot.withdrawn"
created_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

tenant
required
string
data
required
WebhookLotRecalledData

WebhookEventReportFiled

object

The body of a report.filed delivery (compact JSON, UTF-8).

Properties
NameTypeDescription
id
required
string

Equals webhook-id.

type
required
"report.filed"
created_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

tenant
required
string
data
required
WebhookReportFiledData

WebhookEventShipmentDeparted

object

The body of a shipment.departed delivery (compact JSON, UTF-8).

Properties
NameTypeDescription
id
required
string

Equals webhook-id.

type
required
"shipment.departed"
created_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

tenant
required
string
data
required
WebhookShipmentDepartedData

WebhookEventType

"lot.sealed" | "lot.recalled" | "lot.withdrawn" | "lab_result.recorded" | "shipment.departed" | "lot.trust_tier_changed" | "report.filed"

An event a subscription can take: lot.sealed (a lot closed and signed), lot.recalled and lot.withdrawn (a recall or withdrawal), lab_result.recorded (a lab report stored, from the lab's signature or its portal), shipment.departed (the ship event), lot.trust_tier_changed (the displayed trust tier of a lot moved) and report.filed (a public mismatch report on one of the tenant's fruits).

WebhookLabResultRecordedData

object

lab_result.recorded: a lab report of the lot's sampling was stored; passed is the verdict against the market's limits (the values are read through the API).

Properties
NameTypeDescription
lot
required
string
sampling_id
required
integer
lab
required
string
report_no
required
string
market
required
string
signed_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

passed
required
boolean

WebhookLotRecalledData

object

lot.recalled and lot.withdrawn: the lot's recall or withdrawal (P5). The staff note never appears.

Properties
NameTypeDescription
lot
required
string
public_id
required
string

The lot's public id (its QR record).

kind
required
"recall" | "withdrawal"
reason
required
"contamination" | "pathogen" | "foreign_matter" | "labelling" | "quality" | "regulatory" | "traceability" | "other"
scope
required
"consumer" | "retail" | "wholesale"
recalled_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

cartons
required
integer
shipments
required
integer

WebhookLotSealedData

object

lot.sealed: the lot was closed and its manifest signed (L10).

Properties
NameTypeDescription
lot
required
string
public_id
required
string

The lot's public id (its QR record).

facility
required
string
sealed_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

manifest_sha256
required
string
fruit_count
required
integer
event_count
required
integer

WebhookReportFiledData

object

report.filed: a consumer filed a mismatch report on one of the lot's fruits (X5). The note and the contact never appear.

Properties
NameTypeDescription
report_id
required
integer
lot
required
string
fruit
required
string
category
required
"label_peeled" | "scanned_many" | "ripeness_off" | "other"
filed_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

WebhookSecret

object

The subscription and, in secret, its signing secret: this response is the only place it appears (Standard Webhooks format: whsec_ + base64 of 32 random bytes; the HMAC key is the decoded bytes). Store it now; a lost secret is rotated.

Properties
NameTypeDescription
subscription
required
WebhookSubscription
secret
required
string

WebhookShipmentDepartedData

object

shipment.departed: the shipment left its facility; its lots are shipped.

Properties
NameTypeDescription
shipment
required
string
facility
required
string
container
required
string
border_gate
required
string
destination
required
string
departed_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.

lots
required
array<string>

WebhookSubscription

object

A webhook subscription of the tenant: never its secret (stored encrypted, shown once by create and by rotate-secret). Unix seconds.

Properties
NameTypeDescription
id
required
integer
url
required
string

The endpoint: https only, no credentials, no fragment; every address its host resolves to is public (checked when set and again at every delivery).

description
required
string
event_types
required
array<WebhookEventType>
status
required
"active" | "disabled"

Only an active subscription takes new events and is delivered to.

disabled_reason
required
"manual" | "failures" | null

manual: turned off by an admin; failures: 50 failed attempts in a row. null while active.

disabled_at
required
number | null
consecutive_failures
required
integer

Failed delivery attempts since the last success.

created_by
required
string
created_at
required
number
updated_at
required
number

WebhookSubscriptionCreate

object

A tenant holds at most 20 subscriptions. The secret is generated by the server.

Properties
NameTypeDescription
url
required
string
event_types
required
array<WebhookEventType>
description
optional
string | null

One line.

WebhookSubscriptionList

object

Properties
NameTypeDescription
items
required
array<WebhookSubscription>

WebhookSubscriptionUpdate

object

At least one field. enabled: false disables the subscription (manual) and fails its pending deliveries (subscription_disabled); enabled: true makes it active again with no failures counted.

Properties
NameTypeDescription
url
optional
string
event_types
optional
array<WebhookEventType>
description
optional
string | null
enabled
optional
boolean

WebhookTrustTierChangedData

object

lot.trust_tier_changed: a recompute moved the lot's displayed trust tier (ADR 0001; a hold drops it to self_declared, its resolution restores at most the sealed tier). Not sent for a lot's first snapshot.

Properties
NameTypeDescription
lot
required
string
public_id
required
string

The lot's public id (its QR record).

tier
required
TrustTier
previous_tier
required
TrustTier
status
required
"normal" | "on_hold"
changed_at
required
string (date-time)

UTC, ISO 8601 with milliseconds.