Get Usage Record
client.usage.get(stringresourceID, RequestOptionsoptions?): Usage { dimensions, ended_at, project_id, 4 more }
GET/v1/usage/{resource_id}
Get the usage record for a single resource (metadata plus dimension history) for the current organization.
Get Usage Record
import NirvanaLabs from '@nirvana-labs/nirvana';
const client = new NirvanaLabs({
apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});
const usage = await client.usage.get('123e4567-e89b-12d3-a456-426614174000');
console.log(usage.project_id);{
"dimensions": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"dimension": "compute_n1_standard_8",
"ended_at": "2026-02-01T00:00:00Z",
"quantity": 1,
"started_at": "2026-01-01T00:00:00Z",
"children": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"dimension": "compute_vcpu",
"ended_at": "2026-02-01T00:00:00Z",
"quantity": 2,
"started_at": "2026-01-01T00:00:00Z"
}
]
}
],
"ended_at": "2026-02-01T00:00:00Z",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"region": "us-sva-2",
"resource_id": "123e4567-e89b-12d3-a456-426614174000",
"resource_type": "vm",
"started_at": "2026-01-01T00:00:00Z"
}Returns Examples
{
"dimensions": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"dimension": "compute_n1_standard_8",
"ended_at": "2026-02-01T00:00:00Z",
"quantity": 1,
"started_at": "2026-01-01T00:00:00Z",
"children": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"dimension": "compute_vcpu",
"ended_at": "2026-02-01T00:00:00Z",
"quantity": 2,
"started_at": "2026-01-01T00:00:00Z"
}
]
}
],
"ended_at": "2026-02-01T00:00:00Z",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"region": "us-sva-2",
"resource_id": "123e4567-e89b-12d3-a456-426614174000",
"resource_type": "vm",
"started_at": "2026-01-01T00:00:00Z"
}