Skip to main content

3. Data Ingestion & Supply Chain

The following methods are available via the AgriBackup SDK for this integration stage.

List Supplier Mappings

Retrieves all mapped suppliers for the enterprise.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.suppliers.listSuppliers(/* args */);
console.log(response.data);

Register Supplier Mapping

Binds an internal ERP Vendor ID to an official EU TRACES Operator UUID.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.suppliers.registerSupplier(/* args */);
console.log(response.data);

Invokes the [BATCH_SHIPMENT_GATEKEEPER] Hedera Smart Contract to lock a verified batch to a logistics shipment. Emits a 'shipment.linked' webhook upon blockchain consensus.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.api.linkBatchToShipment(/* args */);
console.log(response.data);

List Verified Polygons

Retrieves a cursor-paginated list of all verified farm boundary polygons matching the organization scope.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.polygons.getPolygons(/* args */);
console.log(response.data);

Ingest GeoJSON Polygons (Async)

Programmatically ingest farm/production unit polygons. Returns 202 instantly. The bulk ingestion engine runs deforestation checks and fires 'polygon.verified' webhook upon completion.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.polygons.ingestPolygons(/* args */);
console.log(response.data);

List Batches

Retrieves a cursor-paginated list of registered EUDR batches.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.batches.getBatches(/* args */);
console.log(response.data);

Register a consolidated EUDR batch (Synchronous)

Programmatically create a new EUDR batch linked to an array of pre-verified Polygon IDs. Returns a 201 response with the batch details immediately.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.batches.registerBatch(/* args */);
console.log(response.data);

Run compliance risk assessment for an EUDR batch

An explicit command to lock the batch, verify all attached legal documents, and run the EUDR oracle checks. Returns 202 instantly, and triggers the batch.risk_assessed webhook when finished.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.batches.assessRisk(/* args */);
console.log(response.data);

Get batch by ID

Returns the consolidated risk state and linked shipment IDs for a single EUDR batch.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.batches.getBatchById(/* args */);
console.log(response.data);

Delete an EUDR batch

Deletes a batch if it is not cryptographically linked to a shipment or TRACES NT.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.batches.deleteBatch(/* args */);
console.log(response.data);

Update an EUDR batch

Updates batch details if it is not cryptographically linked to a shipment or TRACES NT.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.batches.updateBatch(/* args */);
console.log(response.data);

Get Supplier Mapping

Retrieves the mapping for a specific internal ERP Vendor ID.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.suppliers.getSupplier(/* args */);
console.log(response.data);

Get Polygon compliance status

Synchronously query the deterministic EUDR compliance status (PENDING, COMPLIANT, HIGH_RISK) of a specific polygon before linking it to a high-value shipment.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.polygons.getPolygonStatus(/* args */);
console.log(response.data);

Delete Polygon

Deletes a polygon if it is not cryptographically linked to a batch or shipment.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.polygons.deletePolygon(/* args */);
console.log(response.data);

Asynchronously rollback the Hedera smart contract lock, freeing the batch for reassignment. Essential for logistics cancellations at the port.

import { AgriBackupClient } from 'agribackup';

const client = new AgriBackupClient('sk_live_...');
const response = await client.api.unlinkShipment(/* args */);
console.log(response.data);