NavigationContentFooter

Billing API

Download (.yml, 40KB)

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.

Note

You may also be interested in the to manage your Projects, and the to manage users, permissions and API keys in your Organization.

Tip

You can retrieve the previous api version , 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 . You'll also find a cost estimator for each product in the console when you order a resource.

Quickstart

  1. Configure your environment variables.

    Note

    This 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>"
  2. 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"
  3. 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"
  4. 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"
  5. 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 the BillingAdministrator 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
  • Our
  • Our .

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
© 2023-2024 – Scaleway