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

# Custom Billing Format (FOCUS) in BigQuery

> Import any FOCUS-compliant billing data from a BigQuery table into Costory.

Import any billing data that follows the [FOCUS specification](https://focus.finops.org/) from a BigQuery table. This is useful for SaaS vendors or internal services that are not natively supported.

> [accordion] Importable Columns
>
> | Mapping Key | Output Column | Type | Default | Status |
> | - | - | - | - | - |
> | `billedCost` | `billed_cost` | FLOAT64 | NULL | Optional |
> | `contractedCost` | `contracted_cost` | FLOAT64 | NULL | Optional |
> | `billingAccountId` | `billing_account_id` | STRING | NULL | Optional |
> | `billingCurrency` | `billing_currency` | STRING | NULL | Optional |
> | `originalBillingCurrency` | `original_billing_currency` | STRING | NULL | Optional |
> | `billingPeriodEnd` | `billing_period_end` | DATETIME | NULL | **Required** |
> | `billingPeriodStart` | `billing_period_start` | DATETIME | NULL | **Required** |
> | `chargeCategory` | `charge_category` | STRING | NULL | **Required** |
> | `chargeDescription` | `charge_description` | STRING | NULL | Optional |
> | `chargeFrequency` | `charge_frequency` | STRING | NULL | Optional |
> | `chargePeriodStart` | `charge_period_start` | TIMESTAMP | NULL | Optional |
> | `chargePeriodEnd` | `charge_period_end` | TIMESTAMP | NULL | Optional |
> | `commitmentDiscountCategory` | `commitment_discount_category` | STRING | NULL | Optional |
> | `commitmentDiscountId` | `commitment_discount_id` | STRING | NULL | Optional |
> | `commitmentDiscountType` | `commitment_discount_type` | STRING | NULL | Optional |
> | `consumedQuantity` | `consumed_quantity` | FLOAT64 | NULL | Optional |
> | `consumedUnit` | `consumed_unit` | STRING | NULL | Optional |
> | `effectiveCost` | `effective_cost` | FLOAT64 | NULL | Optional |
> | `invoiceIssuer` | `invoice_issuer` | STRING | NULL | Optional |
> | `listCost` | `list_cost` | FLOAT64 | NULL | Optional |
> | `listUnitPrice` | `list_unit_price` | STRING | NULL | Optional |
> | `pricingCategory` | `pricing_category` | STRING | NULL | Optional |
> | `pricingQuantity` | `pricing_quantity` | FLOAT64 | NULL | Optional |
> | `pricingUnit` | `pricing_unit` | STRING | NULL | Optional |
> | `provider` | `provider` | STRING | `"Custom BigQuery"` | Optional |
> | `publisher` | `publisher` | STRING | NULL | Optional |
> | `regionId` | `region_id` | STRING | NULL | Optional |
> | `resourceId` | `resource_id` | STRING | NULL | Optional |
> | `resourceName` | `resource_name` | STRING | NULL | Optional |
> | `resourceType` | `resource_type` | STRING | NULL | Optional |
> | `categoryFocus` | `category_focus` | STRING | NULL | Optional |
> | `serviceName` | `service_name` | STRING | NULL | Optional |
> | `skuId` | `sku_id` | STRING | NULL | Optional |
> | `sku` | `sku` | STRING | NULL | Optional |
> | `skuPriceId` | `sku_price_id` | STRING | NULL | Optional |
> | `subAccountId` | `sub_account_id` | STRING | NULL | Optional |
> | `tags` | `labels` | ARRAY\<STRUCT\<key STRING, value STRING>> | NULL | Optional |

> [tab] Terraform
>
> To install and authenticate the provider, see [Terraform setup](https://docs.costory.io/setup/terraform.md).
>
> In Terraform, the `mapping` keys use snake\_case (`billed_cost`, `service_name`, ...) and `billed_cost` is required. Full list: [Registry](https://registry.terraform.io/providers/costory-io/costory/latest/docs/resources/billing_datasource_custom_bigquery).
>
> ```hcl theme={null}
> terraform {
>   required_providers {
>     costory = {
>       source  = "costory-io/costory"
>       version = ">= 0.1.0"
>     }
>   }
> }
>
> variable "costory_api_token" {
>   type        = string
>   description = "Costory API token."
>   sensitive   = true
> }
>
> provider "costory" {
>   token = var.costory_api_token
> }
>
> resource "costory_billing_datasource_custom_bigquery" "main" {
>   name          = "Custom BigQuery Billing"
>   bq_table_path = "my-project.custom.costs"
>   provider_name = "acme"
>
>   mapping = {
>     billed_cost  = "cost"
>     service_name = "sku"
>   }
> }
> ```

> [tab] Manual setup
>
> Open Costory and go to **Billing > Import new billing datasource > Custom Billing Format (FOCUS)**. The stepper guides you through each field.
>
> 1. Prepare a BigQuery table in FOCUS format.
> 2. Provide the BigQuery table path, provider name, and optional billing account ID and date range.
> 3. Map the FOCUS columns to Costory fields during the import flow.
>
> Costory imports whatever date range exists in the BigQuery table. No separate backfill step is needed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.