CropPath cho nhà phát triển

Tài liệu API

public

25 thao tác

GET /v1/public/fruits/{publicId}

Public fruit record (and the scan of the web server's own read)

Không cần xác thực · getPublicFruit

The public fruit page (man3), anonymous and tenant-less: no session, bearer token, cookie, CSRF token or X-Tenant is needed, and a request carrying any of them gets exactly the anonymous answer. Built from an explicit allowlist (the frontend's publicFruitSchema at waveX-c1-public-contract, mirrored as PublicFruit): no tenant, internal id, operator, line, envelope, IP data, coordinate or polygon; the grower's name only with public-display consent. A fruit is public when its lot is public (open or closed, see getPublicLot), its status is recorded or overridden (owner decision D4: awaiting_device, rejected and re-measured fruits are 404), its lot has a growing area and its measurement has every non-null field. The trust tier is min(lot tier, the fruit's own record tier), derived at read time; a sensory override demotes the record to Self-declared; an open hold (the lot's, or the fruit's own quarantined envelope) makes status on_hold with the capped tier; an open public report on any fruit of the lot (#46) holds the lot too, and while it is the only hold open status is under_review, with the capped tier. report.url is where a report is filed (POST /v1/public/reports). trust.signature is the knock envelope's signature as hex, re-verified against the registered key. Scans (owner decision D3): only a request carrying X-Agritrace-Scan-Key equal to the backend's AGRITRACE_PUBLIC_SCAN_KEY (the web server's own render) logs a scan; only then are its forwarded cf-ipcountry, cf-region, cf-ipcity, cf-connecting-ip and user-agent read (bounded; the address is stored only as an HMAC under a daily salt deleted after the day), scan is returned and the response is private, no-store. Any other request gets scan: null, writes nothing and is cacheable. More than 3 distinct scan places of one fruit open a label_clone_suspected alert (report.scan_threshold). There is no scan POST. Not audited (a read; a scan row is data). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second).

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The fruit's public id (128 random bits as hex). Any other value is 404 like an unknown id.

lang
không bắt buộc
query"vi" | "zh-Hans" | "en"

Page language; absent means vi. Anything else (unknown, empty, repeated) is 400.

trust_limits
không bắt buộc
query"0" | "1"

#280: 1 adds the record's trust.limited_by (the public pages ask for it); 0 or none leaves it out; any other value is refused (400 bad trust_limits).

map
không bắt buộc
query"0" | "1"

#293: 1 adds the record's commune map (origin.map, the public pages ask for it); 0 or none leaves it out; any other value is refused (400 bad map).

X-Agritrace-Scan-Key
không bắt buộc
headerstring

Internal scan key, sent only by the web server (D3): its read for the page's scan call (#177) and its read for the page itself. Equal to the configured key: the read logs a scan and trusts the forwarded cf-ipcountry, cf-region, cf-ipcity, cf-connecting-ip and user-agent headers, unless X-Agritrace-No-Scan: 1 is sent too. Absent or different: those headers are ignored and nothing is written.

X-Agritrace-No-Scan
không bắt buộc
header"1"

#177: sent as exactly 1 with the scan key by the web server's read for the page itself, which the edge may cache: the read is keyed for the per-visitor rate limit only, logs nothing, answers scan: null and is cacheable. Any other value, or without the key: no effect.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicFruit
application/json

The fruit's public record.

400Error
application/json

lang is not one of vi, zh-Hans, en, or map is not 0 or 1 (Cache-Control: no-store), or the X-Request-Id header is malformed.

404Error
application/json

Not a public fruit: an unknown or malformed id, a fruit that is not recorded or overridden, a fruit of a lot that is not public or has no growing area, or one lacking a field the record needs. Every such id gets this same body (not_found) and headers, logs no scan, and is never echoed. One exception (D27, #322): a fruit taken out at grading (status rejected) of a public lot answers fruit_rejected, so the page its label opens can say the fruit was rejected at grading instead of naming no record; that body says nothing else about the fruit or its lot, the headers are the same, no scan is logged, and every other route of the fruit (credential, corrections, recording) answers the uniform not_found.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate); private, no-store when this read logged a scan (the internal scan key was sent without X-Agritrace-No-Scan: 1). Never Set-Cookie.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store on bad lang and bad map.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "status": "normal",
  "status_since": null,
  "status_reason": null,
  "public_id": "73879f17d0930440809333f141385eb6",
  "code": "Q-001-0002",
  "crop": "durian",
  "variety": "Ri6",
  "harvested_on": "2026-09-27",
  "harvest_place": "Ngũ Hiệp, Cai Lậy, Tiền Giang, Việt Nam",
  "carton_no": null,
  "lot": {
    "public_id": "758b25cfec067a59db94fea0fc7f0202",
    "code": "LO-260928-014"
  },
  "trust": {
    "tier": "self_declared",
    "signature": {
      "status": "valid",
      "value": "7c98aba0eab54ab76083f43f371951b8be60826a1d860a67d77a387fe432fb0b263aae3631f218b70d247ed1cf5266e57234ecc90cbf84546d31006fa7e3f3bd"
    }
  },
  "scan": {
    "scan_number": 2,
    "scanned_on": "2026-09-28",
    "city": "Nanning",
    "region": "Guangxi",
    "days_since_harvest": 1
  },
  "measurement": {
    "measured_at": "2026-09-28T08:56:00+07:00",
    "device": {
      "model": "SF-100",
      "serial": "0417"
    },
    "ripeness_level": 3,
    "model_confidence": 0.88,
    "weight_kg": 2.94,
    "grade": "A",
    "eating_window": {
      "start": "2026-10-01",
      "end": "2026-10-02"
    },
    "waveform_peaks": null
  },
  "origin": {
    "growing_area": {
      "code": "VN-TGOR-0387",
      "area_ha": 4.2,
      "tree_count": 610
    },
    "grower": {
      "name": null,
      "organization": "HTX Ngũ Hiệp"
    },
    "orchard_position": null,
    "tree_age_years": 9,
    "last_spray": {
      "applied_on": "2026-09-02",
      "withholding_days": 25
    },
    "certification": {
      "scheme": "VietGAP",
      "status": "valid"
    },
    "satellite": {
      "source": "Sentinel-2",
      "image_date": "2026-09-25",
      "area_matches_registration": true,
      "deforestation_detected": false,
      "image_url": null
    }
  },
  "journey": [
    {
      "kind": "harvest",
      "period": {
        "precision": "day",
        "start": "2026-09-27",
        "end": null
      },
      "tier": "cross_checked",
      "source": "registered_app",
      "device_approval": {
        "approved": true,
        "approved_on": "2026-09-20"
      }
    },
    {
      "kind": "measurement",
      "period": {
        "precision": "minute",
        "start": "2026-09-28T08:56:00+07:00",
        "end": null
      },
      "tier": "device_recorded",
      "source": "device",
      "facility": {
        "code": "VN-TGPH-021",
        "name": "Tân Phú"
      },
      "device_model": "SF-100",
      "device_approval": {
        "approved": true,
        "approved_on": "2026-09-20"
      }
    }
  ],
  "downloads": {
    "epcis_url": null,
    "credential_url": null
  },
  "report": {
    "scan_threshold": 3,
    "url": null
  }
}
Phản hồi 400 · application/json · lang
{
  "error": "bad lang",
  "code": "bad_lang"
}
Phản hồi 400 · application/json · requestId
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 400 · application/json · map
{
  "error": "bad map",
  "code": "bad_map"
}
Phản hồi 404 · application/json · notFound
{
  "error": "not found: fruits",
  "code": "not_found"
}
Phản hồi 404 · application/json · rejected
{
  "error": "fruit rejected: this fruit was taken out at grading and has no public record",
  "code": "fruit_rejected"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/resolve

Resolve a scanned or typed code to its public lot or fruit record

Không cần xác thực · resolvePublicCode

The scan page's lookup (#139), anonymous and tenant-less like the public records: a request carrying a session, token, cookie or X-Tenant gets exactly the anonymous answer. code is the text a QR code or barcode decoded to, or that a visitor typed. Accepted (ADR 0004): our record URLs /{vi|zh|en}/l/{publicId} (lot) and /{vi|zh|en}/q/{publicId} (fruit, or a carton label: its lot), also without the locale segment, on the resolver origin (the deployment's AGRITRACE_RESOLVER_BASE, default https://txng.theio.vn) or AGRITRACE_PUBLIC_ORIGIN, with or without the scheme, or as a relative path; GS1 Digital Link URIs /01/{gtin}/10/{lot}/21/{serial} on those origins or id.gs1.org (the fruit, or the carton's lot, the serial names); GS1 element strings (01)…(10)…(21)… and raw scanner data (symbology identifier, GS-separated fields; AIs 11, 12, 13, 15, 16 and 17 are skipped); and a bare 32-hex public id. A GTIN may have 8, 12, 13 or 14 digits and needs a valid check digit. Never resolved: the codes printed for people (fruit Q-…, carton C-… and lot codes), which are sequential within a tenant; a GTIN and lot code without a serial, in any of the forms above, which no label prints and which would list a GTIN's lots by their guessable codes. Only a record the public pages show is answered (a public lot, a public fruit); everything else is the same 404, the code never echoed. Each request takes a token from the /v1/public/* bucket and from its own harder per-client bucket (bursts of 60, then 30 a minute).

Tham số

TênVị tríKiểuMô tả
code
bắt buộc
querystring

The decoded or typed text, sent once, 1 to 512 characters (surrounding whitespace is ignored). Missing, empty, repeated or longer is 400.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicResolution
application/json

The public record the code names.

400Error
application/json

code is missing, empty, repeated or longer than 512 characters (Cache-Control: no-store; the code is never echoed), or the X-Request-Id header is malformed.

404Error
application/json

The code names no public record: an unknown, malformed or foreign code, a printed human code, a hidden lot or fruit, or a GS1 key without a serial. Every such code gets this same body and headers; the code is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many requests from this client address: the /v1/public/* bucket (bursts of 60, then 20 a second) or the resolve bucket (bursts of 60, then 30 a minute). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer. Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store on bad code.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "kind": "fruit",
  "public_id": "73879f17d0930440809333f141385eb6",
  "locale_hint": null
}
Phản hồi 400 · application/json · code
{
  "error": "bad code",
  "code": "bad_code"
}
Phản hồi 400 · application/json · requestId
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 404 · application/json
{
  "error": "not found: codes",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/linkset

Identity Resolver link set of a scanned or typed code

Không cần xác thực · getPublicLinkset

#162: the UNTP Identity Resolver answer (UNTP 0.7.0) for a code: an IETF link set (RFC 9264, application/linkset+json) of the public record the code names, decided exactly as GET /v1/public/resolve decides it (the same accepted forms: our record URLs /l/{publicId} and /q/{publicId} with or without a locale, GS1 Digital Link URIs /01/{gtin}/10/{lot}[/21/{serial}] (the serial-less lot key once the lot is sealed), GS1 element strings and a bare public id; the same enumeration rules, the same 404 and the same 410). A lot's context (anchor https://<domain>/l/{publicId}, the id its passport gives the product) lists its UNTP passport (dpp), the packing facility's record (dfr), the lab's conformity credential (dcc), its EPCIS document (https://gs1.org/voc/traceability) and its public page in each language (https://gs1.org/voc/pip, hreflang vi, en, zh), each only while its download answers. A fruit's code answers the fruit's context (anchor https://<domain>/q/{publicId}: its passport and pages) and then its lot's; a carton's code answers its lot's. The printed label URLs https://<domain>/l/{publicId}, /q/{publicId} and the GS1 Digital Links answer this link set too when asked for application/linkset+json (the Accept header) or with ?linkType=linkset (or all); otherwise they redirect to the public page (/developers/downloads/verify.md). Anonymous and tenant-less: a request carrying a session, token, cookie or X-Tenant gets exactly the anonymous answer. Each request takes a token from the /v1/public/* bucket and from the resolve bucket (bursts of 60, then 30 a minute). Bounded work: the resolver's indexed lookups, then at most five indexed statements; no document is read, decoded or signed. Cross-origin readable (Access-Control-Allow-Origin: *). Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.

Tham số

TênVị tríKiểuMô tả
code
bắt buộc
querystring

The decoded or typed text, sent once, 1 to 512 characters (surrounding whitespace is ignored). Missing, empty, repeated or longer is 400.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicLinkset
application/linkset+json

The link set of the public record the code names.

400Error
application/json

code is missing, empty, repeated or longer than 512 characters (Cache-Control: no-store; the code is never echoed), or the X-Request-Id header is malformed.

404Error
application/json

The code names no public record: an unknown, malformed or foreign code, a printed human code, a hidden lot or fruit, or a GS1 key without a serial. Every such code gets this same body and headers; the code is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many requests from this client address: the /v1/public/* bucket (bursts of 60, then 20 a second) or the resolve bucket (bursts of 60, then 30 a minute). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer. Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

Access-Control-Allow-Origin200string

*.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store on bad code.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/linkset+json
{
  "linkset": [
    {
      "anchor": "https://txng.theio.vn/l/d806aa6d966385ff9a4ff78d53714356",
      "dpp": [
        {
          "href": "https://txng.theio.vn/v1/public/lots/d806aa6d966385ff9a4ff78d53714356/credential",
          "title": "UNTP Digital Product Passport of the lot",
          "type": "application/vc+jwt"
        }
      ],
      "dfr": [
        {
          "href": "https://txng.theio.vn/v1/public/lots/d806aa6d966385ff9a4ff78d53714356/facility-record",
          "title": "UNTP Digital Facility Record of the packing facility",
          "type": "application/vc+jwt"
        }
      ],
      "https://gs1.org/voc/traceability": [
        {
          "href": "https://txng.theio.vn/v1/public/lots/d806aa6d966385ff9a4ff78d53714356/epcis.jsonld",
          "title": "EPCIS 2.0 events of the lot",
          "type": "application/ld+json"
        }
      ],
      "https://gs1.org/voc/pip": [
        {
          "href": "https://txng.theio.vn/vi/l/d806aa6d966385ff9a4ff78d53714356",
          "title": "Public lot record",
          "type": "text/html",
          "hreflang": [
            "vi"
          ]
        },
        {
          "href": "https://txng.theio.vn/en/l/d806aa6d966385ff9a4ff78d53714356",
          "title": "Public lot record",
          "type": "text/html",
          "hreflang": [
            "en"
          ]
        },
        {
          "href": "https://txng.theio.vn/zh/l/d806aa6d966385ff9a4ff78d53714356",
          "title": "Public lot record",
          "type": "text/html",
          "hreflang": [
            "zh"
          ]
        }
      ]
    }
  ]
}
Phản hồi 400 · application/json · code
{
  "error": "bad code",
  "code": "bad_code"
}
Phản hồi 400 · application/json · requestId
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 404 · application/json
{
  "error": "not found: codes",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}

Public lot record and verification summary

Không cần xác thực · getPublicLot

The public lot page (man2), anonymous and tenant-less: no session, bearer token, cookie, CSRF token or X-Tenant is needed, and a request carrying any of them gets exactly the anonymous answer. Built from an explicit allowlist (the frontend's publicLotSchema at waveX-c1-public-contract, mirrored as PublicLot): no tenant, internal id, operator, line, envelope, IP data, grower name, coordinate or polygon. A lot is public when its status is open or closed, its product is a crop of the crop registry (#156; durian until a platform admin adds another) and it has a variety and a harvest date (owner decision D2). Display strings are stored in one language and returned as stored for every lang; origin_country is localised (D5). The trust tier is derived at read time (trust.py, never stored); an open hold (a lot fruit bound to a quarantined envelope, a key revoked for compromise that signed one of the lot's accepted envelopes, or a failing lab result (P4, #40)) makes status on_hold with the capped tier; an open public report on one of its fruits (#46, POST /v1/public/reports) holds it too, and while it is the only hold open status is under_review, with the capped tier. verification.signed_event_count counts the lot's accepted envelopes whose signature re-verifies against the registered key (cached per lot until its accepted-envelope count changes; at most 128 envelopes are re-verified per request, so a larger lot reports the count verified so far until it completes); signatures is invalid when one fails. #329: an answer whose re-verification does not cover every accepted envelope yet says so in verification.signatures_complete (false; only with signatures_complete=1) and is Cache-Control: private, no-store, so a shared cache only ever keeps a complete count. Fields without a source yet are null (D1): cartons, packing date, export, downloads; issuer (the self-check box) is null until X3 publishes the lot's credential, also for a lot sealed by L10 (#35), whose credential is not public; lab is null until the lab's signed report exists (P4, #40: one row per analyte, the highest measured value over the samples, the market limit and the verdict; the journey's lab step and trust.tested_analytes with it). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second).

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

lang
không bắt buộc
query"vi" | "zh-Hans" | "en"

Page language; absent means vi. Anything else (unknown, empty, repeated) is 400.

crop_profile
không bắt buộc
query"0" | "1"

#156: 1 adds the lot's crop_name and ripeness_scale (the public pages ask for them); 0 or none leaves them out; any other value is refused (400 bad crop_profile).

trust_limits
không bắt buộc
query"0" | "1"

#280: 1 adds the record's trust.limited_by (the public pages ask for it); 0 or none leaves it out; any other value is refused (400 bad trust_limits).

map
không bắt buộc
query"0" | "1"

#293: 1 adds the record's commune map (growing_area.map, the public pages ask for it); 0 or none leaves it out; any other value is refused (400 bad map).

signatures_complete
không bắt buộc
query"0" | "1"

#329: 1 adds verification.signatures_complete, whether signed_event_count and signatures cover every accepted event of the lot yet (the public lot page asks for it); 0 or none leaves it out; any other value is refused (400 bad signatures_complete).

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicLot
application/json

The lot's public record.

400Error
application/json

lang is not one of vi, zh-Hans, en, or crop_profile is not 0 or 1, or map or signatures_complete is not 0 or 1 (Cache-Control: no-store), or the X-Request-Id header is malformed.

404Error
application/json

Not a public lot: an unknown or malformed id, a lot that is not open or closed, not of a crop of the crop registry (#156), or lacks a field the record needs. Every such id gets this same body and headers; the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). #329: private, no-store while the signature re-verification does not cover every accepted envelope yet (verification.signatures_complete false), so no shared cache keeps a count that is still growing. Never Set-Cookie.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store on bad lang, bad crop_profile, bad map and bad signatures_complete.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "status": "normal",
  "status_since": null,
  "status_reason": null,
  "public_id": "074eb09b371fc71c380da235aea9c14a",
  "code": "LO-260928-014",
  "crop": "durian",
  "crop_name": "Sầu riêng",
  "ripeness_scale": "levels_1_to_4",
  "variety": "Ri6",
  "origin_country": "Việt Nam",
  "fruit_count": 5,
  "net_mass_kg": 14.41,
  "carton_count": null,
  "packed_on": null,
  "harvested_on": "2026-09-27",
  "facility": {
    "code": "VN-TGPH-021",
    "name": "Tân Phú",
    "locality": "Cai Lậy, Tiền Giang"
  },
  "growing_area": {
    "code": "VN-TGOR-0387",
    "locality": "Ngũ Hiệp, Cai Lậy",
    "area_ha": 4.2,
    "tree_count": 610
  },
  "export": null,
  "trust": {
    "tier": "self_declared",
    "tested_analytes": []
  },
  "verification": {
    "signed_event_count": 13,
    "signatures": "valid",
    "timestamp": {
      "status": "missing"
    },
    "duplicate_scans": false,
    "seal": {
      "signature": "valid",
      "sealed_at": "2026-09-30T14:40:00+07:00",
      "manifest_sha256": "a869373f50f23727be3ef525863a48347c2c7d057119b62e02076adaa472d617"
    }
  },
  "journey": [
    {
      "kind": "harvest",
      "period": {
        "precision": "day",
        "start": "2026-09-27",
        "end": null
      },
      "tier": "cross_checked",
      "source": "registered_app",
      "harvest_mass_kg": 500,
      "satellite": {
        "source": "Sentinel-2",
        "image_date": "2026-09-25",
        "area_matches_registration": true,
        "deforestation_detected": false
      },
      "device_approval": {
        "approved": true,
        "approved_on": "2026-09-20"
      }
    },
    {
      "kind": "measurement",
      "period": {
        "precision": "minute",
        "start": "2026-09-28T08:54:00+07:00",
        "end": "2026-09-28T09:26:00+07:00"
      },
      "tier": "cross_checked",
      "source": "device",
      "device": {
        "model": "SF-100",
        "serial": "0417",
        "model_version": "sf100-m3"
      },
      "measured_count": 6,
      "rejected_count": 1,
      "device_approval": {
        "approved": true,
        "approved_on": "2026-09-20"
      }
    }
  ],
  "ripeness": {
    "exported_count": 5,
    "device_model": "SF-100",
    "counts": {
      "1": 0,
      "2": 2,
      "3": 3,
      "4": 0
    },
    "majority_level": 3,
    "eating_window": {
      "start": "2026-10-01",
      "end": "2026-10-02"
    },
    "storage_temperature_c": null,
    "mean_confidence": 0.91,
    "calibrated_on": "2026-09-15",
    "override_count": 1
  },
  "lab": null,
  "downloads": {
    "epcis_url": null,
    "credential_url": null,
    "customs_dossier_url": null
  },
  "issuer": null
}
Phản hồi 400 · application/json · lang
{
  "error": "bad lang",
  "code": "bad_lang"
}
Phản hồi 400 · application/json · cropProfile
{
  "error": "bad crop_profile",
  "code": "bad_crop_profile"
}
Phản hồi 400 · application/json · requestId
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 400 · application/json · map
{
  "error": "bad map",
  "code": "bad_map"
}
Phản hồi 400 · application/json · signaturesComplete
{
  "error": "bad signatures_complete",
  "code": "bad_signatures_complete"
}
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}/customs-dossier

Code file for China customs (JSON)

Không cần xác thực · getPublicLotCustomsDossier

X4 (#45): the lot's code file for China customs (its customs dossier) as canonical JSON (PublicCustomsDossier), a download named customs-dossier-<lot code>-<lang>.json. Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). The work is the public lot record's plus a projection of it.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

lang
không bắt buộc
query"vi" | "zh-Hans" | "en"

Page language; absent means vi. Anything else (unknown, empty, repeated) is 400.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicCustomsDossier
application/json

The dossier: its RFC 8785 (JCS) form, the same bytes for the same stored facts.

400Error
application/json

lang is not one of vi, zh-Hans, en (Cache-Control: no-store), or the X-Request-Id header is malformed.

404Error
application/json

No dossier: every id the public lot route answers 404 for, and a public lot that is not packed or is on no shipment to the CN market. Every such id gets this same body and headers (the public lot's not found: lots); the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

Content-Disposition200string

attachment; filename="customs-dossier-<lot code>-<lang>.json".

X-Content-Type-Options200string

nosniff.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store on bad lang.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "format": "agritrace-customs-dossier/1",
  "lang": "en",
  "status": "normal",
  "trust_tier": "self_declared",
  "public_id": "074eb09b371fc71c380da235aea9c14a",
  "origin_country": "Vietnam",
  "sealed": {
    "lot": {
      "code": "LOT-0001",
      "product": "durian",
      "variety": "Ri6",
      "harvested_on": "2026-09-27",
      "packed_on": "2026-09-28"
    },
    "cartons": {
      "count": 12,
      "fruit_count": 96,
      "net_mass_kg": 268.4
    },
    "growing_area": {
      "code": "AREA-0001",
      "commune": "Commune",
      "district": "District"
    },
    "packing_house": {
      "code": "PH-01",
      "name": "Packing house",
      "district": "District",
      "province": "Province"
    },
    "durian_protocol": false
  },
  "seal": {
    "algorithm": "sha-256",
    "value": "b9b4c466fc0bedf26722ae773931d48cfb0807a8b1c5d7224c81bf32cfda024e",
    "basis": "transition"
  },
  "registry_entry": {
    "tier": "self_declared",
    "source": "manual"
  },
  "lab_report": {
    "report_number": "KN-0001",
    "signed_at": "2026-09-29T15:40:00+07:00",
    "key_custody": "lab",
    "market_approval": {
      "market": {
        "country_code": "CN",
        "short_name": "China",
        "authority": "China Customs"
      },
      "approved": true,
      "reference": "BVTV 50-2026 No. 17"
    },
    "results": [
      {
        "analyte": "cadmium",
        "outcome": "measured",
        "value": 0.018,
        "unit": "mg/kg",
        "limit": {
          "kind": "max",
          "value": 0.05
        },
        "pass": true
      },
      {
        "analyte": "auramine_o",
        "outcome": "not_detected",
        "limit": {
          "kind": "banned"
        },
        "pass": true
      }
    ]
  },
  "shipment": {
    "market": {
      "country_code": "CN",
      "short_name": "China",
      "authority": "China Customs"
    },
    "border_gate": "Border gate",
    "exported_on": null
  },
  "protocol": null,
  "producer": {
    "legal_name": "Hợp tác xã Sầu riêng Ea Kly",
    "address": "Thôn 2, xã Ea Kly",
    "district": "Krông Pắc",
    "province": "Đắk Lắk",
    "country": "VN"
  },
  "digest": {
    "algorithm": "sha-256",
    "value": "889a1a4c2fe3d8a61826fe159b4f6e986219672d9c56952811fd6118e3cac6f5"
  }
}
Phản hồi 400 · application/json · lang
{
  "error": "bad lang",
  "code": "bad_lang"
}
Phản hồi 400 · application/json · requestId
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}/customs-dossier/print

Code file for China customs (HTML print view)

Không cần xác thực · getPublicLotCustomsDossierPrint

X4 (#45): the same code file (dossier) as a static HTML page in lang to print or save, with a link to the JSON download. It runs no script and loads nothing (Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; ...); every value is HTML-escaped. The lot page's downloads.customs_dossier_url links here. Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). The work is the public lot record's plus a projection of it.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

lang
không bắt buộc
query"vi" | "zh-Hans" | "en"

Page language; absent means vi. Anything else (unknown, empty, repeated) is 400.

Phản hồi

Mã trạng tháiKiểuMô tả
200string
text/html

The print view.

400Error
application/json

lang is not one of vi, zh-Hans, en (Cache-Control: no-store), or the X-Request-Id header is malformed.

404Error
application/json

No dossier: every id the public lot route answers 404 for, and a public lot that is not packed or is on no shipment to the CN market. Every such id gets this same body and headers (the public lot's not found: lots); the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

Content-Security-Policy200string

default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'.

Referrer-Policy200string

no-referrer.

X-Content-Type-Options200string

nosniff.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store on bad lang.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · text/html
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Code file for China Customs</title></head><body><main><h1>Code file for China Customs</h1>…</main></body></html>
Phản hồi 400 · application/json · lang
{
  "error": "bad lang",
  "code": "bad_lang"
}
Phản hồi 400 · application/json · requestId
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /{slug}/did.json

A facility's did:web DID document

Không cần xác thực · getDidDocument

The did:web resolution URL of did:web:<AGRITRACE_DID_DOMAIN>:<slug> (#34): served at the root of the issuer host, so the edge proxy routes /<slug>/did.json to the backend. Anonymous and tenant-less (credentials change nothing), rate limited with the /v1/public/* bucket. Lists the facility's active and retired keys (a rotation keeps old credentials verifiable), never a revoked one. Not audited (a read).

Tham số

TênVị tríKiểuMô tả
slug
bắt buộc
pathstring

The facility's slug.

Phản hồi

Mã trạng tháiKiểuMô tả
200DidDocument
application/did+json

The DID document.

404Error
application/json

No facility has this slug, or it lists no key (none generated, or every key revoked). Every such slug gets this same body.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

429Error
application/json

Too many /v1/public/* and did.json requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate): a rotation or revocation is seen within a minute (at most six, the first request after a quiet period).

Access-Control-Allow-Origin200string

*: browser-based resolvers may read the document.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale): a rotation or revocation is seen within a minute.

Access-Control-Allow-Origin404string

*: browser-based resolvers may read the document.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/did+json
{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/suites/jws-2020/v1"
  ],
  "id": "did:web:txng.theio.vn:tanphu",
  "verificationMethod": [
    {
      "id": "did:web:txng.theio.vn:tanphu#key-1",
      "type": "JsonWebKey2020",
      "controller": "did:web:txng.theio.vn:tanphu",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
        "y": "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0"
      }
    }
  ],
  "assertionMethod": [
    "did:web:txng.theio.vn:tanphu#key-1"
  ]
}
Phản hồi 404 · application/json
{
  "error": "not found: did document",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /labs/{code}/did.json

A lab's did:web DID document

Không cần xác thực · getLabDidDocument

#142: the did:web resolution URL of did:web:<AGRITRACE_DID_DOMAIN>:labs:<code>, a lab's DID: served at the root of the issuer host, so the edge proxy routes /labs/<code>/did.json to the backend. Anonymous and tenant-less (credentials change nothing), rate limited with the /v1/public/* bucket. Lists the lab's keys as JsonWebKey2020 verification methods <did>#<kid>, each also an assertion method: the active ones and those revoked for a rotation (what they signed stays verifiable), never one revoked for compromise, at most 100, the newest. The lab's conformity credentials (GET /v1/public/lots/{publicId}/lab-credential) verify with the key their kid names. Not audited (a read). Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.

Tham số

TênVị tríKiểuMô tả
code
bắt buộc
pathstring

The lab's code (LAB-<country>-<id>). Any other value is 404 like an unknown code.

Phản hồi

Mã trạng tháiKiểuMô tả
200DidDocument
application/did+json

The DID document.

404Error
application/json

No lab has this code, or it lists no key (none registered, or every key revoked for compromise). Every such code gets this same body, the facility document's.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

429Error
application/json

Too many /v1/public/* and did.json requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate): a rotation or revocation is seen within a minute (at most six, the first request after a quiet period).

Access-Control-Allow-Origin200string

*: browser-based resolvers may read the document.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale): a rotation or revocation is seen within a minute.

Access-Control-Allow-Origin404string

*: browser-based resolvers may read the document.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/did+json
{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/suites/jws-2020/v1"
  ],
  "id": "did:web:txng.theio.vn:labs:LAB-VN-118",
  "verificationMethod": [
    {
      "id": "did:web:txng.theio.vn:labs:LAB-VN-118#LAB-VN-118.k1",
      "type": "JsonWebKey2020",
      "controller": "did:web:txng.theio.vn:labs:LAB-VN-118",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "1OihyfaVy4QEeRRKoAtNhYPW8jD1Z-qTeH4bQcQMupk",
        "y": "XgO6W85O0u11FOOKfyoihvZGt3V95MVuNe5_oJ0IUqU"
      }
    },
    {
      "id": "did:web:txng.theio.vn:labs:LAB-VN-118#LAB-VN-118.portal",
      "type": "JsonWebKey2020",
      "controller": "did:web:txng.theio.vn:labs:LAB-VN-118",
      "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "VtKPC0MKX0r3i6575aZXWDmtaO5A1MkbEt6pZbNzyCM",
        "y": "2B7hEkDmeriEqAMs1nhNd6FfnwwnLa-y0j1yItMaQQA"
      }
    }
  ],
  "assertionMethod": [
    "did:web:txng.theio.vn:labs:LAB-VN-118#LAB-VN-118.k1",
    "did:web:txng.theio.vn:labs:LAB-VN-118#LAB-VN-118.portal"
  ]
}
Phản hồi 404 · application/json
{
  "error": "not found: did document",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/fruits/{publicId}/credential

Public UNTP credential of a fruit

Không cần xác thực · getPublicFruitCredential

X3 (#44): the fruit's UNTP Digital Product Passport (granularity item), issued with its lot's credential when the lot was sealed, in the same form (compact JWS, ES256, typ vc+jwt): UNTP 0.7.0 for a lot sealed since #162 (the product identified by https://<domain>/q/<publicId>), UNTP 0.6.1 for a lot sealed before, served as stored. Offered under exactly the public fruit record's visibility. A download named untp-dpp-<fruit public id>.jwt. Withdrawn (404) once the key is revoked. Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work: the visibility lookups of the public record, then one statement that returns the text stored when the lot was sealed; nothing is decoded, verified or signed per request. Cross-origin readable (Access-Control-Allow-Origin: *), like the DID document, so a verifier's page can fetch it.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The fruit's public id (128 random bits as hex). Any other value is 404 like an unknown id.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicCredential
application/vc+jwt

The stored compact JWS.

404Error
application/json

No credential: every id the public fruit route answers 404 for, a public fruit whose lot was not sealed with public documents or that was not published at the seal, and one whose issuer key was revoked. Every such id gets this same body and headers; the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

Content-Disposition200string

attachment; filename="untp-dpp-<fruit public id>.jwt".

X-Content-Type-Options200string

nosniff.

Access-Control-Allow-Origin200string

*.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200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ZTQyNGYwYmI1NWRmNGZjNzE4NzY2NTc4ZjRmIiwiaXNzdWVyIjp7ImlkIjoiZGlkOndlYjp0eG5nLnRoZWlvLnZuOnZuLXRncGgtMDIxIiwibmFtZSI6IlTDom4gUGjDuiIsInR5cGUiOlsiQ3JlZGVudGlhbElzc3VlciJdfSwibmFtZSI6IkRpZ2l0YWwgUHJvZHVjdCBQYXNzcG9ydCBvZiBmcnVpdCBRLTAwMS0wMDAxIiwidHlwZSI6WyJEaWdpdGFsUHJvZHVjdFBhc3Nwb3J0IiwiVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwidmFsaWRGcm9tIjoiMjAyNi0wOS0yOVQwODo0MTowMFoifQ.-8U2QZqem3_mIhPsp3C47MXAJCTPp-blmIzX7_Fxsoh1SC5JTeq1-fxdGbuIFK_rA2VlDOo2RYSezKOfjCHmEQ
Phản hồi 404 · application/json
{
  "error": "not found: fruits",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}/epcis.jsonld

Public EPCIS 2.0 document of a sealed lot

Không cần xác thực · getPublicLotEpcis

X3 (#44): the lot's EPCIS 2.0 JSON-LD document (GS1), issued once when the lot was sealed (L10, #35) and never changed: its accepted events, oldest first, minimised for the public (no operator, producer, parcel, attachment, coordinates, device signature or device id; the read point is the facility or the growing area). The lot's UNTP credential cites these exact bytes by SHA-256. A download named epcis-<lot code>.jsonld. Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work and size: a document is at most 16 MiB (a lot whose document would be larger gets no public documents); after the visibility lookups of the public record, one statement reads the document's SHA-256 and size; an If-None-Match naming its ETag (the SHA-256) answers 304 without reading the text; otherwise the client's download bucket takes one token per started KiB (bursts of 32 MiB, then 64 KiB a second), then one statement returns the text stored when the lot was sealed; nothing is decoded, verified or signed per request. Cross-origin readable (Access-Control-Allow-Origin: *), like the DID document, so a verifier's page can fetch it.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

If-None-Match
không bắt buộc
headerstring

An ETag of the document (its ETag: the SHA-256 of its bytes, quoted), a list of them or *; compared weakly (RFC 9110). When it names the document's tag the answer is 304.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicEpcisDocument
application/ld+json

The stored document, byte for byte (canonical JSON: sorted keys, compact).

304

Not modified: the request's If-None-Match names the document's ETag. No body; the text is not read and the download bucket is not charged.

404Error
application/json

No document: every id the public lot route answers 404 for, and a public lot that was not sealed with public documents. Every such id gets this same body and headers; the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds. Also when this client's EPCIS download bucket (one token per started KiB of the document: bursts of 32 MiB, then 64 KiB a second) does not hold the document's size; that bucket is taken after the visibility lookups and before the text is read, and a 304 never takes from it.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate), with the strong ETag (its SHA-256). Never Set-Cookie.

ETag200string

The SHA-256 hex of the document's bytes, quoted (a strong ETag); the lot credential cites the same digest.

Content-Disposition200string

attachment; filename="epcis-<lot code>.jsonld".

X-Content-Type-Options200string

nosniff.

Access-Control-Allow-Origin200string

*.

X-Request-Id304string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control304string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate), with the strong ETag.

ETag304string

The document's ETag, as on the 200.

Access-Control-Allow-Origin304string

*.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/ld+json
{
  "@context": [
    "https://ref.gs1.org/standards/epcis/2.0.0/epcis-context.jsonld",
    {
      "agri": "https://agritrace.vn/epcis/"
    }
  ],
  "type": "EPCISDocument",
  "schemaVersion": "2.0",
  "creationDate": "2026-09-30T07:40:00Z",
  "epcisBody": {
    "eventList": [
      {
        "type": "ObjectEvent",
        "eventID": "urn:uuid:0b1f7c9e-2a51-4c8e-9d7a-3f0e8c6b1a42",
        "eventTime": "2026-09-28T08:56:00.000+07:00",
        "eventTimeZoneOffset": "+07:00",
        "action": "OBSERVE",
        "bizStep": "inspecting",
        "epcList": [],
        "quantityList": [
          {
            "epcClass": "urn:agritrace:lot:LO-260928-014"
          }
        ],
        "readPoint": {
          "id": "urn:agritrace:loc:VN-TGPH-021"
        },
        "bizLocation": {
          "id": "urn:agritrace:loc:VN-TGPH-021"
        },
        "sensorElementList": [
          {
            "sensorMetadata": {
              "time": "2026-09-28T08:56:00.000+07:00",
              "deviceMetadata": "agri:profile/vn.agritrace.durian-knocker@1.0.0"
            },
            "sensorReport": [
              {
                "type": "https://agritrace.vn/voc/RipenessLevel",
                "value": 3,
                "uom": "C62"
              }
            ]
          }
        ],
        "agri:fruit": "Q-014-0001",
        "agri:seq": 12
      }
    ]
  }
}
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}/credential

Public UNTP credential of a sealed lot

Không cần xác thực · getPublicLotCredential

X3 (#44): the lot's UNTP Digital Product Passport as a VC 2.0 credential secured with VC-JOSE (W3C Recommendation 2025-05-15): a compact JWS (ES256, typ vc+jwt, kid the issuer key's DID URL), issued and verified once when the lot was sealed, with the facility's issuer key named by the public lot record's issuer. #162: a lot sealed since the upgrade gets a UNTP 0.7.0 passport (@context https://vocabulary.uncefact.org/untp/0.7.0/context/; its subject is the product, identified by the URL of its public record https://<domain>/l/<publicId>, whose link set GET /v1/public/linkset answers); a lot sealed before keeps the UNTP 0.6.1 passport it was sealed with, byte for byte. It verifies with that key in the facility's /{slug}/did.json (/developers/downloads/verify.md). A download named untp-dpp-<lot code>.jwt. Its lab conformity claims are made only from a report the public lab step accepts (ADR 0001: its key not revoked for compromise, from the lab the sampling assigned). Withdrawn (404) once that key is revoked for compromise, or once the lab key its claims cite is. Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work: the visibility lookups of the public record, then one statement that returns the text stored when the lot was sealed; nothing is decoded, verified or signed per request. Cross-origin readable (Access-Control-Allow-Origin: *), like the DID document, so a verifier's page can fetch it.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicCredential
application/vc+jwt

The stored compact JWS.

404Error
application/json

No credential: every id the public lot route answers 404 for, a public lot that was not sealed with public documents, and a lot whose issuer key was revoked. Every such id gets this same body and headers; the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

Content-Disposition200string

attachment; filename="untp-dpp-<lot code>.jwt".

X-Content-Type-Options200string

nosniff.

Access-Control-Allow-Origin200string

*.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/vc+jwt
eyJhbGciOiJFUzI1NiIsImN0eSI6InZjIiwia2lkIjoiZGlkOndlYjp0eG5nLnRoZWlvLnZuOnZuLXRncGgtMDIxI2tleS0xIiwidHlwIjoidmMrand0In0.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL3ZvY2FidWxhcnkudW5jZWZhY3Qub3JnL3VudHAvMC43LjAvY29udGV4dC8iXSwiY3JlZGVudGlhbFN1YmplY3QiOnsiYmF0Y2hOdW1iZXIiOiJMTy0yNjA5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JhcHBsaWNhdGlvbi92Yytqd3QifV0sInR5cGUiOlsiUHJvZHVjdCJdfSwiaWQiOiJ1cm46YWdyaXRyYWNlOmxvdC1wYXNzcG9ydDpkODA2YWE2ZDk2NjM4NWZmOWE0ZmY3OGQ1MzcxNDM1NiIsImlzc3VlciI6eyJpZCI6ImRpZDp3ZWI6dHhuZy50aGVpby52bjp2bi10Z3BoLTAyMSIsIm5hbWUiOiJUw6JuIFBow7oiLCJ0eXBlIjpbIkNyZWRlbnRpYWxJc3N1ZXIiXX0sIm5hbWUiOiJEaWdpdGFsIFByb2R1Y3QgUGFzc3BvcnQgb2YgbG90IExPLTI2MDkyOC0wMTQiLCJ0eXBlIjpbIkRpZ2l0YWxQcm9kdWN0UGFzc3BvcnQiLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJ2YWxpZEZyb20iOiIyMDI2LTA5LTI5VDA4OjQxOjAwWiJ9.9Ppq2Pp20eq-AisObnDtdfuLBCyVn5R3gHyk39Om5bAQTrioPz1xN1s2DrbTB_jH-xHR2vSa0UPf-IT7Umpohw
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}/lab-credential

Public UNTP conformity credential of a sealed lot's lab

Không cần xác thực · getPublicLotLabCredential

#142: the UNTP Digital Conformity Credential (UNTP DCC 0.6.1) of the lab whose report the lot's credential claims from, as a VC 2.0 credential secured with VC-JOSE (W3C Recommendation 2025-05-15): a compact JWS (ES256, typ vc+jwt), issued in the lab's name (issuer.id did:web:<domain>:labs:<lab code>) and verified once when the lot was sealed. It is issued only for a report the lab entered in its CropPath portal, signed with that report's own key, the key CropPath holds for the lab's portal users (kid <lab did>#<kid>), so its custody is the report's key_custody server; a report the lab signed with its own key gets none. It verifies with that key in the lab's /labs/{code}/did.json (/developers/downloads/verify.md). The lot's credential links it from each lab claim: as evidence with its digestMultibase in a UNTP 0.7.0 passport (#162), as conformityEvidence with its SHA-256 in a 0.6.1 one. A download named untp-dcc-<lot code>.jwt. Withdrawn (404) once the lab key that signed it is revoked for compromise (the lot's credential is then withdrawn too); the facility's issuer key does not sign it, so that key's revocation leaves it. Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work: the visibility lookups of the public record, then one statement that returns the text stored when the lot was sealed; nothing is decoded, verified or signed per request. Cross-origin readable (Access-Control-Allow-Origin: *), like the DID document, so a verifier's page can fetch it. Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicConformityCredential
application/vc+jwt

The stored compact JWS.

404Error
application/json

No lab credential: every id the public lot route answers 404 for, a public lot that was not sealed with one (no lab report claimed at the seal, or one the lab signed with its own key), and a lot whose lab key that signed it was revoked for compromise. Every such id gets this same body and headers; the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

Content-Disposition200string

attachment; filename="untp-dcc-<lot code>.jwt".

X-Content-Type-Options200string

nosniff.

Access-Control-Allow-Origin200string

*.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/vc+jwt
eyJhbGciOiJFUzI1NiIsImN0eSI6InZjIiwia2lkIjoiZGlkOndlYjp0eG5nLnRoZWlvLnZuOmxhYnM6TEFCLVZOLTExOCNMQUItVk4tMTE4LnBvcnRhbCIsInR5cCI6InZjK2p3dCJ9.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL3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kIjoiZGlkOndlYjp0eG5nLnRoZWlvLnZuOmxhYnM6TEFCLVZOLTExOCIsIm5hbWUiOiJMQUItVk4tMTE4IiwidHlwZSI6WyJDcmVkZW50aWFsSXNzdWVyIl19LCJ0eXBlIjpbIkRpZ2l0YWxDb25mb3JtaXR5Q3JlZGVudGlhbCIsIlZlcmlmaWFibGVDcmVkZW50aWFsIl0sInZhbGlkRnJvbSI6IjIwMjYtMDktMjlUMDg6NDE6MDBaIn0.nJawXQrDNUmxDrpWOIsW2MoW85f_o3lBpAW3pGkZ8NE2RtojH7zA7fVgGm2PHX7suUyWECRJvqmvfw32vjwaKg
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}/facility-record

Public UNTP facility record of a sealed lot's packing facility

Không cần xác thực · getPublicLotFacilityRecord

#162: the packing facility's UNTP Digital Facility Record (UNTP 0.7.0) issued when the lot was sealed, as a VC 2.0 credential secured with VC-JOSE (W3C Recommendation 2025-05-15): a compact JWS (ES256, typ vc+jwt) signed with the same facility issuer key as the lot's passport, which links it as a related document (link type https://test.uncefact.org/vocabulary/linkTypes/dfr) with the digestMultibase of the text served here. It describes the facility as it was at the seal: its name, its code (urn:agritrace:loc:<code>, the passport's producedAtFacility), its locality (no street address, postal code or coordinates), its GLN when it has one, each packing house registration code the published code lists match for a destination market on a list that is not stale (with the list's import date and the SHA-256 of the authority's file), and its process category (ISIC Rev. 4 0163, post-harvest crop activities). It verifies with that key in the facility's /{slug}/did.json (/developers/downloads/verify.md). A download named untp-dfr-<lot code>.jwt. Withdrawn (404) once that key is revoked for compromise, with the lot's passport. A lot sealed before #162 has none. Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work: the visibility lookups of the public record, then one statement that returns the text stored when the lot was sealed; nothing is decoded, verified or signed per request. Cross-origin readable (Access-Control-Allow-Origin: *), like the DID document, so a verifier's page can fetch it. Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicCredential
application/vc+jwt

The stored compact JWS.

404Error
application/json

No facility record: every id the public lot route answers 404 for, a public lot that was not sealed (or sealed before #162, or without public documents), and a lot whose issuer key was revoked for compromise. Every such id gets this same body and headers; the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

Content-Disposition200string

attachment; filename="untp-dfr-<lot code>.jwt".

X-Content-Type-Options200string

nosniff.

Access-Control-Allow-Origin200string

*.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/vc+jwt
eyJhbGciOiJFUzI1NiIsImN0eSI6InZjIiwia2lkIjoiZGlkOndlYjp0eG5nLnRoZWlvLnZuOnZuLXRncGgtMDIxI2tleS0xIiwidHlwIjoidmMrand0In0.eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvbnMvY3JlZGVudGlhbHMvdjIiLCJodHRwczovL3ZvY2FidWxhcnkudW5jZWZhY3Qub3JnL3VudHAvMC43LjAvY29udGV4dC8iXSwiY3JlZGVudGlhbFN1YmplY3QiOnsiYWRkcmVzcyI6eyJhZGRyZXNzQ291bnRyeSI6eyJjb3VudHJ5Q29kZSI6IlZOIiwiY291bnRyeU5hbWUiOiJWaWV0IE5hbSJ9LCJhZGRyZXNzTG9jYWxpdHkiOiJDYWkgTOG6rXkiLCJhZGRyZXNzUmVnaW9uIjoiVGnhu4FuIEdpYW5nIiwicG9zdGFsQ29kZSI6IiIsInN0cmVldEFkZHJlc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zdWVyIl19LCJuYW1lIjoiRGlnaXRhbCBGYWNpbGl0eSBSZWNvcmQgb2YgVMOibiBQaMO6IiwidHlwZSI6WyJEaWdpdGFsRmFjaWxpdHlSZWNvcmQiLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCJdLCJ2YWxpZEZyb20iOiIyMDI2LTA5LTI5VDA4OjQxOjAwWiJ9.sBe6_TaAybwTWdtpSCSMvdVbbGWR7SpzLe8_fOc6w6IoH0VWXkzkVN06GKF_-3UiEn3yBu2-aAgnKuBZV7cm4w
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/reports/challenge

A proof-of-work challenge for a public mismatch report

Không cần xác thực · getReportChallenge

Anonymous and tenant-less (#46, MO decision (a): no third-party challenge). The backend keeps nothing per challenge; it is signed and expires after expires_in seconds. Not audited (a read). Rate limited per client by the /v1/public/* bucket.

Phản hồi

Mã trạng tháiKiểuMô tả
200ReportChallenge
application/json

A new challenge.

400Error
application/json

The X-Request-Id header is present and malformed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

429Error
application/json

Too many requests from this client address: the /v1/public/* bucket (bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer. Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "challenge": "9f1c2e7a5b3d4c6e8f0a1b2c3d4e5f60.18.1790000300.3b0f6a1c9d2e4f5a6b7c8d9e0f1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c",
  "difficulty": 18,
  "expires_in": 300
}
Phản hồi 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/public/reports

Report a fruit that does not match its public record

Không cần xác thực · fileReport

Anonymous and tenant-less (#46): a request carrying a session, token, cookie or X-Tenant is treated exactly like an anonymous one. In order: the /v1/public/* bucket, the report bucket (5 reports an hour per client, before the body is read), the body (ReportSubmission), the proof of work (a ReportChallenge this backend issued, at its current difficulty, not expired, solved), the reported fruit's bucket (20 reports an hour per public id, whoever sends them), then the fruit, looked up exactly as the public fruit record does: any id that is not a public fruit's answers that record's 404. The report is stored with its challenge, which then cannot file another. An open report holds the fruit's lot (ADR 0001): its displayed tier is capped at Self-declared and the lot and fruit records read under_review (or on_hold when another hold is open too) from the earliest open report, one hold however many reports are open, until staff resolve the last of them; resolution restores at most the sealed tier. The public records are cached up to 60 s, so the hold shows within that. Not audited (AUDIT_EXEMPT: the reports row is the record, and an anonymous route must not append to the audit log). Every answer is no-store. SELF-2-4 (#193): a report on a fruit of a company that is leaving CropPath or has left is refused 403 company_read_only (nothing is stored, the challenge stays unused): the company is read-only, so nobody could triage it, and its hold would cap the lot's displayed tier for good.

Nội dung yêu cầu

ReportSubmission (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "publicId": "73879f17d0930440809333f141385eb6",
  "category": "label_peeled",
  "note": "Tem bị bóc ở cuống.",
  "contact": "zalo 0901 234 567",
  "challenge": "9f1c2e7a5b3d4c6e8f0a1b2c3d4e5f60.18.1790000300.3b0f6a1c9d2e4f5a6b7c8d9e0f1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c",
  "solution": "184022"
}

Phản hồi

Mã trạng tháiKiểuMô tả
201ReportReceipt
application/json

The report was received.

400Error
application/json

Invalid JSON, a field that does not fit ReportSubmission (the first one is named; an unknown field is refused), a challenge that does not verify (another backend's or forged, at another difficulty, expired or unsolved: ask for a new one), or a bad X-Request-Id.

403Error
application/json

The fruit's company is leaving CropPath or has left (company_read_only): the report is refused and nothing is stored.

404Error
application/json

Not a public fruit: the public fruit record's own 404 (an unknown or malformed id, a lot's id, a fruit the record does not show). The id is never echoed; nothing is stored.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

409Error
application/json

The challenge already filed a report: ask for a new one.

413Error
application/json

The request body is over 1 MiB.

429Error
application/json

Too many requests from this client address: the /v1/public/* bucket (bursts of 60, then 20 a second), the report bucket (5 reports an hour per client) or the reported fruit's bucket (20 reports an hour per public id). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer. Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id201string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control201string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control403string

no-store.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

no-store.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id409string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control409string

no-store.

X-Request-Id413string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 201 · application/json
{
  "status": "received",
  "fruit": {
    "status": "under_review",
    "status_since": "2026-10-10T09:30:00+07:00",
    "status_reason": null,
    "tier": "self_declared"
  },
  "lot": {
    "status": "under_review",
    "status_since": "2026-10-10T09:30:00+07:00",
    "status_reason": null,
    "tier": "self_declared"
  }
}
Phản hồi 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
Phản hồi 400 · application/json · category
{
  "error": "invalid category",
  "code": "invalid_category"
}
Phản hồi 400 · application/json · note
{
  "error": "invalid note",
  "code": "invalid_note"
}
Phản hồi 400 · application/json · unknown
{
  "error": "unknown fields: photo_sha",
  "code": "unknown_fields"
}
Phản hồi 400 · application/json · challenge
{
  "error": "invalid challenge",
  "code": "invalid_challenge"
}
Phản hồi 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 403 · application/json
{
  "error": "company read-only: the company is leaving or has left CropPath; its records can be read and exported but not changed",
  "code": "company_read_only"
}
Phản hồi 404 · application/json
{
  "error": "not found: fruits",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 409 · application/json
{
  "error": "challenge already used",
  "code": "challenge_already_used"
}
Phản hồi 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/public/email/unsubscribe

Turn notification emails off with an email's link

Không cần xác thực · unsubscribeEmail

#270. Every notification, alert and recall email carries the person's unsubscribe link, /login#unsubscribe=<token>; the page posts the token here. It turns that person's notification, alert and recall emails off (invitation and password emails are always sent) and does nothing else. The token is <account id>.<company>.<signature>, signed by the server for this purpose only; it needs no sign-in and does not expire. An invalid token is a 400 (nothing is looked up for it); a valid one answers 200 whether or not anything changed. Audited by the service itself (email.unsubscribe, in the company of the email) when the setting changed; a request that changes nothing writes no row. Anonymous. Rate limited per client before anything else (/v1/public/*, and the login bucket). Not in SDK 0.2.0 (x-not-in-sdk): its bytes never change; a later SDK version adds it.

Nội dung yêu cầu

EmailUnsubscribe (bắt buộc)

Kiểu nội dung: application/json

Ví dụ yêu cầu · application/json
{
  "token": "12.coop-dl.4yGq3o0b1d0e7n2m8J5k9v6c3x1z0a2s4d6f8h0j2l4"
}

Phản hồi

Mã trạng tháiKiểuMô tả
200EmailUnsubscribed
application/json

The person's notification emails are off.

400Error
application/json

Invalid JSON, a body that is not exactly {token}, a token that is not valid, or a bad X-Request-Id.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

413Error
application/json

The request body is over 1 MiB.

429Error
application/json

Too many requests from this client address: the /v1/public/* bucket (bursts of 60, then 20 a second) or the login bucket (bursts of 20, then one every 6 seconds), shared with sign-in. The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer. Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id413string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "notifications": false
}
Phản hồi 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
Phản hồi 400 · application/json · token
{
  "error": "token is required",
  "code": "token_is_required"
}
Phản hồi 400 · application/json · invalid
{
  "error": "invalid link",
  "code": "invalid_link"
}
Phản hồi 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/fruits/{publicId}/recordings/{sha256}

Original tap recording of a public fruit

Không cần xác thực · getPublicFruitRecording

U5 (#58): the original recording of a public fruit's knock, as stored: the WAV its knock envelope references by SHA-256 and its knocker uploaded, from which the fruit record's waveform is drawn. Served under exactly the public fruit record's visibility and only at the URL naming the blob's SHA-256 (the list's recording_url), so the bytes at a URL never change and a fruit measured again gets a new URL. Served only when the stored bytes still hash to it and form a plain RIFF/WAVE file (fmt, fact and data chunks only; a recording with any other chunk, such as LIST/INFO metadata, is never public). Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work and size: the fruit record's two visibility lookups and one statement for the recording's hash and size; an If-None-Match naming its ETag answers 304 without reading the blob; otherwise the client's download bucket (shared with the EPCIS download) takes one token per started KiB served (bursts of 32 MiB, then 64 KiB a second), then the blob (at most 1 MiB) is read. Byte ranges (RFC 9110, 14): Safari and iOS play an audio source only from a server that answers a byte range with 206, so ONE range of bytes (a-b, a- or the suffix -n) answers 206 with exactly those bytes and is charged only for them; a range that selects no byte is 416 and charges nothing; several ranges, another unit, a malformed value, or a Range whose If-Range is not the recording's ETag (compared strongly; a date never matches) get the whole recording (200).

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The fruit's public id. Any id that is not a public fruit's is 404 like an unknown id.

sha256
bắt buộc
pathstring

The recording's SHA-256 (64 lowercase hex), as the list's recording_url names it. Any other value is 404.

If-None-Match
không bắt buộc
headerstring

An ETag of the recording (its SHA-256, quoted), a list of them or *; compared weakly (RFC 9110). When it names the recording's tag the answer is 304.

Range
không bắt buộc
headerstring

One byte range of the recording: bytes=<first>-<last>, bytes=<first>- or bytes=-<suffix length> (positions count from 0; a last position past the end is the end). Several ranges, another unit or a malformed value are ignored (200 with the whole recording).

If-Range
không bắt buộc
headerstring

The recording's ETag: the Range is honoured only when this is absent or names that ETag exactly (strong comparison); anything else, including a date, gets the whole recording.

Phản hồi

Mã trạng tháiKiểuMô tả
200string
audio/wav

The stored recording, byte for byte.

206string
audio/wav

Partial content: the one byte range the Range header asks for, exactly those bytes of the stored recording (Content-Length is their count). Charged one download token per started KiB served.

304

Not modified: the request's If-None-Match names the recording's ETag. No body; the blob is not read and the download bucket is not charged.

404Error
application/json

No public recording: every id the public fruit route answers 404 for, a hash that is not the fruit's stored recording, and a recording whose stored bytes are missing, corrupt or not a plain WAV. Every such URL gets this same body and headers; nothing is echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

416Error
application/json

Range not satisfiable: one well-formed byte range that selects no byte of the recording (its first position is at or past the end, or a zero-length suffix). Nothing is read and the download bucket is not charged.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds. Also when this client's download bucket (shared with the EPCIS download; one token per started KiB served, the whole recording or the one byte range a 206 answers: bursts of 32 MiB, then 64 KiB a second) does not hold the bytes to serve; that bucket is taken after the visibility lookups and before the blob is read, and a 304 never takes from it.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=31536000, immutable: the URL names the bytes' hash. Never Set-Cookie.

ETag200string

The recording's SHA-256 hex, quoted (a strong ETag).

Accept-Ranges200string

bytes: one byte range of the recording may be requested.

Content-Disposition200string

inline; filename="recording-<first 16 hex digits of the hash>.wav".

X-Content-Type-Options200string

nosniff.

Content-Security-Policy200string

default-src 'none'; sandbox.

X-Request-Id206string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control206string

public, max-age=31536000, immutable: the URL names the bytes' hash. Never Set-Cookie.

ETag206string

The recording's SHA-256 hex, quoted (a strong ETag).

Accept-Ranges206string

bytes: one byte range of the recording may be requested.

Content-Range206string

bytes <first>-<last>/<size>: the positions served (inclusive) and the recording's size in bytes.

Content-Disposition206string

inline; filename="recording-<first 16 hex digits of the hash>.wav".

X-Content-Type-Options206string

nosniff.

Content-Security-Policy206string

default-src 'none'; sandbox.

X-Request-Id304string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control304string

public, max-age=31536000, immutable.

ETag304string

The recording's ETag, as on the 200.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id416string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Content-Range416string

bytes */<size>: the recording's size in bytes.

Cache-Control416string

no-store: a refusal is never cached.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · audio/wav
RIFF....WAVEfmt  ... (binary PCM WAV bytes)
Phản hồi 206 · audio/wav
RI
Phản hồi 404 · application/json
{
  "error": "not found: fruits",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 416 · application/json
{
  "error": "range not satisfiable",
  "code": "range_not_satisfiable"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/maps/{style}/{tileset}/{communes}/{osm_id}.svg

Public commune map image of a record's growing area

Không cần xác thực · getPublicCommuneMap

#293: the image a public lot or fruit record's map.url names (PublicCommuneMap): an SVG of 448 x 252 pixels showing one commune's OpenStreetMap boundary on raster map tiles CropPath renders itself from an OpenStreetMap extract (zooms 5 to 13). Nothing is fetched from another site, neither by the server nor by the browser: the tiles are embedded in the image as data: PNG images. The image holds only rectangles, embedded images, the outline path and the attribution text "© OpenMapTiles © OpenStreetMap contributors": no script, no external reference. Its first path part names the drawing's version (the current style version: s followed by a number, for example s2) and the other three immutable data (a tile dataset, a commune dataset and an OpenStreetMap relation), so its bytes never change: it is cached for a year, with the SHA-256 of the body as its ETag. A change to how the map is drawn takes a new version, so it always comes with a new URL; the URL of an earlier version answers 301 to the current one. Any visitor may ask for any commune: the image is public OpenStreetMap data and names no growing area. Anonymous and tenant-less (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Not part of the partner SDK clients (x-not-in-sdk): an image the public pages load.

Tham số

TênVị tríKiểuMô tả
style
bắt buộc
pathstring

The drawing's version, s followed by a number (for example s2): the current style version answers the image, an earlier one 301 to the current URL, any other 404.

tileset
bắt buộc
pathstring

The tile dataset's key, osmtiles-<extract timestamp>.

communes
bắt buộc
pathstring

The commune dataset's key, osm-<extract timestamp>.

osm_id
bắt buộc
pathstring

The commune's OpenStreetMap relation id, digits without a leading zero.

Phản hồi

Mã trạng tháiKiểuMô tả
200string
image/svg+xml

The commune map.

301

The URL of an earlier drawing version: the map is at Location, its current URL. No body.

304

Not modified: the request's If-None-Match names the image's ETag. No body.

404Error
application/json

No such map: a drawing version that is not one (malformed, or later than the current), a tile dataset or a commune dataset that is not imported, a relation that is not a commune of that dataset, or a malformed part. Every such URL gets this same body and headers; nothing is echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds. Also when this client's download bucket (shared with the EPCIS download; one token per started KiB served, the whole recording or the one byte range a 206 answers: bursts of 32 MiB, then 64 KiB a second) does not hold the bytes to serve; that bucket is taken after the visibility lookups and before the blob is read, and a 304 never takes from it.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=31536000, immutable. Never Set-Cookie.

ETag200string

The SHA-256 of the body, quoted.

X-Content-Type-Options200string

nosniff.

Content-Security-Policy200string

default-src 'none'; img-src data:; style-src 'unsafe-inline'; sandbox: inert when the image is opened on its own.

X-Request-Id301string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Location301string

The map's current same-origin path, /v1/public/maps/{style}/{tileset}/{communes}/{osm_id}.svg, {style} the current style version (s followed by a number, for example s2).

Cache-Control301string

public, max-age=0, s-maxage=60, stale-while-revalidate=300, as a public record: never immutable, so a later version is followed at once.

X-Request-Id304string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control304string

public, max-age=31536000, immutable.

ETag304string

The image's ETag, as on the 200.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale).

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · image/svg+xml
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 252" width="448" height="252">...</svg>
Phản hồi 404 · application/json
{
  "error": "not found: maps",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/maps/{tileset}/{communes}/{osm_id}.svg

Public commune map image, the path before its drawing version (moved)

Không cần xác thực · getPublicCommuneMapUnversioned

#293: the map URL as first published, without the drawing version (getPublicCommuneMap). Its images were drawn in the first style and cached for a year as immutable, so the current drawing is never served under it: a URL that names a stored map answers 301 to its current URL (/v1/public/maps/{style}/{tileset}/{communes}/{osm_id}.svg, {style} the current style version: s followed by a number, for example s2), cached as briefly as a public record. Anonymous and tenant-less (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Not part of the partner SDK clients (x-not-in-sdk): an image the public pages load.

Tham số

TênVị tríKiểuMô tả
tileset
bắt buộc
pathstring

The tile dataset's key, osmtiles-<extract timestamp>.

communes
bắt buộc
pathstring

The commune dataset's key, osm-<extract timestamp>.

osm_id
bắt buộc
pathstring

The commune's OpenStreetMap relation id, digits without a leading zero.

Phản hồi

Mã trạng tháiKiểuMô tả
301

A stored map: it is at Location, its current URL. No body.

404Error
application/json

No such map: a tile dataset or a commune dataset that is not imported, a relation that is not a commune of that dataset, or a malformed part. Every such URL gets this same body and headers; nothing is echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds. Also when this client's download bucket (shared with the EPCIS download; one token per started KiB served, the whole recording or the one byte range a 206 answers: bursts of 32 MiB, then 64 KiB a second) does not hold the bytes to serve; that bucket is taken after the visibility lookups and before the blob is read, and a 304 never takes from it.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id301string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Location301string

The map's current same-origin path, /v1/public/maps/{style}/{tileset}/{communes}/{osm_id}.svg, {style} the current style version (s followed by a number, for example s2).

Cache-Control301string

public, max-age=0, s-maxage=60, stale-while-revalidate=300, as a public record: never immutable, so a later version is followed at once.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale).

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 404 · application/json
{
  "error": "not found: maps",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}/fruits

Per-fruit results of a public lot

Không cần xác thực · listPublicLotFruits

U5 (#58, man2 "Xem kết quả từng quả và bản ghi âm gốc"): one page of a public lot's fruits, in fruit order, from an explicit allowlist (PublicLotFruit): code, public id, effective ripeness level, model confidence, weight, grade, read-time tier, sensory-override flag and the URL of the original recording. A fruit is listed under exactly the public fruit record's rule (getPublicFruit: recorded or overridden, a bound signed knock, every non-null measurement field, a lot with a growing area); a public lot without a growing area lists none. group=measured (default) lists the fruits whose level is the device's; group=overridden lists those an operator overrode, kept at Self-declared and shown separately (man2). Anonymous and tenant-less like the public lot record (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work: the public lot's lookup and context (a fixed number of statements), one count and one page statement (at most 201 rows, keyset on the lot's fruit numbers).

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

group
không bắt buộc
query"measured" | "overridden"

measured (default): levels from the device; overridden: levels an operator replaced (Self-declared).

cursor
không bắt buộc
querystring

next_cursor of the previous page of the same group.

limit
không bắt buộc
queryinteger

Page size, 1 to 200.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicLotFruitPage
application/json

One page of the group.

400Error
application/json

group, limit or cursor is not one this route accepts (Cache-Control: no-store), or the X-Request-Id header is malformed.

404Error
application/json

Not a public lot: every id the public lot route answers 404 for gets this same body and headers; the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "lot": {
    "public_id": "074eb09b371fc71c380da235aea9c14a",
    "code": "LO-260928-014"
  },
  "group": "measured",
  "total": 120,
  "items": [
    {
      "public_id": "5c1f0e2a9b7d4c3e8f6a1b2c3d4e5f60",
      "code": "Q-014-0001",
      "ripeness_level": 3,
      "model_confidence": 0.91,
      "weight_kg": 2.84,
      "grade": "A",
      "tier": "device_recorded",
      "sensory_override": false,
      "recording_url": "/v1/public/fruits/5c1f0e2a9b7d4c3e8f6a1b2c3d4e5f60/recordings/9f2c0d5ab1e7c3f4a6b8d0e2f4a6c8e0b2d4f6a8c0e2a4c6e8a0c2e4a6c8e0b2"
    },
    {
      "public_id": "6d2a1f3b0c8e5d4f9a7b2c3d4e5f6a71",
      "code": "Q-014-0002",
      "ripeness_level": 2,
      "model_confidence": 0.88,
      "weight_kg": 2.94,
      "grade": "A",
      "tier": "device_recorded",
      "sensory_override": false,
      "recording_url": null
    }
  ],
  "next_cursor": "eyJuIjoyfQ"
}
Phản hồi 400 · application/json · group
{
  "error": "bad group",
  "code": "bad_group"
}
Phản hồi 400 · application/json · limit
{
  "error": "bad limit",
  "code": "bad_limit"
}
Phản hồi 400 · application/json · cursor
{
  "error": "bad cursor",
  "code": "bad_cursor"
}
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/anchors

Daily integrity anchors

Không cần xác thực · listPublicAnchors

INTEGRITY-2 (#202): the daily anchors of the activity log, the evidence envelopes, the lot seals, the reviews and the envelopes' statuses when anchored, oldest first, a page at a time. Each closed UTC day gets one, an hour after it ends, even when it has no records, chained to the day before; each anchor is time-stamped by the configured RFC 3161 TSA. Download every page and run python3 verify_anchors.py chain --api <host> (the script is /developers/downloads/verify_anchors.py) to check the chain and each token (its genTime at most 48 h after its day ended, and a verified token for every day that ended more than 48 h ago; --allow-unstamped for a platform without a TSA); keep the pages, and later add --anchors <saved file> to check that they are still an unchanged prefix of the chain. Anonymous and tenant-less: the same bytes for every visitor. Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work: one statement of at most 101 rows.

Tham số

TênVị tríKiểuMô tả
after
không bắt buộc
querystring

A day (YYYY-MM-DD): the page starts after it. Pass the previous page's next_after.

limit
không bắt buộc
queryinteger

Page size, 1 to 100.

Phản hồi

Mã trạng tháiKiểuMô tả
200IntegrityAnchorPage
application/json

One page of anchors.

400Error
application/json

after is not a day or limit is out of range (Cache-Control: no-store), or the X-Request-Id header is malformed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "version": 1,
  "genesis": "0000000000000000000000000000000000000000000000000000000000000000",
  "items": [
    {
      "day": "2026-10-08",
      "seq": 41,
      "version": 1,
      "prev_anchor": "be49fb23ac82b5ec39175d41c24be9962da541a3e6e3e942e065c9b1f85a977d",
      "audit_root": "69517c75b68faea3ae84cb5116c7d12125d32e23529a1ff6ef36f666ce0fd882",
      "evidence_root": "a59ba7faac45b5663de69c9050f21fc04ee99a39fba52cebc08003fc009b9b69",
      "seal_root": "b161f22a5c2003f3d72b16a782971049af1c3686cfa1395b65238616c7854c6d",
      "review_root": "7f2c1c56a4cbbd0d6e3c4f5c2b5d1b6a0f3e7a9c8d2e4b1f6a3c5d7e9f0b2a4c",
      "held_root": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "day_root": "ad8af655fbd5987cb1634e88fa4997bfd23f0e106632e639ec35c8195f4d9deb",
      "audit_count": 1840,
      "evidence_count": 9312,
      "seal_count": 3,
      "review_count": 2,
      "held_count": 0,
      "anchor": "b54619909ae9f243ff09bd33eeab7103c8979cc0a354952304c2e12580ccb899",
      "created_at": "2026-10-09T01:00:04Z",
      "timestamp": {
        "status": "verified",
        "gen_time": "2026-10-09T01:00:06Z",
        "token": "MIIGTwYJKoZIhvcNAQcCoIIGQDCCBjwCAQMxDzANBglghkgBZQMEAgEFADCB"
      }
    }
  ],
  "next_after": null
}
Phản hồi 400 · application/json · after
{
  "error": "bad after",
  "code": "bad_after"
}
Phản hồi 400 · application/json · limit
{
  "error": "bad limit",
  "code": "bad_limit"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/lots/{publicId}/anchor-proof

Inclusion proof of a public lot's seal or event

Không cần xác thực · getPublicLotAnchorProof

INTEGRITY-2 (#202): proves that a public lot's seal (no event), or one of its events, is among the records of its day's anchor, as stored today: the record, its leaf hash, its RFC 9162 audit path and the day's anchor. event names one of the sealed lot's accepted event envelopes (the events of its EPCIS document, GET /v1/public/lots/{publicId}/epcis.jsonld), by id or as its eventID urn:uuid:<id>. Check it with python3 verify_anchors.py proof --api <host> --lot <publicId> [--event <id>], which also compares the anchor with the published chain (the script is /developers/downloads/verify_anchors.py). Anonymous and tenant-less like the public lot record. Not audited (a read); it changes nothing. Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Bounded work: the public lot's lookup, the record, the day's anchor, and its stored leaves unless the day's tree is already in memory (a bounded cache).

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

event
không bắt buộc
querystring

One of the sealed lot's event ids (or urn:uuid:<id>); without it the seal is proven.

Phản hồi

Mã trạng tháiKiểuMô tả
200AnchorInclusionProof
application/json

The proof.

400Error
application/json

event is malformed (Cache-Control: no-store), or the X-Request-Id header is malformed.

404Error
application/json

Not a public lot, a lot that is not sealed, an event that is not one of the sealed lot's events, or a record whose day is not anchored yet (a day is anchored an hour after it ends): every such request gets this same body and headers.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "kind": "seal",
  "day": "2026-10-08",
  "record": {
    "manifest_sha256": "0000000000000000000000000000000000000000000000000000000000001efa",
    "sealed_at": 1791440400.25,
    "fruit_count": 13,
    "event_count": 41
  },
  "leaf_hash": "52b42e8bff3ec1d57e4813b951e084464611dd15d449f20ae82936fc7e1f70c2",
  "included": true,
  "leaf_index": 1,
  "tree_size": 3,
  "path": [
    "03c144ed8ca7f54eedbabe5204716a751defce4c61ad32756454df2d44cc6b06",
    "a9a8a7268b3840b423803a0ea58206e4eac69b1055a063a35b97ed5815705930"
  ],
  "anchor": {
    "day": "2026-10-08",
    "seq": 41,
    "version": 1,
    "prev_anchor": "be49fb23ac82b5ec39175d41c24be9962da541a3e6e3e942e065c9b1f85a977d",
    "audit_root": "69517c75b68faea3ae84cb5116c7d12125d32e23529a1ff6ef36f666ce0fd882",
    "evidence_root": "a59ba7faac45b5663de69c9050f21fc04ee99a39fba52cebc08003fc009b9b69",
    "seal_root": "b161f22a5c2003f3d72b16a782971049af1c3686cfa1395b65238616c7854c6d",
    "review_root": "7f2c1c56a4cbbd0d6e3c4f5c2b5d1b6a0f3e7a9c8d2e4b1f6a3c5d7e9f0b2a4c",
    "held_root": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    "day_root": "ad8af655fbd5987cb1634e88fa4997bfd23f0e106632e639ec35c8195f4d9deb",
    "audit_count": 1840,
    "evidence_count": 9312,
    "seal_count": 3,
    "review_count": 2,
    "held_count": 0,
    "anchor": "b54619909ae9f243ff09bd33eeab7103c8979cc0a354952304c2e12580ccb899",
    "created_at": "2026-10-09T01:00:04Z",
    "timestamp": {
      "status": "verified",
      "gen_time": "2026-10-09T01:00:06Z",
      "token": "MIIGTwYJKoZIhvcNAQcCoIIGQDCCBjwCAQMxDzANBglghkgBZQMEAgEFADCB"
    }
  }
}
Phản hồi 400 · application/json
{
  "error": "bad event",
  "code": "bad_event"
}
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/epoch

The current server epoch value

Không cần xác thực · getPublicEpoch

SENS-B2c (#239): the newest signed server epoch value. The backend issues a new one every hour, signed with a key of its own (ES256, never a device, gateway, lab or issuer key). A device puts the epoch it last fetched in context.epoch of the envelopes it signs (optional; /developers/downloads/envelope-v1.schema.json): a reading cannot have been signed before the value it cites was issued, so its creation time is bounded on both sides (the server records when it received it). Ingest flags, and never rejects or quarantines, an envelope whose value the server never issued, was issued after a reading's time (beyond the clock allowance), or is older than the allowed window (24 hours by default) at a reading's time: each flagged reading is Self-declared (reason server_epoch_mismatch) and the company gets a server_epoch_mismatch alert. To verify a value: the ES256 signature sig.value (base64url of r || s) over the canonical JSON (the envelopes' rule) of the document without sig and publicKeyJwk, with the epoch key's public key (publicKeyJwk; compare it with a copy you trust). Old values are public, so this proves data was not prepared in advance, not that it was not back-filled later. Anonymous and tenant-less: the same bytes for every visitor. Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Not part of the partner SDK clients (x-not-in-sdk). Bounded work: one indexed statement.

Phản hồi

Mã trạng tháiKiểuMô tả
200ServerEpoch
application/json

The newest value, issued at most two hours ago.

400Error
application/json

The X-Request-Id header is present and malformed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

503Error
application/json

No value was issued in the last two hours: no epoch key is configured (AGRITRACE_EPOCH_KEY), or the process that issues the values has stopped. Never cached; retry later.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id503string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control503string

no-store.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "epoch": "3f9a1c0e7b2d4e6f8a0b1c2d3e4f5a6b",
  "issuedAt": "2026-10-16T03:00:02.418Z",
  "kid": "epoch-f1d59449b727165d",
  "sig": {
    "alg": "ES256",
    "kid": "epoch-f1d59449b727165d",
    "value": "WeU8uTYHd3NOSB1v4B45m7JXKGhm9GcGF9-KkecUmTq9x0d7XB92o45NQS5-DgW0HW5TqGDKWtpMuVl27oPj4Q"
  },
  "publicKeyJwk": {
    "kty": "EC",
    "crv": "P-256",
    "x": "UVw9brnjlrkE0_7Kf1T9zQzB6Ze_N13KUVrQpsO0A18",
    "y": "RTa-OlDzGPv5pUdZAqIhUCvvDVfgjFOyzApW8X2fk1Q"
  }
}
Phản hồi 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}
Phản hồi 503 · application/json
{
  "error": "server epoch value unavailable",
  "code": "server_epoch_value_unavailable"
}

GET /v1/public/lots/{publicId}/corrections

Corrections of a public lot before its seal

Không cần xác thực · getPublicLotCorrections

INTEGRITY-4 (#204): how often each journey step of a public lot was corrected before its seal, from the append-only activity log (the public lot page states it beside each step). A correction is a successful edit recorded in the company's activity log before the lot was sealed: a lot edit (PATCH /v1/lots/{lot}, the lot.update row) that changed the value of a field a step shows (a field sent with its current value is no correction; growing area: registration; harvest date or harvest event: harvest; variety, product or GTIN: details, the lot's own details; the destination is never public and never counted), or an operator's action on a fruit (POST /v1/fruits/{code}/actions, the fruit.action row) that overrides its level, rejects it or has it re-measured: measurement (an acceptance and a replayed action are not corrections). Only counts and local dates are answered: never who corrected, what the value was before or after, the reason, a field name or the request. A record can change only while its lot is open, so every correction precedes the seal. measurement counts the corrections of every fruit of the lot. after_public counts those made after the lot was first public (its first measurement session opened, which makes the lot open, the first status the public pages show); the page highlights them. A measurement correction made while the fruit's own measurement session was running (from its opening to its close, less any time it was paused) is part of measuring that fruit and is not in after_public, only in count; one made at any other time is (after the session closed, while it was paused, or while only another session of the lot was running). A step without a correction is left out. Anonymous and tenant-less like the public records (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Not part of the partner SDK clients (x-not-in-sdk). Bounded work: the answer is stored with the lot's materialized public read model (#141) and invalidated with it, so a valid one is one statement; otherwise the lot's lookup and at most four statements, one of which reads the lot's fruits.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The lot's public id (128 random bits as hex). Any other value is 404 like an unknown id.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicCorrections
application/json

The corrections, per step.

404Error
application/json

Not a public lot: an unknown or malformed id, a lot that is not open or closed, not of a crop of the crop registry (#156), or lacks a field the record needs. Every such id gets this same body and headers; the id is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "sealed": true,
  "public_since": "2026-09-27",
  "steps": [
    {
      "kind": "harvest",
      "count": 1,
      "last_on": "2026-09-27",
      "after_public": 0
    },
    {
      "kind": "measurement",
      "count": 3,
      "last_on": "2026-09-28",
      "after_public": 3
    }
  ]
}
Phản hồi 404 · application/json
{
  "error": "not found: lots",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/public/fruits/{publicId}/corrections

Corrections a public fruit's page states

Không cần xác thực · getPublicFruitCorrections

INTEGRITY-4 (#204): the corrections a public fruit's page states beside its journey steps: its lot's edits as GET /v1/public/lots/{publicId}/corrections counts them, and, for measurement, the corrections of this fruit alone. Answered under exactly the public fruit record's visibility; logs no scan. A correction is a successful edit recorded in the company's activity log before the lot was sealed: a lot edit (PATCH /v1/lots/{lot}, the lot.update row) that changed the value of a field a step shows (a field sent with its current value is no correction; growing area: registration; harvest date or harvest event: harvest; variety, product or GTIN: details, the lot's own details; the destination is never public and never counted), or an operator's action on a fruit (POST /v1/fruits/{code}/actions, the fruit.action row) that overrides its level, rejects it or has it re-measured: measurement (an acceptance and a replayed action are not corrections). Only counts and local dates are answered: never who corrected, what the value was before or after, the reason, a field name or the request. A record can change only while its lot is open, so every correction precedes the seal. Anonymous and tenant-less like the public records (no session, token, cookie or X-Tenant changes the answer). Not audited (a read). Rate limited per client before anything else (/v1/public/*: bursts of 60, then 20 a second). Not part of the partner SDK clients (x-not-in-sdk). Bounded work: the public fruit record's two lookups, then at most four statements, none growing with the lot.

Tham số

TênVị tríKiểuMô tả
publicId
bắt buộc
pathstring

The fruit's public id (128 random bits as hex). Any other value is 404 like an unknown id.

Phản hồi

Mã trạng tháiKiểuMô tả
200PublicCorrections
application/json

The corrections, per step.

404Error
application/json

Not a public fruit: an unknown or malformed id, a fruit that is not recorded or overridden, a fruit of a lot that is not public or has no growing area, or one lacking a field the record needs. Every such id gets this same body and headers, logs no scan, and is never echoed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

410Error
application/json

The record was deleted when its retention period ended (#209): the code named a lot, or a fruit or carton of a lot, of a company that left CropPath. Only the code and the date it was removed are kept, so the answer says nothing else about the lot; every such code gets this same body and headers, and the code is never echoed. A code that never named a record stays 404.

429Error
application/json

Too many /v1/public/* requests from this client address (per-IP token bucket: bursts of 60, then 20 a second). The address is the CF-Connecting-IP a trusted proxy (AGRITRACE_TRUSTED_PROXIES) sends, else the socket peer; a request from a trusted proxy that carries the internal X-Agritrace-Scan-Key (the web server's own render) is counted against the visitor address it forwards in cf-connecting-ip (sent once, a valid IP address). Nothing else was done; retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Header của phản hồi

TênMã trạng tháiKiểuMô tả
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control200string

public, max-age=0, s-maxage=60, stale-while-revalidate=300 (#177: the edge keeps it 60 s, the frontend's staleTime, and may serve it stale up to 300 s more while it refetches; browsers always revalidate). Never Set-Cookie.

X-Request-Id404string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control404string

public, max-age=0, s-maxage=60 (#177: a 404 is never served stale). Never Set-Cookie.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id410string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control410string

public, max-age=0, s-maxage=60, as a 404. Never Set-Cookie.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Retry-After429string

Seconds to wait before retrying.

Cache-Control429string

no-store: a refusal is never cached.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Ví dụ phản hồi

Phản hồi 200 · application/json
{
  "sealed": true,
  "public_since": "2026-09-27",
  "steps": [
    {
      "kind": "harvest",
      "count": 1,
      "last_on": "2026-09-27",
      "after_public": 0
    },
    {
      "kind": "measurement",
      "count": 3,
      "last_on": "2026-09-28",
      "after_public": 3
    }
  ]
}
Phản hồi 404 · application/json
{
  "error": "not found: fruits",
  "code": "not_found"
}
Phản hồi 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Phản hồi 410 · application/json
{
  "error": "lot removed: this record is no longer available",
  "code": "lot_removed"
}
Phản hồi 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Phản hồi 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}