#!/usr/bin/env bash
set -euo pipefail
: "${BASE_URL:?Set the provisioned API origin}"
: "${ACCESS_TOKEN:?Set a test access token securely}"
: "${IDEMPOTENCY_KEY:?Set a stable key for this exact request}"
: "${REQUEST_FILE:?Set a validated ArchiveRequest JSON file}"
# Add --cert/--key through a reviewed client configuration if mTLS is required.
curl --fail-with-body --request POST "${BASE_URL%/}/v1/archives" \
  --header "Authorization: Bearer ${ACCESS_TOKEN}" \
  --header 'Content-Type: application/json' \
  --header 'X-Correlation-ID: corr-test-001' \
  --header "Idempotency-Key: ${IDEMPOTENCY_KEY}" \
  --data-binary "@${REQUEST_FILE}"
# Save archiveId/jobId, poll the original job, then follow its resultReference.
# No production or sandbox endpoint is embedded in this sample.
