CropPath for developers

API reference

419 operations of AgriTrace HTTP API, version 1, generated from its OpenAPI document.

Operation and field descriptions are in English, as written in the OpenAPI document.

The CropPath HTTP API, version 1, at https://txng.theio.vn. It covers a company's traceability records (growing areas, lots, packing, shipping and exports), devices and their signed messages, laboratories, the public lot and fruit pages behind the QR codes, and webhooks. Guides, examples and this reference: https://txng.theio.vn/en/developers.

Each operation's security lists the credentials it accepts. bearer: an API token (agt_..., role tenant_admin, operator or auditor) or the access token of an OAuth2 API client (ago_...), sent as Authorization: Bearer; an API client also needs the scope the operation lists under oauth2. cookie: a person signed in to the CropPath console. An operation with no security is anonymous. deviceMtls: a device or gateway with its client certificate.

x-session-only: true marks an operation for people signed in to the console only (account, team, credentials, company settings and support): it lists the session cookie as its only security. An API token or API client calling one is refused: 401 not_authenticated for the signed-in user's own operations under /v1/auth/... and for GET /v1/help, which read only the session cookie, and 403 role_not_permitted for the others. Operations for CropPath's platform admins and for lab users need a role that no API client and no API token a company creates can hold, so they answer 403 to a company's integrations as well.

An error answers with a stable code in its JSON body (an Error; device ingest answers an IngestResult, and the OAuth2 endpoints the RFC 6749 error with the code beside it). An operation that lists the Idempotency-Key header can be retried safely with the same key.

Per-company quotas (#134): every call made with a company's API tokens or API clients counts toward that company's quotas, on top of the per-client limits an operation lists: calls per minute and calls per UTC day (the company admin's usage page and getCompanyUsage show both). Over either, any such operation answers 429 too_many_requests with Retry-After (for the daily quota, the seconds until the next UTC midnight), right after the credential is checked and before anything else is checked or changed.

Download the OpenAPI document (JSON) /developers/openapi.json

Authentication

Operations by area

Platform (internal)

Operations that run the platform itself: every operation only a platform administrator may call (for example creating tenants and their administrators, approving facilities, growing areas, devices and gateways, managing labs, the monitoring metrics) and the MQTT broker's authorization check. A partner integration does not use them.

More