> ## 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 the Finalized DDS XML Payload

> Fetch the complete, finalized TRACES NT V3-compliant XML payload and Hedera consensus timestamp for a specific Due Diligence Statement by its reference ID.

After a DDS generation job completes, you can retrieve its full XML payload at any point in its lifecycle using the DDS reference identifier. This is useful for storing a local copy in your ERP, presenting the declaration to auditors, or verifying the contents before or after submission to TRACES NT. The payload returned is the exact TRACES NT V3 XML body that was — or will be — transmitted to EU customs authorities, together with the Hedera consensus timestamp that anchors the record on the public ledger.

## Endpoint

`GET /api/v1/enterprise/eudr/declarations/dds/{referenceId}`

## Path Parameters

<ParamField path="referenceId" type="string" required>
  The unique reference identifier of the DDS whose XML payload you want to retrieve. This ID is returned in the job result after successful DDS generation via the `POST /api/v1/enterprise/eudr/declarations/dds` endpoint.
</ParamField>

## Response Fields

<ResponseField name="referenceId" type="string">
  The AgriBackup reference identifier for this DDS record.
</ResponseField>

<ResponseField name="batchId" type="string">
  The batch identifier embedded in the DDS payload, confirming which commodity lot the declaration covers.
</ResponseField>

<ResponseField name="tracesNtXml" type="string">
  The complete, finalized XML payload conforming to the TRACES NT V3 schema for Due Diligence Statements. This is the authoritative legal document representing the declaration.
</ResponseField>

<ResponseField name="hederaConsensusTimestamp" type="string">
  The Hedera consensus timestamp or transaction ID confirming the DDS was anchored on the distributed ledger. Use this to independently verify the record on the Hedera Mirror Node.
</ResponseField>

<ResponseField name="tracesSubmissionStatus" type="string">
  The current submission status of the DDS. One of `PENDING`, `GENERATED`, or `SUBMITTED`.
</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:
          declarations_api = agribackup.EnterpriseDeclarationsApi(api_client)

          reference_id = "DDS-AB12CD34"
          response = declarations_api.get_dds_payload(reference_id=reference_id)

          print("Reference ID:", response.reference_id)
          print("Submission Status:", response.traces_submission_status)
          print("Hedera Timestamp:", response.hedera_consensus_timestamp)
          print("XML Payload:", response.traces_nt_xml)

      except ApiException as e:
          print("Exception when calling EnterpriseDeclarationsApi: %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 getDdsPayload() {
    try {
      const referenceId = 'DDS-AB12CD34';
      const response = await client.declarations.getDdsPayload(referenceId);

      console.log('Reference ID:', response.referenceId);
      console.log('Submission Status:', response.tracesSubmissionStatus);
      console.log('Hedera Timestamp:', response.hederaConsensusTimestamp);
      console.log('XML Payload:', response.tracesNtXml);
    } catch (error) {
      console.error('Error retrieving DDS payload:', error.message);
    }
  }

  getDdsPayload();
  ```

  ```bash cURL theme={null}
  curl --request GET \
    --url https://live.agribackup.com/api/v1/enterprise/eudr/declarations/dds/DDS-AB12CD34 \
    --header 'X-API-Key: sk_live_YOUR_API_KEY'
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "referenceId": "DDS-AB12CD34",
  "batchId": "batch_a1b2c3d4e5",
  "tracesNtXml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><DueDiligenceStatement xmlns=\"urn:eu:traces:dds:v3\">...</DueDiligenceStatement>",
  "hederaConsensusTimestamp": "0.0.12345@1234567890.123456789",
  "tracesSubmissionStatus": "GENERATED"
}
```

<Tip>
  The XML payload is stable and does not change after generation. You can safely cache the response in your document management system or ERP using the `referenceId` as the cache key.
</Tip>
