{
  "result": "success",
  "docs": {
    "name": "Currency API",
    "base_url": "https://fxrates.sccadmin.work",
    "refresh_cadence": "every 2 hours",
    "retention": "all snapshots retained indefinitely",
    "response_envelope": {
      "success": {
        "result": "success",
        "...": "endpoint-specific fields"
      },
      "error": {
        "result": "error",
        "error_type": "...",
        "message": "..."
      }
    },
    "endpoints": [
      {
        "method": "GET",
        "path": "/",
        "description": "Homepage."
      },
      {
        "method": "GET",
        "path": "/docs",
        "description": "API documentation (HTML)."
      },
      {
        "method": "GET",
        "path": "/api",
        "description": "API documentation (JSON)."
      },
      {
        "method": "GET",
        "path": "/api/health",
        "description": "Health check."
      },
      {
        "method": "GET",
        "path": "/api/currencies",
        "description": "List supported ISO 4217 currency codes from the latest snapshot.",
        "example": "/api/currencies"
      },
      {
        "method": "GET",
        "path": "/api/latest",
        "description": "Latest exchange rates for the canonical base (USD).",
        "example": "/api/latest"
      },
      {
        "method": "GET",
        "path": "/api/latest/:base",
        "description": "Latest rates re-based to the supplied currency (cross rates).",
        "example": "/api/latest/EUR"
      },
      {
        "method": "GET",
        "path": "/api/latest/:base/:target",
        "description": "Latest rate for an individual currency pair.",
        "example": "/api/latest/EUR/GBP"
      },
      {
        "method": "GET",
        "path": "/api/convert/:from/:to",
        "description": "Conversion rate between two currencies (amount defaults to 1).",
        "example": "/api/convert/EUR/GBP"
      },
      {
        "method": "GET",
        "path": "/api/convert/:from/:to/:amount",
        "description": "Convert an amount. Append ?date=YYYY-MM-DD for a historical conversion.",
        "example": "/api/convert/EUR/GBP/42.5?date=2026-06-01"
      },
      {
        "method": "GET",
        "path": "/api/historical/:date",
        "description": "Rates as of a date (YYYY-MM-DD). Returns the latest snapshot on or before that date. If not in the local dataset, fetches from the external API and stores it.",
        "example": "/api/historical/2026-06-01"
      },
      {
        "method": "GET",
        "path": "/api/historical/:date/:base",
        "description": "Historical rates re-based to the supplied currency.",
        "example": "/api/historical/2026-06-01/EUR"
      },
      {
        "method": "GET",
        "path": "/api/historical/:date/:base/:target",
        "description": "Historical rate for an individual currency pair.",
        "example": "/api/historical/2026-06-01/EUR/GBP"
      },
      {
        "method": "GET",
        "path": "/api/snapshots?limit=50&offset=0",
        "description": "List retained rate snapshots (proves all past currencies are retained).",
        "example": "/api/snapshots?limit=10"
      },
      {
        "method": "POST",
        "path": "/api/admin/refresh",
        "description": "Manually trigger a rate update. Requires Authorization: Bearer <ADMIN_TOKEN> when ADMIN_TOKEN is set."
      }
    ]
  }
}
