const { result, error } = await unprice.analytics.usage.get({
range: "24h",
customer_id: "cus_1234567890"
});
if (error) {
console.error(error.message);
return;
}
console.log(result);
{
"usage": [
{
"project_id": "project_1234567890",
"customer_id": "cus_1234567890",
"feature_slug": "tokens",
"usage": 30,
"spending": {
"amount": "0.0003",
"currency": "USD",
"display_amount": "$0"
}
}
]
}
Request
The usage window to inspect. Supported values include 24h, 7d, 30d, and 90d.
Optional customer ID to filter usage.
Optional project ID. Only main-project keys can request another project.
Response
Usage data points for the selected range.