Skip to content

Retrieve Resource Usage Costs

Access comprehensive usage history and cost analytics for all resources, including detailed billing metrics, resource specifications, and temporal utilization data.

HTTP Request

GET {API_URL}billing/resources/usage

Query Parameters

ParameterRequirementTypeDescription
limitOptionalintMaximum number of records to return
offsetOptionalintNumber of records to skip for pagination
sortFieldOptionalstringField identifier for result ordering
sortOrderOptionalstringSort direction: desc (descending) or asc (ascending)
filtersOptionalstringJSON-encoded filter criteria. Format: [{"key":"name","op":"contains","val":"hub"}]

Response Structure

status boolean

Operation result indicator. Returns true for successful execution, false when encountering an error.

message string

Descriptive response indicating the outcome of the usage data retrieval.

total int

Aggregate count of available records.

data object

Collection of resource utilization records containing detailed cost metrics.

Resource Attributes
  • resource Resource specification details
    • id Unique resource identifier
    • name Resource designation
    • display_name User-friendly resource identifier
    • type Resource classification (vm for virtual machine, volume for storage)
  • per_minute_fee Current billing rate (per minute)
  • total_uptime Cumulative resource utilization (minutes)
  • total_fee Aggregate resource cost
  • terminated_time Resource deactivation timestamp
  • created_time Resource initialization timestamp
  • status Current resource state (terminated or active)

Implementation Example

Request

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

Response

json
{
    "status": true,
    "message": "Resource usage data retrieved successfully",
    "data": [
        {
            "id": "66cfe5c06c4817f2124c3998",
            "resource": {
                "id": "66cfe67bbee435f7706bcf4d",
                "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
}