Link Batch to Shipment Async | AgriBackup EUDR
Invoke the Hedera smart contract to cryptographically lock a compliant EUDR batch to a logistics shipment. Returns 202 Accepted with a jobId.
202 Accepted immediately with a jobId. Poll GET /api/v1/enterprise/eudr/jobs/{jobId} or listen for the shipment.linked webhook to confirm that the smart contract lock has been executed.
Request Headers
| Header | Required | Description |
|---|---|---|
X-API-Key | ✅ | Your live API key, e.g. sk_live_.... |
Idempotency-Key | ✅ | A UUID v4 string. Replaying the same key within 24 hours returns the original response without re-invoking the smart contract. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
batchId | string | ✅ | The UUID of the EUDR batch to link. |
shipmentId | string | ✅ | The shipment reference or logistics tracking ID (e.g. SHIP-OOCL-9988). |
billOfLading | string | ☐ | Optional Bill of Lading document number (e.g. BOL-77665544). |
vesselName | string | ☐ | Optional shipping vessel name (e.g. MSC Gulsun). |
Response — 202 Accepted
| Field | Type | Description |
|---|---|---|
jobId | string | Use this ID to poll job status via GET /api/v1/enterprise/eudr/jobs/{jobId}. |
status | string | Always PENDING on acceptance. |
estimatedDurationSec | integer | Estimated seconds until Hedera consensus completes. |
createdAt | string (ISO-8601) | Timestamp when the job was accepted. |
Location header pointing to the job status endpoint.
Error Responses
| Status | Meaning |
|---|---|
400 | Invalid batchId, invalid shipmentId, or malformed request body. |
401 | Missing or invalid X-API-Key. |
403 | Your API key does not have permission to link this batch. |
409 | The batch is already linked to a shipment, or a double-spend attempt was detected on the Hedera ledger. |
423 | The batch is currently being processed by another thread. Wait briefly and retry. |
429 | Rate limit exceeded. |
Async Completion — shipment.linked Webhook
When the Hedera smart contract lock is confirmed, AgriBackup fires a shipment.linked event to your registered webhook URL. The payload is signed with X-AgriBackup-Signature (HMAC-SHA256). After receiving this event, the batch is cryptographically immutable and ready for Due Diligence Statement generation.
Code Examples
Authorizations
Enterprise API Key provided via the AgriBackup developer console.
Headers
Unique idempotency key (UUID) to prevent duplicate operations. Safely stored in Redis with a strict 24-hour TTL to prevent memory bloat during saturation attacks.
Body
Payload to link a batch to a shipment via Hedera Smart Contract
The EUDR batch ID
"uuid-1234"
The shipment reference or logistics tracking ID
"SHIP-OOCL-9988"
Optional Bill of Lading document number
"BOL-77665544"
Optional Shipping Vessel Name
"MSC Gulsun"
Response
Smart contract lock initiated asynchronously
Response payload for asynchronously accepted jobs
The unique asynchronous tracking job ID
"job_998877"
Current execution status invariant
PENDING "PENDING"
Estimated duration in seconds before consensus or processing lock release
3
Timestamp when the job was accepted
"2026-06-15T12:00:00Z"