{
  "name": "bca-rates-worker",
  "description": "Read-only JSON API over scraped Bank Central Asia (BCA) foreign-exchange rates. Data is scraped on a cron into D1; requests never hit BCA.",
  "source": "https://www.bca.co.id/en/informasi/kurs",
  "rateTypes": [
    "BankNotes",
    "TTCounter",
    "eRate"
  ],
  "endpoints": [
    {
      "method": "GET",
      "path": "/api/rates",
      "description": "Latest observed rate for every currency and rate type"
    },
    {
      "method": "GET",
      "path": "/api/rates/:currency",
      "description": "Latest rates for one currency, e.g. /api/rates/USD"
    },
    {
      "method": "GET",
      "path": "/api/current?rate_type=eRate",
      "description": "Flat \"rate now, and when it was last updated\" snapshot for every currency. Defaults to rate_type=eRate."
    },
    {
      "method": "GET",
      "path": "/api/current/:currency?rate_type=eRate",
      "description": "The same flat object for one currency, e.g. /api/current/USD"
    },
    {
      "method": "GET",
      "path": "/api/history?currency=USD&rate_type=eRate&from=&to=&limit=",
      "description": "Historical series. Defaults: rate_type=eRate, limit=100, last 30 days. Max limit 1000."
    },
    {
      "method": "GET",
      "path": "/api/health",
      "description": "Last successful scrape, its age, last run status, row counts"
    },
    {
      "method": "POST",
      "path": "/api/refresh",
      "description": "Trigger a scrape now. Requires `Authorization: Bearer $REFRESH_TOKEN`."
    }
  ],
  "examples": [
    "https://bca-rates.giw.app/api/rates",
    "https://bca-rates.giw.app/api/rates/USD",
    "https://bca-rates.giw.app/api/current",
    "https://bca-rates.giw.app/api/current/USD",
    "https://bca-rates.giw.app/api/history?currency=USD&limit=10"
  ]
}
