What you get
- Usage records for each project, database, sandbox and bucket: CPU, memory, volume storage, object storage, backup storage and connection pooling, one record per day.
- Bandwidth as one record per day for the whole account.
- Plan fees and add-ons, tax, discounts and account credit, one record each.
x_Estimated: "true", and the response has complete: false. Ask for the same dates again after the invoice is issued to get the final records.
Create an API key
The export needs an API key with thebilling.read scope. This scope is not part of the read-only preset, so select it explicitly.
- Open API keys in the dashboard. Use your team’s settings for a team key.
- Create a key and select billing.read.
- Copy the key. It is shown once.
Request a window
Send the start and end of the period you want. The end is exclusive, and a window can cover at most 366 days.invoice_id:
How records are dated
A record belongs to the window that contains itsChargePeriodStart. Consecutive windows never repeat a record and never drop one, so you can export day by day or month by month and get the same result.
- A usage record covers one day of one resource.
- A plan fee is dated at the start of the period it pays for.
- Tax, discounts and account credit are dated when the invoice was issued.
What the costs mean
Usage on a finalized invoice is shared across your resources in proportion to what each one used, so the records for an invoice line always add up to that line.
Tags
Each usage record carries tags you can group by.
Sandbox records also carry any labels the sandbox was created with, under the keys you chose.
Send the records to CostGraph
CostGraph accepts FOCUS records over its push API. Create a FOCUS push connection in CostGraph, copy its connection id, and create a CostGraph API key with thefocus:write scope. Then forward a window:
overwrite: true replaces whatever CostGraph already holds for that window, so sending a window again is safe. A good routine is to send yesterday once a day, and send the whole month again after its invoice is issued so estimates are replaced with final records.
Limits
- Bandwidth is measured for the account, not per project.
- Before an invoice is issued, backup storage records show a list cost but a billed cost of zero. They get their final amounts once the invoice is finalized.
- Records are in USD.