CropPath for developers

All guides

TypeScript SDK

Available

A typed client of the whole HTTP API for packing houses and ERP integrations, on Node 20 or later.

@croppath/sdk has a typed method for every operation of the API reference, plus API-token auth, the tenant header, timeouts, retries of safe requests only, pagination helpers and typed errors. It has no runtime dependency.

Download the package tarball (.tgz) from this portal's Downloads page (/developers/downloads), check its SHA-256 against the .sha256 file next to it, then install it with npm as below. CropPath distributes its SDKs only through this portal, not through public package registries.

curl -fLO https://txng.theio.vn/developers/downloads/sdk/croppath-sdk-0.3.0.tgz
curl -fLO https://txng.theio.vn/developers/downloads/sdk/croppath-sdk-0.3.0.tgz.sha256
sha256sum -c croppath-sdk-0.3.0.tgz.sha256    # macOS: shasum -a 256 -c
npm install ./croppath-sdk-0.3.0.tgz          # pnpm add and yarn add work too
import { createCropPathClient } from "@croppath/sdk";

const api = createCropPathClient({
  baseUrl: "https://txng.theio.vn",
  token: process.env.CROPPATH_TOKEN!,
  tenant: "coop-dl",                  // sent as X-Tenant
});

const { data: lot } = await api.getLot({ path: { lot: "LO-260928-014" } });
console.log(lot.status);

Use an API token with the role tenant_admin for the packing routes. The token is sent only to baseUrl, which must be https:// except on your own computer, and it must never reach end users' browsers: call the API from your server.

In the API reference