Retrieve Billing Rate for Resource
GET https://infrahub-api.nexgencloud.com/v1/pricebook/calculate/resource/{resource_type}/{resource_id}
Retrieve a detailed breakdown of hourly billing costs for a specific resource by including the resource type and ID in the path. Resource types include instance
(virtual machine), volume
, container
, or cluster
. The billing cost information returned by this API includes the status of the resource, the total hourly price for the resource, and the pricing for each component before and after any discounts are applied.
Path parameters
resource_type string
Required
The type of resource for which to retrieve billing rate. Which can be one of the following: instance
(virtual machine), volume
, container
, or cluster
.
resource_id integer
Required
The unique identifier of the resource for which to retrieve billing rates.
Attributes
status boolean
Indicates the success status of the API response.
message string
A message describing the result of the API request.
calculated_resource_bills object
Contains detailed billing information for a specified resource.
Click here to see child attributes
org_id integer
The ID of the organization associated with the resource.
resource object
Contains details about the resource and its billing rate calculations.
Click here to see child attributes
type string
The type of the resource, which can be one of the following: vm (virtual machine), volume, container, or cluster.
name string
The name of the resource.
infrahub_id integer
A unique identifier for the resource within the Infrahub API.
status string
The current status of the resource (e.g., "ACTIVE
").
host string
The host where the resource is run.
price float
The listed price per hour for using the resource.
actual_price float
The actual price per hour after applying any discounts or adjustments.
resources array
A list of resource components associated with the main resource, detailing individual billing rates.
Click here to see child attributes
type string
The type of the sub-resource (e.g., "gpu, ram, publicip").
name string
The name of the resource component.
amount integer
The quantity of the resource component being billed.
rate float
The standard billing rate per hour for a single resource component e.g. 1 GPU.
discounted_rate float
The billing rate per hour after applying discounts.
price float
The total hourly price for the component resource, calculated by multiplying the number of components by the standard rate.
actual_price float
The total hourly price for the resource components after discounts.
curl -X GET "https://infrahub-api.nexgencloud.com/v1/pricebook/calculate/resource/{resource_type}/{resource_id}" \
-H "accept: application/json"\
-H "api_key: YOUR API KEY"
{
"status": true,
"message": "Getting resource bill success",
"calculated_resource_bills": {
"org_id": 3961,
"resource": {
"type": "vm",
"name": "example-vm",
"infrahub_id": 57692,
"status": "ACTIVE",
"host": "nga6-141",
"price": 1.2,
"actual_price": 1.2,
"resources": [
{
"type": "gpu",
"name": "RTX-A4000",
"amount": 4,
"rate": 0.3,
"discounted_rate": 0.3,
"price": 1.2,
"actual_price": 1.2
},
{...}
]
}
}
}
Returns
The billing cost information returned by this API includes the status of the resource, the total hourly price for the resource, and the pricing for each component before and after any discounts are applied. See attributes for more details.