This page shows you how to use the Cloud Billing Catalog API to:
- Get a list of all public services including relevant metadata about each service.
- Get a list of all public SKUs within a service including:
- Human readable description of the SKU.
- Public pricing of the SKU.
- Regions where the SKU is available for purchase.
- Categorization data about the SKU.
If you have custom contract pricing, you can use the Pricing API to get prices that are applicable to your Cloud Billing account.
Before you begin
Enable the Cloud Billing API.
Calling the Cloud Billing Catalog API requires an API Key. You can find details about API Keys in Using API Keys.
Listing public services from the catalog
In this step you will get a list of all public services including relevant metadata about each service.
The following code snippet lists all public services in the catalog.
Request:
GET https://cloudbilling.googleapis.com/v1/services?key=<var>API_KEY</var>
Response:
{
"services": [
{
"name": "[SERVICE_NAME]",
"serviceId": "[SERVICE_ID]",
"displayName": "[DISPLAY_NAME]",
},
[...]
],
"nextPageToken": "[NEXT_PAGE_TOKEN]"
}
Where:
[SERVICE_NAME]
is the resource name for the service.[SERVICE_ID]
is the identifier for the service.[DISPLAY_NAME]
is the human readable display name for the service.
Results are paginated, and are limited to 5000 SKUs per page. The response
includes a nextPageToken
that you can use to get the next 5000 results.
To fetch the next batch, set pageToken=[NEXT_PAGE_TOKEN]
.
To reduce the number of SKUs per page, set
pageSize=[CUSTOM_PAGE_SIZE]
.
When all items have been listed, no token is returned.
Getting the list of SKUs for a service
The following code snippet lists the SKUs in the catalog for the specified service:
Request:
GET https://cloudbilling.googleapis.com/v1/services/SERVICE_ID/skus?key=<var>API_KEY</var>
Where:
SERVICE_ID
is the identifier of the parent service.
Response:
{
"skus": [
{
"name": "[SKU_NAME]",
"skuId": "[SKU_ID]",
"description": "[SKU_DESCRIPTION]",
"category": {
"serviceDisplayName": "[SVC_DISPLAY_NAME]",
"resourceFamily": "[FAMILY]",
"resourceGroup": "[GROUP]",
"usageType": "[USAGE]",
},
"serviceRegions": [
"[REGION]"
],
"pricingInfo": [
{
"effectiveTime": "[TIME]",
"summary": "[SUMMARY]",
"pricingExpression": {
"usageUnit": "[USAGE_UNIT]",
"usageUnitDescription": "[USAGE_UNIT_DESCRIPTION]",
"baseUnit": "[BASE_UNIT]",
"baseUnitDescription": "[BASE_UNIT_DESCRIPTION]",
"baseUnitConversionFactor": [BASE_CONVERSION_FACTOR],
"displayQuantity": [DISPLAY_QUANTITY],
"tieredRates": [
{
"startUsageAmount": [START_AMOUNT],
"unitPrice": {
"currencyCode": "[CURRENCY_CODE]",
"units": [UNITS],
"nanos": [NANOS],
},
}
],
},
"aggregationInfo": {
"aggregationLevel": enum("[AGGREGATION_LEVEL]"),
"aggregationInterval": enum("[AGGREGATION_INTERVAL]"),
"aggregationCount": [AGGREGATION_COUNT],
},
"currencyConversionRate": [CONVERSION_RATE],
}
],
"serviceProviderName": "[SERVICE_PROVIDER]",
"geoTaxonomy": {
"type": "[TAXONOMY_TYPE]",
"regions": [
"[REGION]"
]
}
}
],
"nextPageToken": "[NEXT_PAGE_TOKEN]"
}
Where:
[SKU_NAME]
is the resource name for the SKU in the formservices/{SERVICE_ID}/skus/{SKU_ID}
.[SKU_ID]
is the unique identifier for the SKU.[SKU_DESCRIPTION]
is a human readable description of the SKU.[SVC_DISPLAY_NAME]
is the display name of the service to which the SKU belongs.[FAMILY]
is the type of product the SKU refers to. For example, "Compute", "Storage", "Network", etc.[GROUP]
is a group classification for related SKUs. For example, "RAM, "GPU", "Prediction", etc.[USAGE]
represents how the SKU is consumed. For example, "OnDemand, "Preemptible, "Commit1Mo", "Commit1Yr", etc.[REGION]
is the list of service regions in which the SKU is offered. For example, "asia-east1".[TIME]
is a timestamp representing the time from which this pricing was effective in the form2014-10-02T15:01:23.045123456Z
.[SUMMARY]
is a human readable summary of the pricing information,[USAGE_UNIT]
is the shorthand for the unit of usage in which the pricing is specified. For example,usageUnit
of "GiBy" means that usage is specified in "Gibibytes".[USAGE_UNIT_DESCRIPTION]
is the unit of usage in human readable form, for example, "Gibibyte".[BASE_UNIT]
is the SKU's base unit, and is the unit used in usage exports. For example,baseUnit
of "By" means the usage is specified in "Bytes".[BASE_UNIT_DESCRIPTION]
is the base unit in human readable form. For example, "byte".[BASE_CONVERSION_FACTOR]
is the conversion factor for converting price per usage_unit to price per base_unit, and converting start_usage amount to start_usage_amount in base_unit. For example, start_usage_amount * base_unit_conversion_factor = start_usage_amount in base_unit.[DISPLAY_QUANTITY]
is the recommended quantity of units for displaying pricing info. When displaying pricing info, it is recommended to display:(unitPrice * displayQuantity) per displayQuantity usageUnit
. This field does not affect the pricing formula and is for display purposes only. For example, if theunitPrice
is "0.0001 USD", theusageUnit
is "GB" and thedisplayQuantity
is "1000", then the recommended way to display the pricing info is "0.10 USD per 1000 GB".[START_AMOUNT]
Usage is priced at the rate only after this amount is consumed. For example, astartUsageAmount
of 10 indicates that the usage will be priced at the price defined below after the first 10usage_units
.[CURRENCY_CODE]
is the three-letter currency code defined as in ISO 4217.[UNITS]
is the whole units of the amount. For example if currencyCode is "USD", then 1 unit is one US dollar.[NANOS]
is the number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If units is positive, nanos must be positive or zero. If units is zero, nanos can be positive, zero, or negative. If units is negative, nanos must be negative or zero.
The cost of the SKU is units + nanos
. For example, a cost of $1.75 is
represented as units=1
and nanos=750,000,000
.
[AGGREGATION_LEVEL]
is the level at which usage is aggregated to compute cost. Valid values are ACCOUNT, PROJECT, and AGGREGATION_LEVEL_UNSPECIFIED.[AGGREGATION_INTERVAL]
is the interval at which usage is aggregated to compute cost. Valid values are DAILY, MONTHLY, and AGGREGATION_INTERVAL_UNSPECIFIED.[AGGREGATION_COUNT]
is the number of intervals to aggregate over. For example, ifaggregationLevel
is "DAILY" andaggregationCount
is 14, aggregation will be over 14 days.[CONVERSION_RATE]
is the conversion rate for currency conversion, from USD to the currency specified in the request. If the currency is not specified this defaults to 1.0.[SERVICE_PROVIDER]
identifies the service provider. This is 'Google' for first party services in Google Cloud Platform.[TAXONOMY_TYPE]
is the type of geographic taxonomy for a SKU:GLOBAL
,REGIONAL
, orMULTI_REGIONAL
.[REGION]
is The list of regions associated with a SKU. This field is empty for Global SKUs since they are associated with all Google Cloudregions.
Results are paginated, and are limited to 5000 SKUs per page. The response
includes a nextPageToken
that you can use to get the next 5000 results.
To fetch the next batch, set pageToken=[NEXT_PAGE_TOKEN]
.
To reduce the number of SKUs per page, set
pageSize=[CUSTOM_PAGE_SIZE]
.
When all items have been listed, no token is returned.
Related information
Pricing and SKU information is also available in the pricing table report or the Cloud Billing pricing export to BigQuery.