-
Notifications
You must be signed in to change notification settings - Fork 276
feat(bill): add finops api info MTA-7172 #6537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d758cab
feat(bill): add finops api info MTA-7172
vanda-scw c43a5c9
feat(bill): add finops api info MTA-7172
vanda-scw cdd3b86
feat(bill): add finops api info MTA-7172
vanda-scw 42a9fcd
feat(bill): add finops api info MTA-7172
vanda-scw 288903a
feat(bill): add finops api info MTA-7172
vanda-scw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| title: Retrieving your FinOps data via the Scaleway API | ||
| description: Retrieve your FinOps data in the form of "Charges" via the Scaleway API. | ||
| tags: finops charges billing consumption report api export | ||
| dates: | ||
| validation: 2026-05-29 | ||
| posted: 2026-05-29 | ||
| --- | ||
| import Requirements from '@macros/iam/requirements.mdx' | ||
|
|
||
|
|
||
| ## Difference between FinOps API data and Consumption API data | ||
|
|
||
| The Consumption API allows you to get the data used in your invoice, whereas the FinOps API enables you to retrieve raw consumption data generated by the usage of Scaleway resources. | ||
|
|
||
| The FinOps API might show slight differences with the consumption/billing data if you try to reconcile both. This is due to the fact that FinOps data is calculated differently from consumption data. The differences in how the data is rounded and aggregated might result in small cost discrepancies when comparing both data sources. | ||
|
|
||
| ## Availability of `resource_name` | ||
|
|
||
| The `resource_name` is only available if the related product had the transfer of this information enabled in the backend when creating the resource. | ||
|
|
||
| ## Pagination | ||
|
|
||
| The API uses pagination to split a large set of results into smaller, manageable pages that can be retrieved one at a time. | ||
|
|
||
| - The response includes a `next_page_token` whenever additional items are available. | ||
| - To retrieve the next page, pass that token in the subsequent request. | ||
|
|
||
| ## Clamping: retrieving partial charges for a selected period | ||
|
|
||
| Clamping automatically cuts a charge that spans a longer period (e.g. the whole month) into the exact slice that falls inside the time window you asked for. | ||
|
|
||
| When you set `"clampToTimeRange": true`, the API returns a partial charge that represents only the portion of the resource’s usage that overlaps with your requested dates. | ||
|
|
||
| When you set `"clampToTimeRange": false`, the API only returns charges whose entire start‑ and end‑dates are inside the requested window. When a charge starts before the window (or ends after it), the result is empty. | ||
|
|
||
| Follow the procedure below to download your FinOps data using the Scaleway [Billing - FinOps API](https://www.scaleway.com/en/developers/api/billing/finops) and `curl`. | ||
|
|
||
| <Requirements /> | ||
|
|
||
| - A Scaleway account logged into the [console](https://console.scaleway.com/organization) | ||
| - Created an [API key](/iam/how-to/create-api-keys/) with sufficient [IAM permissions](/iam/reference-content/permission-sets/) to perform the actions described on this page | ||
| - [Installed `curl`](https://curl.se/download.html) | ||
| - Configured your environment variables | ||
|
|
||
| ## Export your environment variables | ||
|
|
||
| <Message type="note"> | ||
| This is an optional step that aims at simplifying your usage of the API. | ||
| </Message> | ||
|
|
||
| Open a terminal and run the following command to export your API secret key and Organization ID. Remember to replace the placeholders with your own corresponding values. | ||
|
|
||
| ```bash | ||
| export SCW_SECRET_KEY="<API secret key>" | ||
| export SCW_ORGANIZATION_ID="<Scaleway Organization ID>" | ||
| ``` | ||
|
|
||
| ## Retrieve charges for a specific resource between two dates | ||
|
|
||
| Run the following command to obtain detailed charges for a specific resource between two dates. Remember to replace the resource identifier and date placeholders with your own corresponding values. | ||
|
|
||
| ```bash | ||
| curl -X GET \ | ||
| -H "X-Auth-Token: $SCW_SECRET_KEY" \ | ||
| -H "Content-Type: application/json" \ | ||
| "https://api.scaleway.com/billing/v2beta1/charges?organization_id=$SCW_ORGANIZATION_ID&resourceIds=YourResourceId&startDateAfter=2026-05-26T00:00:00.000000000Z&endDateBefore=2026-05-30T00:00:00.000000000Z" | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.