Billing

Get sub-resource historical cost datapoints for a VM

Returns sub-resources historical cost datapoints for a VM sub resources for a specified billing cycle. The response includes 'incurred_bill' graph datapoints. Machine sub resources for a specific billing cycle.

get/billing/billing/virtual-machine/{vm_id}/sub-resource/graph

Request

  • Base URL: https://infrahub-api.nexgencloud.com/v1
  • URL: https://infrahub-api.nexgencloud.com/v1/billing/billing/virtual-machine/{vm_id}/sub-resource/graph
  • Auth: API key in header api_key

Path parameters

vm_idinteger required

ID of the vm.

Query parameters

start_datestring required

Date should be formatted in YYYY-MM-DDTHH:MM:SS

end_datestring required

Date should be formatted in YYYY-MM-DDTHH:MM:SS

Response

Success

statusboolean

Whether the request succeeded.

messagestring

Human-readable description of the result.

Example response

{
  "status": true,
  "message": "Billing Details Sub-Resources Historical Cost datapoints for the Virtual Machine Sub Resource Retrieved Successfully.",
  "sub_resources_costs": {
    "org_id": 8429,
    "billing_history": [
      {
        "attributes": {
          "id": "9d8a4f10-2c5d-4b14-8f5a-1e6c8e8b2d3f",
          "infrahub_id": 8429,
          "resource_name": "example-vm"
        },
        "metrics": {
          "gpu_incurred_bill_graph": [
            {
              "datetime": "2026-05-06T15:18:42Z",
              "value": 0.011612903333333001
            }
          ],
          "cpu_incurred_bill": 0.006666666666666,
          "cpu_incurred_bill_graph": [
            {
              "datetime": "2026-05-06T15:18:42Z",
              "value": 0.011612903333333001
            }
          ],
          "ram_incurred_bill_graph": [
            {
              "datetime": "2026-05-06T15:18:42Z",
              "value": 0.011612903333333001
            }
          ],
          "publicip_incurred_bill_graph": [
            {
              "datetime": "2026-05-06T15:18:42Z",
              "value": 0.011612903333333001
            }
          ],
          "disk_incurred_bill_graph": [
            {
              "datetime": "2026-05-06T15:18:42Z",
              "value": 0.011612903333333001
            }
          ],
          "ephemeral_incurred_bill_graph": [
            {
              "datetime": "2026-05-06T15:18:42Z",
              "value": 0.011612903333333001
            }
          ]
        }
      }
    ],
    "total_count": 1,
    "granularity": 86400
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.