Retrieving your monthly consumption via the Scaleway API
Follow the procedure below to download your monthly consumption using the Scaleway Billing API and curl
.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account and logged into the console
- Created an API key with sufficient IAM permissions to perform the actions described on this page
- Installed
curl
- Configured your environment variables.
Exporting your environment variables
Open a terminal and run the following command to export your API secret key and Organization ID.
export SCW_SECRET_KEY="<API secret key>"
export SCW_ORGANIZATION_ID="<Scaleway Organization ID>"
Consumption of the current month
Run the following command to obtain your consumption over the current month.
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
"https://api.scaleway.com/billing/v2beta1/consumptions?organization_id=$SCW_ORGANIZATION_ID"
Consumption of a product category
Run the following command to obtain your consumption over the current month for just one category of products.
Specify the target category_name
as one of:
BareMetal
Compute
Containers
Labs
Managed Databases
Managed Services
Network
Object Storage
Observability
Security and Identity
Serverless
Storage
Subscription
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
"https://api.scaleway.com/billing/v2beta1/consumptions?organization_id=$SCW_ORGANIZATION_ID&category_name=Compute"
Consumption of a specific month
Run the following command to obtain your consumption for a specific month.
Specify the target billing period as YYYY-MM
, e.g. 2023-11
.
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
"https://api.scaleway.com/billing/v2beta1/consumptions?organization_id=$SCW_ORGANIZATION_ID&billing_period=2023-11"
Consumption of a specific Project
Run the following command to obtain your consumption for a specific Project only.
First, choose your target project_id
:
export SCW_PROJECT_ID="<Scaleway Project ID>"
Then inject it in your API request:
curl -X GET \
-H "X-Auth-Token: $SCW_SECRET_KEY" \
-H "Content-Type: application/json" \
"https://api.scaleway.com/billing/v2beta1/consumptions?project_id=SCW_PROJECT_ID"