Skip to main content

Retrieve Usage Costs History

GET https://infrahub-api.nexgencloud.com/v1/billing/billing/usage

Retrieves a history of usage costs and related details for all of your past and present resources. This information includes the details of the resource, the billing costs per minute, the total cost for the resource, and other relevant information.


Parameters


deleted string  optional

Set to true to retrieve inactive resources. Defaults to false for active resources.


environment string or integer  optional

Filter resources by name or ID of the environment.


Attributes


message string

A message describing the status of the request to retrieve usage costs details.


status boolean

Indicates the status of the request to retrieve usage cost details.


data array of objects

An array of objects containing information about the usage costs history for each resource.

Show child attributes
resource_id integer

The ID for the resource.


resource_type string

The type of resource, "vm" for virtual machine, or "volume" for storage volumes.


name string

The name of the resource.


organization_id integer

The unique identifier for the organization to which the resource belongs.


bill_per_minute number or null

The current billing rate per minute for the resource. If the resource has been terminated a null value will be returned.


create_time date-time

The timestamp when the resource was created.


terminate_time date-time

The timestamp when the resource was terminated.


total_up_time number

The total uptime of the resource in minutes.


total_bill number

The total cost incurred by the resource.


active boolean

Indicates whether the resource is currently active. false indicates that the resource is not active, while true indicates that it is.


exclude_billing boolean

Indicates whether the resource is excluded from billing. false indicates that the resource is not excluded, while true indicates that it is.


Example request
curl -X GET "https://infrahub-api.nexgencloud.com/v1/billing/billing/usage" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"
Response
{
"message": "Successful",
"status": true,
"data": [
{
"resource_id": 398,
"resource_type": "vm",
"name": "TestVM",
"organization_id": 29,
"bill_per_minute": null,
"create_time": "2023-08-23T15:36:10",
"terminate_time": "2023-08-23T16:23:10",
"total_up_time": 47.0,
"total_bill": 0.5025967747999994,
"active": false,
"exclude_billing": false
}
]
}

Returns


Returns the status of the request to retrieve usage cost data for your resources where true indicates success, false indicates error. Additionally, the data array containing objects corresponding to resources is provided. Within each data object, information about a resource and its costs are presented, including details such as billing costs per minute, total cost, and other relevant information.



Back to top