# Showback (cost attribution)

> Attribute spend to teams and to cloud tags (including accepted Smart Tags), drill into each one, and track cost per business unit with unit economics.

Source: https://zop.dev/docs/zopnight/reports/showback

---

Showback answers "whose cost is this?" by team, by tag, or both, so every team can see and own its spend. Every report on this page reads from a single attribution table built from your cost records and refreshed whenever billing sync runs, so the Teams and Tags tabs always agree with each other.

![Reports Teams tab showing attribution coverage at 100 percent with all spend attributed to teams, a count of six teams with resource assignments, a daily cost-over-time chart with one line per team plus savings and anomaly series, and the start of the Team Cost Attribution table](https://storage.googleapis.com/zopdev-blog-resources/1/files/originals/20260924/3b92346a-85ed-48e9-a227-5c14f1784e80-showback.png)

*Costs → Reports → Teams: attribution coverage, per-team cost over time, and the team cost attribution table.*

## Before you start

- **Teams with resource assignments**, for team attribution. Manage them under **Governance → Teams**.
- **Tags on your resources**, for tag attribution: native cloud tags or labels, or [Smart Tags](https://zop.dev/docs/zopnight/concepts/smart-tags) values you have accepted.
- **Billing sync, for billed figures.** The attribution table is refreshed whenever billing sync runs. See [Reports overview](https://zop.dev/docs/zopnight/reports/overview#how-it-works) for the two cost sources.

## How it works

You can attribute the same cost record by both team and tag simultaneously; the two dimensions are independent.

| Dimension | What it does | Splitting |
|---|---|---|
| **Team** | Cost flows to the team(s) that own the resource | Cost is **split equally** across owning teams when a resource has more than one. Unattributed resources are tracked separately. |
| **Tag** | Cost flows to each tag key-value pair on the resource | Each tag key-value pair gets the **full resource cost**: no splitting. A resource tagged `env=prod` and `team=alpha` contributes its full cost to both. |

Showback covers attributed spend only: on an organisation with billing connected, the Reports headline also includes billing lines that match no resource, so it can sit above the showback totals by that unattributed remainder.

If you sum tag totals across all keys, you get more than your total spend (a single resource is counted under multiple tags). Sum team totals plus the unattributed bucket and you get the attributed spend; on a rack-rate organisation that matches the cost trend, and with billing connected, the trend is higher by the unattributed remainder.

## Team attribution

The **Teams** tab on the Reports page lists every team with its cost for the selected period, sorted by spend.

Click a team to drill in:

- **By provider**: AWS / GCP / Azure split
- **By resource type**: top resource types in the team's spend
- **Trend chart**: cost over time for the team, with the same granularity controls as the org-wide trend
- **Resources**: paginated list of resources attributed to this team

### How teams get attributed to resources

Team ownership is resolved per resource via the org's team / resource bindings. Resources owned by more than one team have their daily cost **split equally** across the owning teams. Resources with no owning team are tracked separately and surface under **Unattributed teams** on the Sankey overlay and in the team list.

## Tag attribution

The **Tags** tab is the same shape as Teams but keyed on tag key-value pairs. Each row is a flattened `key:value`, such as `env:prod`, `team:alpha`, or `cost-center:engineering`.

![Costs → Reports, Tags tab: a Tag Coverage bar with the attributed spend, a Top Tag Pairs count, a Cost Over Time chart with one line per tag pair and tag, provider, and type filters, and per-tag cards such as env:prod with spend against the last period](https://storage.googleapis.com/zopdev-blog-resources/1/files/originals/20260924/77dc28e1-9526-429f-b8b9-6969965e0c0d-newshowbacktags.png)

*Costs → Reports → Tags: tag coverage, the top tag pairs, cost over time per tag pair, and each pair's spend against the previous period.*

### What gets included

Four sources of tags feed the attribution:

| Source | Where it comes from |
|---|---|
| **AWS tags** | Native EC2/RDS/S3/etc. tags |
| **GCP labels** | Native Compute Engine / GKE labels |
| **Azure tags** | Native VM / Storage / SQL tags |
| **Smart Tags** | ZopNight's policy-derived virtual tags you've explicitly accepted. Pending (not-yet-accepted) values are not included. Smart Tags stay inside ZopNight unless you use **Apply to cloud** to write a value onto the resource. |

Each tag pair records where it came from: **cloud** (a native tag), **auto** (an accepted Smart Tag), **inherited**, or **mixed** when a pair spans more than one source. See [Smart Tags](https://zop.dev/docs/zopnight/concepts/smart-tags).

### Drilling in

Click any tag row to expand:

- All values for that tag key (e.g. expand `env:` to see `env:prod`, `env:staging`, `env:dev`)
- Provider split for that key-value
- Resource-type split for that key-value
- Trend chart for the key-value with provider / type filter dropdowns

### Tag trend (batched)

To compare multiple tag values on the same chart (e.g. `env:prod` vs `env:staging` vs `env:dev`), the trend endpoint accepts multiple `tagKey` / `tagValue` pairs in a single call. The chart renders one line per pair.

**Tip**

Tag keys and values containing slashes need to be base64-encoded in the URL path (`b64.<base64url(raw)>`). Query strings are auto-decoded, so you don't need to encode there. This only matters if you're calling the API directly. The UI handles encoding for you.

## Improve tag coverage

The **Tag Coverage** bar at the top of the Tags tab shows how much of the period's spend is attributed to at least one tag. A low percentage means your attribution is missing context. Two ways to improve it:

1. Tag the resources at the cloud level (Terraform, AWS Resource Tagger, etc.).
2. Define a [tagging policy](https://zop.dev/docs/zopnight/policies/tagging) in **Governance → Policies → Tagging** to derive a consistent virtual tag for untagged resources, then accept the derived values so they count toward attribution. See [Smart Tags](https://zop.dev/docs/zopnight/concepts/smart-tags).

## Unit economics

For costs in business terms (cost per active user, cost per order, cost per 1,000 API requests), define a unit metric and push (or let ZopNight pull) the denominator values.

**Define the unit metric**

  Go to **Costs → Unit Economics** and create a new metric. Set the name (e.g. "Monthly active users"), label, display scale (1 / 100 / 1000), and the source: **CSV upload** or **Pull API**. The Push API below works for any metric you create; it is not a choice in the form.

**Pick the ingest path**

  - **Push API**: `POST /orgs/{orgID}/unit-metric-values/{id}`: your pipeline POSTs `[{date, value}]` daily.
  - **CSV upload**: drag a CSV onto the metric (capped at 1 MB / 5,000 rows).
  - **Pull**: register an HTTPS endpoint + auth + interval. ZopNight fetches it daily at 21:10 UTC, with SSRF guards (no private IPs, no localhost, no link-local, 30s timeout).

**View cost per unit on the Reports trend**

  The trend chart gains a secondary axis showing infra spend per unit (cost ÷ denominator) for each bucket. Zero-denominator buckets are skipped. A server-side average-of-last-N forecast appears when there are enough data points.

### Curated catalogue

Five common metric types are pre-defined: MAU, DAU, API requests, transactions, and signups. Add any of these in one click and configure the ingest path afterwards.

### Test fetch (for pull metrics)

The **Test fetch** button runs the full pull code path synchronously before the cron schedule starts. Use this to verify your endpoint, auth header, and JSON shape before scheduling the cron. This saves you a 24-hour feedback loop.

### Dimensioned unit economics

If the cost numerator is dimensioned (team or tag), the denominator falls back to the org-wide metric series when no dimensioned values exist. So you can ask "cost per MAU for team alpha" without having to push per-team MAU values. Pushing them still gets you a more accurate denominator.

## Endpoint paths

The showback endpoints live under `/reports/*` (not the older `/showback/*` paths). If you have integrations or saved URLs that use `/showback/*`, update them:

- `/reports/teams`, `/reports/teams/:teamId`, `/reports/teams/:teamId/resources`, `/reports/teams/trends`
- `/reports/tags`, `/reports/tags/:tagKey`, `/reports/tags/:tagKey/values/:tagValue/resources`, `/reports/tags/trends`

## Troubleshooting

**Tag totals add up to more than my total spend**

  Expected. Each tag key-value pair gets the full resource cost, so a resource tagged `env=prod` and `team=alpha` is counted under both. Team totals plus the unattributed bucket give the attributed spend.

**Showback totals are lower than the Reports headline**

  With billing connected, the Reports headline also includes billing lines that match no resource. Showback covers attributed spend only, so it sits below the headline by that unattributed remainder.

**Smart Tag values are missing from the Tags tab**

  Only accepted Smart Tag values count. Pending (not-yet-accepted) values are not included; accept them in [Smart Tags](https://zop.dev/docs/zopnight/concepts/smart-tags).

**A pull unit metric has no values**

  Run **Test fetch** on the metric to exercise the full pull path against your endpoint, auth header, and JSON shape. Endpoints on private IPs, localhost, or link-local addresses are refused, and a fetch times out after 30 seconds.

## Next steps

**Smart Tags**

    Derive consistent tags for untagged resources.

**Reports overview**

    Billed cost, rack rate, and reconciling to the invoice.

**Cost graph**

    How each resource-day of spend is attributed.

**Cost anomalies**

    Catch team, account, and resource spikes before the bill.
