Documentation

Billing Integration

ZopNight reconciles its rack-rate cost estimates against your actual cloud invoices by syncing billing data nightly from each connected cloud account. The endpoints on this page let you check sync state, re-trigger a sync, and verify a freshly-connected account.

Why two cost numbers?

ZopNight computes a rack-rate cost from public pricing as soon as a resource is discovered (so you see "this VM costs $X/month" within minutes of connecting). The billing import then overwrites that with the actual invoiced amount once it's available — typically a 24–48 hour lag. See Reports for how the two reconcile.

Org-Wide Sync Status

GET
/billing/sync-status

Returns sync state for every cloud account in the org. Used by the dashboard's billing health badge.

Responsejson
{
  "data": [
    {
      "cloudAccountID": "ca_abc123",
      "provider": "aws",
      "lastSyncedAt": "2026-04-29T05:00:00Z",
      "status": "ok",
      "monthsBackfilled": 13
    },
    {
      "cloudAccountID": "ca_def456",
      "provider": "gcp",
      "lastSyncedAt": "2026-04-25T05:00:00Z",
      "status": "stale",
      "message": "Last successful sync was 4 days ago"
    }
  ]
}
POST
/billing/verify

Trigger an immediate billing sync across all cloud accounts. Returns a job reference; poll /billing/sync-status until the job completes.

Verifying Cloud Accounts

Billing verification is org-wide, not per cloud account. POST /billing/verify kicks off a sync for every connected cloud account in the org. The job runs asynchronously; poll GET /billing/sync-status until each entry in the response is ok. The onboarding wizard uses these same two endpoints — there is no per-account verify route.

The sync confirms the billing export is reachable, schemas match, and a sample of recent records lands cleanly. Failures surface in sync-status with a per-account message.

Historical Backfill

On first connection, ZopNight backfills up to 13 months of billing history if your provider exposes it (AWS Cost & Usage Reports always do; GCP needs the BigQuery billing export enabled; Azure cost exports need to be configured at the subscription level). Backfill is part of the verify job and reports progress via monthsBackfilled in the sync-status response.

See Cloud Accounts for the full onboarding flow including the steps that precede billing verification.