You may also be interested in the Account API to manage your Projects, and the IAM API to manage users, permissions and API keys in your Organization.
Billing API
Introduction
Scaleway's Billing API provides a quick overview of your cloud consumption and allows you to monitor expenses. Public cloud services follow a 'pay as you go' model, ensuring you pay only for what you use. Some products offer plan options. Your monthly invoice, calculated at month-end based on exact resource usage and may include additional invoices for upfront payments during the month.
You can retrieve the previous api version v2alpha1 here, which allows you to retrieve your invoices and list the discounts applied to your organization.
Concepts and pricing
Scaleway products offer different billing models, with billing cycles by the minute, hour, month or year. For a clear estimate of product prices, visit our pricing page. You'll also find a cost estimator for each product in the console when you order a resource.
Quickstart
-
Configure your environment variables.
NoteThis is an optional step that aims at simplifying your usage of the API.
export SCW_SECRET_KEY="<API secret key>"export SCW_ORGANIZATION_ID="<Scaleway Organization ID>" -
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" -
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" -
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" -
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"
Technical Information
IAM requirements
Keep in mind that:
- You must have appropriate IAM permissions to manage billing. If you are the Owner of the Organization, you will automatically have these permissions. Otherwise, you will need a policy giving you the
BillingManager
permission set. If you were previously a Billing Administrator, you will automatically have been migrated to theBillingAdministrator
group when you activated IAM, which gives you the appropriate permissions. - You only need
BillingReadOnly
permissions to query consumption.
Going further
For more help using Scaleway’s Billing API, check out the following resources:
- Our main documentation
- Our Slack Community
- Our support ticketing system.
Consumption
Consumption reflects the amount of money spent on the products you’ve used. Its monetary value is calculated in real-time, providing an instant overview of your expenses, including any applicable taxes
GET
/billing/v2beta1/consumptions
GET
/billing/v2beta1/taxes
Invoices
Manage your invoices by listing all invoices, filtering them by start_date and invoice_type, each uniquely identified by an ID. Retrieve specific invoices by their IDs, download them for detailed review, and efficiently export all invoices into a comprehensive CSV file, ensuring a streamlined overview of your invoices
GET
/billing/v2beta1/export-invoices
GET
/billing/v2beta1/invoices
GET
/billing/v2beta1/invoices/{invoice_id}
GET
/billing/v2beta1/invoices/{invoice_id}/download
Discounts
Gain simplified access to key information about discounts, including creation dates, and remaining, used, and total values
GET
/billing/v2beta1/discounts