Prerequisites
To follow the steps below using the API, your user must be assigned the Account Admin role.
Pagination
Note that results of some endpoints are paginated. To see next pages, use the last cursor from the previous result as a page.after filter, and a page.first filter to specify a quantity of results per page. page.first can be omitted, and then the default value will be applied.
Calls
In the arguments below, you will see values wrapped in <> - these are placeholders for your specific parameters.
1: Login
Authenticating with the Firebolt REST API requires retrieving an access token using the auth
endpoint.
curl --location --request POST 'https://api.app.firebolt.io/auth/v1/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"password": "<your password>",
"username": "<your username>"
}'
2: Get Account ID by name
Most of the endpoints used in the next steps use account ID - to get account ID by name, run the following request:
curl --location --request GET 'https://api.app.firebolt.io/iam/v2/accounts:getIdByName?account_name=<your account name> \
--header 'Authorization: Bearer <token>'
Get Costs per day (compute / storage)
Use the following endpoint to filter for costs within a specific date range, whether usage was credited or not.
Available filters are:
filter.is_credit_eq - return only credited (true) or not credited usage (false)
filter.report_time_gte - start timestamp of the date range you are interested in
filter.report_time_lte - end timestamp of the date range you are interested in
Note: Timestamps are in ISO-8601 format (e.g. 2023-01-01T00:00:00Z)
The request is:
curl --location --request GET 'https://api.app.firebolt.io/aws/v2/accounts/<your account id>/marketplaceCosts?filter.is_credit_eq=<true/false>&filter.report_time_gte=<start timestamp>&filter.report_time_lte=<end timestamp>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>'
Among the returned fields are:
compute_costs - shows compute usage in USD
storage_costs - shows storage usage in USD
is_credit - shows whether usage was credited or not
report_time - shows the end timestamp in ISO-8601 format (e.g. 2023-01-02T00:00:00Z timestamp returned means that usage is between 2023-01-01T00:00:00Z and 2023-01-02T00:00:00Z).
Results are paginated.
Get Compute costs per engine
Use the following endpoint to filter costs per a specific date range, and per a specific engine.
Available filters are:
filter.engine_name_in - name of an engine you are interested in - several can be used, each should be provided as a separate query parameter
filter.engine_id_in - ID of an engine you are interested in - several can be used, each should be provided as a separate query parameter
filter.timeframe.start_time- start timestamp of the date range you are interested in
filter.timeframe.end_time - end timestamp of the date range you are interested in
Note: Timestamps are in ISO-8601 format (e.g. 2023-01-01T00:00:00Z)
order_by - specify COMPUTE_METRIC_ORDER_START_TIME_ASC
curl --location --request GET 'https://api.app.firebolt.io/aws/v2/accounts/<your account id>/metrics/compute?filter.timeframe.start_time=<start timestamp>&filter.timeframe.end_time=<end timestamp>&filter.engine_name_in=<engine name>&filter.engine_name_in=<engine name>&order_by=COMPUTE_METRIC_ORDER_START_TIME_ASC' \
--header 'Authorization: Bearer <token>'
Among the returned fields are:
engine_id - ID of an engine
engine_name - engine name
start_time - start timestamp of an engine. If an engine is running several days, uptime is split at the UTC start of a day
end_time - final stop event timestamp of an engine
costs - costs related to engine uptime
Results are paginated.
Postman collection
These same calls can be done through the postman tool.
You can find the Firebolt Billing Costs Analysis Postman collection here: Firebolt Billing Costs Analysis.postman_collection.json
Here are also some Postman tool tutorials that may be helpful:
- Getting started
- Collection import
- Requests usage
- Variables