> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upmetr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cost Tracking

> Monitor cloud spending with budgets, forecasts, and per-service breakdowns

Upmetr tracks cloud spending across all your connected accounts, providing cost breakdowns by service and account, monthly forecasting, and budget alerts.

## Cost Overview

The **Costs** page shows:

| Metric             | Description                                           |
| ------------------ | ----------------------------------------------------- |
| **Current Month**  | Total spend so far this month                         |
| **Previous Month** | Last month's total                                    |
| **Forecast**       | Projected month-end spend based on current trajectory |
| **Daily Average**  | Average daily spending this month                     |

## Cost Breakdowns

View costs grouped by:

<Tabs>
  <Tab title="By Service">
    See spending per cloud service (EC2, RDS, S3, Lambda, etc.). Helps identify which services drive the most cost.
  </Tab>

  <Tab title="By Account">
    Compare spending across cloud accounts. Useful for multi-account setups or client billing.
  </Tab>
</Tabs>

Cost data is synced from your cloud provider's billing APIs:

* **AWS** — Cost Explorer API (`ce:GetCostAndUsage`, `ce:GetCostForecast`)
* **GCP** — Cloud Billing API
* **Azure** — Cost Management API
* **DigitalOcean** — Billing API

<Note>
  Cost data may have a **24-48 hour delay** from the cloud provider. This is a provider limitation, not Upmetr.
</Note>

## Budgets

Set spending limits with automated alerts.

### Creating a Budget

1. Navigate to **Costs > Budgets**
2. Click **Add Budget**
3. Configure:

| Field               | Description                                  |
| ------------------- | -------------------------------------------- |
| **Name**            | Budget label (e.g., "Monthly AWS Prod")      |
| **Amount**          | Spending limit in USD                        |
| **Period**          | Monthly, Quarterly, or Yearly                |
| **Alert Threshold** | Percentage to trigger warning (e.g., 80%)    |
| **Account Filter**  | Optionally scope to a specific cloud account |

4. Click **Save**

### Budget Alerts

Budgets trigger alerts at two levels:

| Level        | When                                   | Severity |
| ------------ | -------------------------------------- | -------- |
| **Warning**  | Spending reaches the alert threshold % | Warning  |
| **Critical** | Spending exceeds 100% of the budget    | Critical |

Alerts are sent via your configured notification channels (Slack, email, SMS, webhooks).

### Budget Status

The budgets page shows real-time status for each budget:

* **Remaining amount** — How much budget is left
* **Burn rate** — Current spending velocity
* **Projected overage** — Whether you'll exceed the budget at current pace

## Cost Sync

Upmetr automatically syncs cost data from your cloud providers. You can also trigger a **manual sync** from the Costs page.

Sync frequency depends on your plan:

* **Pro** — Every 6 hours
* **Enterprise** — Every hour

### Manual Sync

Click the **Sync Costs** button on the Costs page to force a re-fetch of cost data from all your connected provider APIs. When triggering a manual sync, you can configure the `days_back` parameter to control how far back to pull data (default: 7 days, max: 365 days).

<Tip>
  Use `days_back=180` to backfill roughly 6 months of historical cost data — useful when connecting a cloud account for the first time.
</Tip>

<Warning>
  Cloud provider billing APIs have an inherent **24-48 hour delay**. A manual sync will not surface today's costs — only data the provider has already finalized.
</Warning>

## Provider Filters

When you have multiple cloud providers connected (AWS, GCP, Azure, DigitalOcean), the Costs page shows a **Cost by Provider** summary card with month-to-date totals per provider.

Use the **Filter by provider** dropdown above the account details table to narrow the view to a single provider. This is useful for:

* Comparing spending across providers
* Isolating costs for a specific cloud environment
* Generating provider-scoped reports for stakeholders

<Note>
  Provider filters only appear when your organization has cloud accounts from more than one provider.
</Note>

## Invoices

Invoices in Upmetr are **billing records you generate for your own clients** — designed for MSPs, agencies, and consultancies who manage cloud infrastructure on behalf of others. Each invoice is tied to a specific cloud account and billing period.

<Warning>
  Invoices are **not** related to Upmetr's billing to your organization. For your Upmetr subscription, see **Settings > Billing**. Invoices here are for tracking what *you* charge *your* clients.
</Warning>

### Invoice Statuses

| Status      | Description                                                                                             |
| ----------- | ------------------------------------------------------------------------------------------------------- |
| **Draft**   | Current month — still accumulating costs. Auto-assigned when generating invoices for the current month. |
| **Pending** | Month has ended, awaiting payment from your client.                                                     |
| **Paid**    | Payment received. The `paid_at` timestamp is set automatically when you mark an invoice as paid.        |
| **Overdue** | Payment past due.                                                                                       |

### Generating Invoices

To generate invoices from your cost data:

1. Navigate to **Costs > Invoices**
2. Click **Generate Invoices**
3. Select the **year** and **month**
4. Choose whether to overwrite existing invoices for that period
5. Click **Generate**

Upmetr creates one invoice per active cloud account, summing all `CostRecord` entries for that month. Accounts with zero cost are skipped.

<Tip>
  Use the **Overwrite existing** option to recalculate invoice amounts after a cost sync brings in updated data from your provider.
</Tip>

### Generate Historical Invoices

Need to backfill invoices for past months? Click **Generate Historical Invoices** to scan all your cost records and create invoices for every month with data.

The status is assigned automatically based on age:

* **Current month** — Draft
* **Last 2 months** — Pending
* **Older than 2 months** — Paid (assumed settled)

<Note>
  Historical generation does not overwrite invoices you've already manually updated. If an invoice exists, only its amount is recalculated — the status is preserved unless it's a Draft for a month that has ended (promoted to Pending).
</Note>

### Managing Invoices

Once invoices are generated, you can:

* **Mark as Paid** — Updates the status and records the payment timestamp
* **Edit amount or notes** — Adjust the total or add context (e.g., "Includes support hours")
* **Delete** — Remove an invoice entirely (admin only)

Invoices support filtering by **cloud account** and **status** for quick lookups.

## Troubleshooting

| Issue                             | Solution                                                                                                                                     |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **No cost data showing**          | Ensure the cloud account has billing permissions (e.g., `ce:GetCostAndUsage` for AWS). Cost data may take 24-48h to appear for new accounts. |
| **Stale data**                    | Click "Sync Costs" for a manual refresh. Check cloud account connection status.                                                              |
| **Budget not alerting**           | Verify the budget threshold percentage and that notification rules include "Budget Threshold" trigger type.                                  |
| **Costs don't match AWS console** | Minor discrepancies are normal due to sync timing. Check the date range matches. Upmetr uses unblended costs by default.                     |
