Billing Usage API, gRPC: ConsumptionCoreService.GetBillingAccountUsageReport
Returns aggregated usage report for a single specified billing account,
optionally filtered by clouds, folders, SKUs, labels, and period granularity.
This method provides a comprehensive view of all usage and costs for a specific
billing account, with options to filter data by various entity types and to aggregate
results at different time granularities (daily, monthly, etc.).
Implementation details:
- The report includes the total cost, applied credits (monetary grants, volume incentives, committed use discounts, and free credits), and final expense
- Results can be filtered by cloud IDs, folder IDs, service IDs, SKU IDs, resource IDs, or labels
- All applicable filters from the request will be applied (with AND logic between different filter types)
- Time-based data is grouped according to the specified aggregation period
Error handling:
- Returns INVALID_ARGUMENT if the request parameters fail validation
- Returns UNAUTHENTICATED if the user is not authenticated or the billing account does not exist
- Returns PERMISSION_DENIED if the user lacks required permissions
- Returns INTERNAL for internal server errors
gRPC request
rpc GetBillingAccountUsageReport (UsageReportRequest) returns (BillingAccountUsageReportResponse)
UsageReportRequest
{
"billing_account_id": "string",
"start_date": "google.protobuf.Timestamp",
"end_date": "google.protobuf.Timestamp",
"cloud_ids": [
"string"
],
"folder_ids": [
"string"
],
"service_ids": [
"string"
],
"sku_ids": [
"string"
],
"labels": "map<string, LabelList>",
"resource_ids": [
"string"
],
"aggregation_period": "TimeGrouping"
}
Request for retrieving usage report data.
This message defines the parameters for requesting usage reports across
all ConsumptionCoreService methods. It supports filtering by various
entity types and specifying the time range and aggregation period.
|
Field |
Description |
|
billing_account_id |
string Required field. Required. Billing account identifier. |
|
start_date |
Required field. Required. Inclusive start date for metrics selection (UTC). |
|
end_date |
Required field. Required. Inclusive end date for metrics selection (UTC). |
|
cloud_ids[] |
string Optional. List of cloud IDs to filter the data. |
|
folder_ids[] |
string Optional. List of folder IDs to filter the data. |
|
service_ids[] |
string Optional. List of Service IDs to filter the data. |
|
sku_ids[] |
string Optional. List of SKU (Stock Keeping Unit) IDs to filter the data. |
|
labels |
object (map<string, LabelList>) Optional. Filter by labels: key is label key (e.g., "env", "team", "region"), Example: To filter resources that have either (env=prod OR env=test) AND (team=finance), Note: The filter logic is (value1 OR value2 OR ...) for each key, |
|
resource_ids[] |
string Optional. List of resource IDs to filter the data. |
|
aggregation_period |
enum TimeGrouping Optional. Aggregation granularity for the report, controlling how data points are grouped
This setting affects the time series data returned in the periodic field of each entity.
|
LabelList
Represents a list of label values for filtering or grouping in usage reports.
For example, to filter resources with label key "env" that have value "prod" or "test",
a LabelList with values ["prod", "test"] would be used for the key "env".
|
Field |
Description |
|
values[] |
string List of label values associated with a specific label key. |
BillingAccountUsageReportResponse
{
"currency": "Currency",
"cost": {
"value": "string"
},
"credit_details": {
"credit": {
"value": "string"
},
"monetary_grant_credit": {
"value": "string"
},
"volume_incentive_credit": {
"value": "string"
},
"cud_credit": {
"value": "string"
},
"free_credit": {
"value": "string"
}
},
"expense": {
"value": "string"
},
"entities_data": [
{
"cost": {
"value": "string"
},
"credit_details": {
"credit": {
"value": "string"
},
"monetary_grant_credit": {
"value": "string"
},
"volume_incentive_credit": {
"value": "string"
},
"cud_credit": {
"value": "string"
},
"free_credit": {
"value": "string"
}
},
"expense": {
"value": "string"
},
"billing_account": {
"id": "string",
"name": "string"
},
"periodic": [
{
"cost": {
"value": "string"
},
"credit_details": {
"credit": {
"value": "string"
},
"monetary_grant_credit": {
"value": "string"
},
"volume_incentive_credit": {
"value": "string"
},
"cud_credit": {
"value": "string"
},
"free_credit": {
"value": "string"
}
},
"expense": {
"value": "string"
},
"timestamp": "google.protobuf.Timestamp"
}
]
}
]
}
Response for usage report requests by billing account.
Contains aggregated usage, cost, and credit information for a billing account,
with both summary totals and detailed breakdowns by billing account entity.
The response includes:
- Overall totals for the entire period (cost, credits, expense)
- Entity-level totals for the specified billing account
- Time series breakdown for the billing account according to the requested aggregation period
|
Field |
Description |
|
currency |
enum Currency Currency code (e.g., "RUB", "USD") for all monetary values in the response.
|
|
cost |
Total usage cost for the selected time period. |
|
credit_details |
Total credits (monetary grants, volume incentives, committed use discounts, and free credits) applied in the selected period. |
|
expense |
Total expense (including cost and credit) for the selected time period. |
|
entities_data[] |
BillingAccountUsageReportEntityData Detailed usage and billing data for the specified billing account entity.
|
StringDecimal
StringDecimal representation for financial values
Used to ensure precise handling of monetary values
|
Field |
Description |
|
value |
string String representation of the decimal value to avoid floating-point precision issues |
CreditDetails
Detailed breakdown of credits (discounts, incentives, grants, etc.) applied to an entity.
Credits reduce the effective cost that customers pay for cloud resources.
The 'credit' field is the total amount of credits (the sum of all credit types below).
This breakdown allows for detailed analysis of different discount types affecting billing.
|
Field |
Description |
|
credit |
Total amount of credits (sum of all credit types) applied to the entity. |
|
monetary_grant_credit |
Credits granted as a one-time monetary grant. |
|
volume_incentive_credit |
Credits given as a volume-based incentive. |
|
cud_credit |
Committed Use Discount credits. |
|
free_credit |
Credits provided as part of a 'free' program. |
BillingAccountUsageReportEntityData
Usage and billing data for the billing account entity in the report.
This represents the second level in the response structure hierarchy (entity-level totals),
containing both summary data for the specified billing account across the entire period and a time series breakdown.
|
Field |
Description |
|
cost |
Total cost associated with this billing account. |
|
credit_details |
Total credits (discounts, grants, adjustments) applied to this billing account. |
|
expense |
Total expense (including cost and credit) for this billing account. |
|
billing_account |
Metadata for the specified billing account entity. |
|
periodic[] |
Time series with usage and billing details for each TimeGrouping period (e.g., daily). |
BillingAccount
Represents a billing account entity
|
Field |
Description |
|
id |
string Unique identifier of the billing_account entity. |
|
name |
string Human-readable display name of the billing account. |
UsageReportPeriodicData
Represents usage and billing data for a specific aggregation period (e.g., a single day, month).
This message is part of the third level in the response structure hierarchy, providing the
time series breakdown for entities. It appears in the 'periodic' field of each entity data object,
containing financial metrics for each time interval within the requested date range.
|
Field |
Description |
|
cost |
Cost incurred during this specific period. |
|
credit_details |
Credits applied during this period. |
|
expense |
Total expense (including cost and credit) for this period. |
|
timestamp |
Timestamp indicating the beginning of the TimeGrouping period. |