> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agribackup.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve Shipment Cryptographic Evidence

> Fetch Hedera DLT-anchored cryptographic evidence for a shipment, proving the batch-to-shipment smart contract lock was executed and recorded on the public ledger.

When a batch is linked to a logistics shipment through the AgriBackup smart contract, the binding event is permanently recorded on the Hedera Hashgraph ledger. This creates a cryptographic proof that a specific commodity batch — with all its associated polygon and compliance data — was irrevocably attached to a named logistics shipment at a verifiable point in time. You can retrieve this shipment anchoring evidence at any time by supplying the shipment reference. This evidence is commonly requested by customs authorities, EU border inspection posts, and third-party auditors as part of the EUDR clearance documentation package.

## Endpoint

`GET /api/v1/enterprise/eudr/evidence/ledger/shipment/{shipmentId}`

## Path Parameters

<ParamField path="shipmentId" type="string" required>
  The unique identifier of the shipment whose cryptographic anchoring evidence you want to retrieve. This corresponds to the `shipmentReference` value provided when you called the Link Batch to Shipment endpoint. Evidence is available after the `shipment.linked` webhook event has been received, confirming consensus on the Hedera ledger.
</ParamField>

## Response Fields

<ResponseField name="entityId" type="string">
  The shipment reference identifier for which this evidence bundle was generated.
</ResponseField>

<ResponseField name="entityType" type="string">
  The type of entity for which evidence was anchored. Will be `BATCH` for shipment anchoring events, as the batch is the primary entity linked during the shipment locking operation.
</ResponseField>

<ResponseField name="hederaTransactionIds" type="array">
  An array of all Hedera consensus transaction IDs associated with this shipment anchoring event. Each ID is independently verifiable on the Hedera Mirror Node.
</ResponseField>

<ResponseField name="merkleRootHash" type="string">
  The Merkle root hash anchored on the Hedera ledger at the time of the shipment anchoring event.
</ResponseField>

<ResponseField name="stateProofs" type="array">
  An array of Hedera state proof objects for independent audit verification of the shipment locking event.

  <Expandable title="stateProofs fields">
    <ResponseField name="stateProofs[].hederaTransactionId" type="string">
      The Hedera HCS transaction ID for this specific state proof entry.
    </ResponseField>

    <ResponseField name="stateProofs[].consensusTimestamp" type="string">
      The Hedera consensus timestamp assigned at the moment this transaction reached finality.
    </ResponseField>

    <ResponseField name="stateProofs[].merkleProof" type="string">
      The Merkle proof path JSON for cryptographic inclusion verification.
    </ResponseField>

    <ResponseField name="stateProofs[].operationType" type="string">
      The ledger operation type recorded for this state proof entry (e.g., `CREATED`).
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="consensusTimestamp" type="string">
  The primary Hedera consensus timestamp (ISO-8601) of the shipment anchoring event.
</ResponseField>

## Code Examples

<CodeGroup>
  ```python Python theme={null}
  import agribackup
  from agribackup.rest import ApiException

  configuration = agribackup.Configuration(host="https://live.agribackup.com/api/v1")
  configuration.api_key['ApiKeyAuth'] = 'sk_live_YOUR_API_KEY'

  with agribackup.ApiClient(configuration) as api_client:
      try:
          evidence_api = agribackup.EnterpriseEvidenceApi(api_client)

          shipment_id = "BOL-99281744"
          response = evidence_api.get_shipment_evidence(shipment_id=shipment_id)

          print("Entity ID:", response.entity_id)
          print("Merkle Root Hash:", response.merkle_root_hash)
          print("Consensus Timestamp:", response.consensus_timestamp)
          print("Transaction IDs:", response.hedera_transaction_ids)
          for proof in response.state_proofs:
              print(f"  Proof TX: {proof.hedera_transaction_id} | Op: {proof.operation_type}")

      except ApiException as e:
          print("Exception when calling EnterpriseEvidenceApi: %s\n" % e)
  ```

  ```javascript Node.js theme={null}
  import { AgriBackupClient } from '@agribackup/sdk';

  const client = new AgriBackupClient({
    apiKey: 'sk_live_YOUR_API_KEY',
    baseUrl: 'https://live.agribackup.com/api/v1'
  });

  async function getShipmentEvidence() {
    try {
      const shipmentId = 'BOL-99281744';
      const response = await client.evidence.getShipmentEvidence(shipmentId);

      console.log('Entity ID:', response.entityId);
      console.log('Merkle Root Hash:', response.merkleRootHash);
      console.log('Consensus Timestamp:', response.consensusTimestamp);
      console.log('Transaction IDs:', response.hederaTransactionIds);
      response.stateProofs.forEach(proof => {
        console.log(`  Proof TX: ${proof.hederaTransactionId} | Op: ${proof.operationType}`);
      });
    } catch (error) {
      console.error('Error retrieving shipment evidence:', error.message);
    }
  }

  getShipmentEvidence();
  ```

  ```bash cURL theme={null}
  curl --request GET \
    --url https://live.agribackup.com/api/v1/enterprise/eudr/evidence/ledger/shipment/BOL-99281744 \
    --header 'X-API-Key: sk_live_YOUR_API_KEY'
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "entityId": "BOL-99281744",
  "entityType": "BATCH",
  "hederaTransactionIds": [
    "0.0.12345@1713583400.000000000"
  ],
  "merkleRootHash": "0xdeadbeefcafe0123deadbeefcafe0123deadbeefcafe0123deadbeefcafe0123",
  "stateProofs": [
    {
      "hederaTransactionId": "0.0.12345@1713583400.000000000",
      "consensusTimestamp": "2026-07-14T22:11:47",
      "merkleProof": "{\"path\":[\"0xabcdef...\",\"0x123456...\"],\"root\":\"0xdeadbe...\"}",
      "operationType": "CREATED"
    }
  ],
  "consensusTimestamp": "2026-07-14T22:11:47Z"
}
```

<Tip>
  When assembling a complete EUDR compliance package for an auditor or customs authority, combine the batch evidence, polygon evidence for each polygon in the batch, and this shipment evidence into a single submission. Together, they form an end-to-end cryptographic chain of custody from farm origin to EU border entry point.
</Tip>
