{
  "ok": true,
  "service": "notion-billing-metrics-sync",
  "version": "v2",
  "scheduler": {
    "dispatcherCronTrigger": "* * * * *",
    "logicalJobKey": "notion-billing-metrics-sync.daily",
    "logicalSchedule": "0 8,17 * * *",
    "logicalTimezone": "Asia/Kuala_Lumpur",
    "additionalLogicalSchedules": [
      {
        "jobKey": "notion-billing-metrics-sync.midday",
        "logicalSchedule": "30 12 * * *"
      }
    ]
  },
  "authentication": {
    "bearerToken": true,
    "cloudflareAccessHeadersRequiredByDefault": false
  },
  "endpoints": [
    {
      "method": "GET",
      "path": "/health",
      "description": "Basic worker health check."
    },
    {
      "method": "GET",
      "path": "/health/notion",
      "description": "Checks whether the worker can reach Notion."
    },
    {
      "method": "GET",
      "path": "/app",
      "description": "Minimal operator portal with endpoint references."
    },
    {
      "method": "GET",
      "path": "/api/notion/billing-metrics-sync",
      "description": "Returns API usage documentation."
    },
    {
      "method": "POST",
      "path": "/api/notion/billing-metrics-sync",
      "description": "Creates a D1-backed run and fans out compute items through the orchestration pipeline.",
      "exampleRequest": {
        "curl": "curl -X POST 'https://notion-billing-metrics-sync.easondev.workers.dev/api/notion/billing-metrics-sync' -H 'Authorization: Bearer <token>' -H 'Content-Type: application/json' -d '{\"scope\":\"open-cycles\",\"limit\":5000}'"
      }
    },
    {
      "method": "GET",
      "path": "/api/notion/billing-metrics-sync/overview",
      "description": "Returns scheduler metadata, current active run, and recent run highlights for the portal dashboard."
    },
    {
      "method": "GET",
      "path": "/api/notion/billing-metrics-sync/runs",
      "description": "Lists recent runs with optional status and trigger-source filters."
    },
    {
      "method": "GET",
      "path": "/api/notion/billing-metrics-sync/runs/{runId}",
      "description": "Returns run summary from D1 and item-level status/artifact links."
    },
    {
      "method": "GET",
      "path": "/api/notion/billing-metrics-sync/runs/{runId}/events",
      "description": "Returns the structured event timeline for a run."
    },
    {
      "method": "POST",
      "path": "/api/notion/billing-metrics-sync/runs/{runId}/retry-failed",
      "description": "Re-queues failed items for the run."
    },
    {
      "method": "POST",
      "path": "/api/notion/billing-metrics-sync/runs/{runId}/cancel",
      "description": "Cancels the run and pending items."
    },
    {
      "method": "POST",
      "path": "/api/notion/billing-metrics-sync/runs/{runId}/alerts/resend",
      "description": "Re-sends the failed-run webhook alert for this run."
    }
  ]
}