Upload cost to a custom provider
Create a custom provider and upload cost from any source as FOCUS CSV files, in the console or through the Public API.
A custom provider holds cost that Costfluent does not collect itself: a cloud account it cannot connect to, a SaaS bill, or any other source you can export as FOCUS CSV. You create it with a name, upload files to it, and its cost appears in Cost Reports under that name. There are no credentials and nothing to sync.
If you write FOCUS files to a bucket on S3-compatible storage, Costfluent can read them from the bucket on every sync instead of taking uploads (Connect a FOCUS bucket).
How Costfluent reads an upload
An upload is one run of an export: every file of that run, uploaded together. Costfluent checks every row before it imports any. If a single row is invalid, nothing is imported and the upload fails with a report of its errors.
A completed upload replaces the provider's cost for every day from its first charge to its last, including days inside that range it has no rows for. Uploading the same month again therefore corrects its cost rather than adding to it, and an upload that covers only part of a month leaves the rest of the month alone. The month's usage still counts every upload, a corrected one included (see Limits).
When two uploads cover the same day, the day keeps the one uploaded last, whichever finishes processing first.
Prerequisites
- The Manage integrations capability, which owners and integration owners hold, to create a custom provider and to upload or delete files. Anyone with View integrations can see the uploads; who sees what they billed is under Upload a run.
- Cost in FOCUS columns, as described under File format. Azure, AWS and Google Cloud all offer a FOCUS export.
Connect
Create the provider
- Open Settings, then Integrations, and under Upload files select Custom provider.
- Select New custom provider, on the Manage or the Connect tab.
- Enter a Display name, such as the account or tenant the cost comes from, optionally add a Description, then select Create provider.
The provider's page opens; its address ends with the provider's ID, which starts with prv_. A custom provider counts as a connection like any other, including toward a connection limit set for your organization; no plan limits connections.
Upload a run
- On the provider's page, under Uploads, select Choose files and pick every file of one
export run, as
.csvor.csv.gz. - Select Upload.
The upload is listed as Pending, then Processing, and ends Completed or Failed. A completed upload shows the days it covers and what it billed per currency. Owners, integration owners and the partner that manages the organization see the amounts. Anyone else sees them only when they can view a workspace that reads the whole provider, not just some of its accounts; otherwise Billed shows a dash. Select Download template for a CSV with the common columns and two example rows; the table below lists every column Costfluent reads.
File format
The first row is the header. Columns are matched by name, in any order; columns Costfluent does not
read, including every x_ extension column, are ignored.
| Column | Required | Notes |
|---|---|---|
ChargePeriodStart | yes | YYYY-MM-DD or an ISO 8601 timestamp. |
ChargeCategory | yes | Usage, Purchase, Tax, Credit or Adjustment; Fee, Refund and Discount are also accepted. A Fee is stored as a one-time Purchase, a Discount as a Credit, which Include credits counts, and a Refund as a Usage correction, which Include refunds counts. |
ServiceName | yes | |
BilledCost | yes | |
BillingCurrency | yes | An ISO 4217 code, on every row. |
ChargePeriodEnd | no | Exclusive, as in FOCUS: a charge for 1 September ends on 2 September. Without it a charge lasts one day. |
EffectiveCost | no | Defaults to BilledCost. |
ListCost | no | Defaults to BilledCost. |
ConsumedQuantity, ConsumedUnit | no | A quantity needs its unit. |
ServiceCategory, ServiceSubcategory | no | |
ResourceId, ResourceName, ResourceType | no | |
RegionId, RegionName | no | |
BillingAccountId, SubAccountId, SubAccountName | no | |
SkuId, ChargeDescription | no | |
CommitmentDiscountId, CommitmentDiscountType | no | |
LineItemId | no | Identifies a line across uploads. |
Tags | no | A JSON object of string values, such as {"team":"platform"}. |
Amounts are plain numbers with a dot for decimals, and may use scientific notation such as
1.2E-05. A currency symbol, a thousands separator or a unit makes the row invalid. A timestamp
without a time zone is read as UTC, and one with an offset is converted to UTC, so each charge lands
on its UTC day. Dates must fall between the years 2000 and 2099. A charge that spans several days is spread evenly over them.
Costs stay in the currency each row bills in; reports convert them as they do any other cost.
Data and freshness
Uploads are processed in turn, a few at a time across all organizations, so an upload may stay Pending while others finish. Processing usually takes minutes; the provider's page refreshes until it ends. In Cost Reports the cost appears under the name the provider had when it was uploaded: after a rename, costs already uploaded keep the old name.
Limits
- The files of one upload together: 90 MB as sent, 2 GB once decompressed, and 2,000,000 rows.
- At most 50 files in one upload.
- Your organization has at most 5 uploads waiting or being processed at once, whichever provider they are for; one you delete before it finishes frees its place 5 minutes later. See Rate limits.
- Your organization may have at most 10 uploads in any 10 minutes that have not completed,
counting CSV uploads only. A CSV upload counts from when you send it until it completes, so one
refused once it was unpacked, such as for a differing header or too large decompressed, one
failed in processing and one deleted before it finished keep counting until they are 10 minutes
old. The next is refused with
429until the oldest of them is 10 minutes old. An e-invoice does not count. See Rate limits. - The error report keeps the first 1,000 errors and counts the rest.
- A charge is spread over at most three years; a row with a longer charge period is refused.
- A
POST /v1/custom-providers/{providerId}/costsrequest: at most 7,500 entries and 15 MB, and each entry at most 128 tags. See Rate limits. - Such a request spreads into at most 7,500 daily records, one for each day an entry is spread
over, and its entries spread over several days come to at most 10 MB, each counted once for each
of its days. A request past either is refused whole with
400; split it by period, or upload the costs as a file. - Imported cost counts toward the month's usage as collected cost does, shown under Cost rows this month and Stored provider data this month in Plans and billing: one row for each day a charge is spread over, and the size of its rows. An upload or API request adds all of its size to the month, but only the rows it changes. No plan limits that usage; when a limit is set for your organization, each upload or API request is checked whole against what is left of the month before anything is imported, a new upload of days already imported included.
Upload an Azure export
For an Azure tenant Costfluent cannot connect to, export its cost in FOCUS format and upload it:
- In that tenant's Cost Management, create an export from the Cost and usage (FOCUS) template. Choose CSV with gzip compression, a monthly or a daily month-to-date schedule, and a storage account in the same tenant.
- After a run, download every
part_*.csv.gzfile of that run. The run'smanifest.jsonlists them. - Upload all of them together as one upload.
Azure can split one run into several parts, and a part can hold a single purchase on one day. Upload the parts separately and the second replaces the days of the first, which drops that purchase. A month-to-date upload replaces the days it covers, so upload the closed month again once Azure has finalised it.
Avoid double counting
Cost uploaded here is counted in addition to what your connections collect. Do not upload cost that a connected account already reports. While an account counts twice, Costfluent says so on both connections' pages (Cost counted twice).
Use the Public API
A token holding Manage integrations can do the same through the Public API, as the API reference describes:
POST /v1/providerswithkeyset tocustom, adisplayNameand emptycredentialscreates the provider.POST /v1/custom-providers/{providerId}/uploadstakes the files of one run as repeated multipart fields namedfile, and answers with the pending upload.GET /v1/custom-providers/{providerId}/uploadslists the uploads, andGET /v1/custom-providers/{providerId}/uploads/{uploadId}reads one, with its first errors when it failed. Reading takes View integrations;billedTotalsis null unless the token also holds Manage integrations, or View costs in workspaces that together read the whole provider.DELETE /v1/custom-providers/{providerId}/uploads/{uploadId}deletes an upload.
POST /v1/custom-providers/{providerId}/costs is a different mode: it takes JSON entries checked
by the same rules, with the Sync integrations capability. It adds and corrects lines and removes
none, so it suits a feed of new charges rather than a full export. A later line with the same
lineItemId, day and dimensions corrects the earlier one; lines with different ids add up even when
everything else matches, and a line without an id is matched only against other lines without one,
by day and dimensions. Send replaceLines: true with a request to replace instead, which also takes
Manage integrations, as uploading or deleting files does: each line sent
again under its lineItemId then replaces everything that line held before, on every day, including
days an upload wrote under that id. Lines without an id are never removed. Reuse an id only for the
same charge.
Update or disconnect
Delete an upload from its row under Uploads. Its cost is removed from reports, except on days a later upload replaced, which keep that upload's cost. On days an earlier upload also covers, that upload's cost comes back. Removing the provider with Remove connection in its row's menu on the Manage tab removes all of its cost (Remove a connection).
Troubleshooting
Upload statuses
| Status | Meaning |
|---|---|
| Pending | Received and waiting to be processed. |
| Processing | Being checked and imported. |
| Completed | Every row was imported. |
| Partly imported | Lines that share an identity but disagree were left out, or days that an upload sent later had already replaced; the error report names them. |
| Failed | Nothing was imported. Download the error report, fix the file and upload it again. |
Common errors
- A file is refused when you upload it. It is not
.csvor.csv.gz, the files together are too large, or the parts do not share one header. Upload only the parts of one run. - Missing required columns. The header lacks one of the five required columns.
- An amount is not a number. Remove currency symbols and thousands separators.
- A day holds too many rows. One day of an upload is limited in size; split a very large export by day.
- The upload fails or the request is refused, and nothing is imported. It would take the month past a monthly limit set for your organization, cost ingestion is paused for your organization, or the provider is paused because your organization has more connections than the limit set for it. The message says which; a limit set for your organization names no plan and says to contact us.
- An upload is refused with
429, and nothing is stored. Your organization already has 5 uploads waiting or being processed: upload it again once one of them ends, or delete one that is stuck, which frees its place 5 minutes later. Or your organization's custom providers have imported as many cost records or bytes as they may in a UTC day, uploads and API submissions together: upload it again after midnight UTC. Or your organization has sent 10 uploads in the last 10 minutes that have not completed: fix the files the earlier refusals or error reports name, and upload again after the wait the message gives. The message says which.
Cost counted twice
Cost counted twice on a connection's page means that an account in this provider's uploads is also collected by a connection of another kind, such as an AWS account an AWS connection holds. Its cost then counts twice in every report. The notice names the account and the other connection and links to it, and both connections' pages show it until only one of them carries the account:
- Upload every day that holds the account again, without its rows. An upload replaces the days it covers, so the account's cost on those days leaves this provider.
- Or keep the uploads and remove the other connection, which erases the cost it imported (Remove a connection).