Skip to content

Retrieve Resource Usage Costs ​

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.

HTTP Request ​

GET {API_URL}billing/resources/usage

Query string parameters ​

ParametersRequirementsTypeDescription
limitOptionalintThe number of items to return
offsetOptionalintThe number of items to skip before starting to collect the result set
sortFieldOptionalstringThe field by which the data will be ordered
sortOrderOptionalstringSorting order: desc、asc
filtersOptionalstringStringified array of filter objects. eg: [{"key":"name","op":"contains","val":"hub"}]

Reponse Attributes ​

status boolean ​

Indicates the result of the request to create virtual machine. true signifies success, while false indicates an error.

message string ​

A description of the status of the request.

total int ​

Total records count

data object ​

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

Child attributes ​
  • resource The info for the resource.
    • id The ID for the resource.
    • name The name for the resource.
    • display_name The display name for the resource.
    • type The type of resource, vm for virtual machine, or volume for storage volumes.
  • per_minute_fee The current billing rate per minute for the resource.
  • total_uptime The total uptime of the resource in minutes.
  • total_fee The total cost incurred by the resource.
  • terminated_time The timestamp when the resource was terminated.
  • created_time The timestamp when the resource was created.
  • status Indicates whether the resource is currently active. terminated indicates that the resource is not active, while active indicates that it is.

Example ​

Request ​

curl -X GET '{API_URL}billing/resources/usage' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'refresh-token: {REFRESH_TOKEN}' \
-H 'Content-Type: application/json'

Response ​

{
    "status": true,
    "message": "Getting resources usage successful",
    "data": [
        {
            "id": "66d0941d2b2a500012c73314",
            "resource": {
                "id": "66d093df2b2a500012c732e8",
                "name": "medical-breakable-pipe",
                "display_name": "TestxA4000",
                "type": "vm"
            },
            "created_time": 1724945437,
            "status": "terminated",
            "terminated_time": 1724982385,
            "total_uptime": 616,
            "total_fee": 3.148992,
            "per_minute_fee": 0.005112
        }
    ],
    "total": 1
}