Public cloud services are based on the “pay as you go” model, which means that you only pay for what you use. Your monthly invoice is calculated at the end of each month and based on your hourly resource usage during the month.

With Scaleway’s Billing API, you can manage the billing of your Scaleway cloud services.

Note:

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.

Concepts and pricing

Refer to our Account concepts page to find more information on features like billing alerts, and our dedicated pricing page for full details about the rates applied on each Scaleway product.

Quickstart

  1. Configure your environment variables.

    Note:

    This is an optional step that seeks to simplify 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/v2alpha1/consumption?organization_id=$SCW_ORGANIZATION_ID"
  3. Run the following command to list your invoices.

    curl -X GET \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    -H "Content-Type: application/json" \
    "https://api.scaleway.com/billing/v2alpha1/invoices"

    You should get an output similar to the following one, providing details about your invoices.

    Note:

    This is a response example, the UUIDs displayed are not real.

    {
    "total_count": "1",
    "invoices": [
    {
    "id": "66f588c7-91e9-5ce9-cedb-4733f791cf73",
    "start_date": "2022-03-22T12:34:56.123456Z",
    "issued_date": "2022-03-22T12:34:56.123456Z",
    "due_date": "2022-03-22T12:34:56.123456Z",
    "total_untaxed": {
    "currency_code": "EUR",
    "units": "9",
    "nanos": "360000000"
    },
    "total_taxed": {
    "currency_code": "EUR",
    "units": "9",
    "nanos": "360000000"
    },
    "invoice_type": "periodic",
    "number": "0"
    }
    ]
    }
  4. Run the following command to download an invoice based on its ID.

    Make sure to replace the example ID in the URL with the actual invoice ID you want to download.

    curl -X GET \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    -H "Content-Type: application/json" \
    "https://api.scaleway.com/billing/v2alpha1/invoices/66f588c7-91e9-5ce9-cedb-4733f791cf73/download"
Requirements:

Technical limitations

The following limitations apply to use of the Billing API:

  • 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:

The consumption reflects the amount of money you have spent for the products you have used. The consumption value is monetary and is not computed in real time.

GET
/billing/v2alpha1/consumption

GET
/billing/v2alpha1/invoices
GET
/billing/v2alpha1/invoices/{invoice_id}/download