Credits
Get credit stats
Retrieve aggregated credit usage statistics for a date range, ready for BI tools like Power BI or Looker.
GET
/
credits
/
stats
const stats = await client.credits.stats({
from: "2025-01-01",
to: "2025-03-31",
});
console.log(`Total spent: ${stats.summary.total_spent} credits`);
for (const m of stats.by_module) {
console.log(`${m.module_key}: ${m.total}`);
}
stats = client.credits.stats(
from_="2025-01-01",
to="2025-03-31",
)
print(f"Total spent: {stats['summary']['total_spent']} credits")
for m in stats["by_module"]:
print(f"{m['module_key']}: {m['total']}")
curl -X GET "https://hub.banditshq.com/api/v1/credits/stats?from=2025-01-01&to=2025-03-31" \
-H "Authorization: Bearer lasso_..."
{
"period": { "from": "2025-01-01", "to": "2025-03-31" },
"summary": {
"total_spent": 4200,
"previous_period_spent": 3800,
"previous_period_change_pct": 10.5,
"monthly_allocation": 50000,
"period_end": "2025-04-18T00:00:00.000Z",
"cost_per_credit": {
"amount": 0.02,
"currency": "EUR",
"monthly_fee": 1000,
"monthly_credits": 50000
}
},
"daily": [
{
"date": "2025-01-01",
"total": 120,
"by_module": { "lasso": 120 },
"by_user": { "5f0e...": 120 }
}
],
"by_module": [{ "module_key": "lasso", "total": 3000 }],
"by_service": [{ "service_type": "ai_field", "total": 1500 }],
"by_user": [{ "user_id": "5f0e...", "total": 800 }],
"lasso": {
"credits_spent": 3000,
"products_enhanced": 450,
"credits_per_product": 6.67,
"by_table": [
{
"table_id": "9b81...",
"name": "Summer catalog",
"total": 800,
"products": 120
}
]
},
"currency_config": {
"monthly_fee_czk": 25000,
"monthly_fee_eur": 1000,
"monthly_credits": 50000,
"auto_eur": false
}
}
Returns spending totals, daily breakdowns, per-module/service/user splits, Lasso table usage, and the company’s money-display configuration for the requested period.
Query parameters
string
required
Start date, inclusive (
YYYY-MM-DD).string
required
End date, inclusive (
YYYY-MM-DD). Must be on or after from, and the range may span at most 1830 days (~5 years).Response
object
Show Summary metrics
Show Summary metrics
number
Total credits spent in the period.
number
Credits spent in the equal-length window immediately before
from.number | null
Percentage change vs. the previous period.
null when the prior window had zero spend (no baseline).number
Monthly credit allocation for the company.
string | null
End of the current billing period (ISO 8601), if known.
array
array
array
array
object
Show Lasso (product extraction) usage
Show Lasso (product extraction) usage
number
Total Lasso credits spent in the period.
number
Sum of the current
total_products across tables that had Lasso usage in the period — a snapshot of table sizes, not a count of products enhanced during the period.number | null
credits_spent / products_enhanced using those snapshot counts.object
For row-level transaction export, use Get credit usage. For the live balance, use Get credit balance.
const stats = await client.credits.stats({
from: "2025-01-01",
to: "2025-03-31",
});
console.log(`Total spent: ${stats.summary.total_spent} credits`);
for (const m of stats.by_module) {
console.log(`${m.module_key}: ${m.total}`);
}
stats = client.credits.stats(
from_="2025-01-01",
to="2025-03-31",
)
print(f"Total spent: {stats['summary']['total_spent']} credits")
for m in stats["by_module"]:
print(f"{m['module_key']}: {m['total']}")
curl -X GET "https://hub.banditshq.com/api/v1/credits/stats?from=2025-01-01&to=2025-03-31" \
-H "Authorization: Bearer lasso_..."
{
"period": { "from": "2025-01-01", "to": "2025-03-31" },
"summary": {
"total_spent": 4200,
"previous_period_spent": 3800,
"previous_period_change_pct": 10.5,
"monthly_allocation": 50000,
"period_end": "2025-04-18T00:00:00.000Z",
"cost_per_credit": {
"amount": 0.02,
"currency": "EUR",
"monthly_fee": 1000,
"monthly_credits": 50000
}
},
"daily": [
{
"date": "2025-01-01",
"total": 120,
"by_module": { "lasso": 120 },
"by_user": { "5f0e...": 120 }
}
],
"by_module": [{ "module_key": "lasso", "total": 3000 }],
"by_service": [{ "service_type": "ai_field", "total": 1500 }],
"by_user": [{ "user_id": "5f0e...", "total": 800 }],
"lasso": {
"credits_spent": 3000,
"products_enhanced": 450,
"credits_per_product": 6.67,
"by_table": [
{
"table_id": "9b81...",
"name": "Summer catalog",
"total": 800,
"products": 120
}
]
},
"currency_config": {
"monthly_fee_czk": 25000,
"monthly_fee_eur": 1000,
"monthly_credits": 50000,
"auto_eur": false
}
}
Errors
| Status | Meaning |
|---|---|
| 400 | Missing/invalid from or to, from after to, or range larger than 1830 days |
| 401 | Invalid or missing API key |
| 500 | Server or database error |
⌘I
const stats = await client.credits.stats({
from: "2025-01-01",
to: "2025-03-31",
});
console.log(`Total spent: ${stats.summary.total_spent} credits`);
for (const m of stats.by_module) {
console.log(`${m.module_key}: ${m.total}`);
}
stats = client.credits.stats(
from_="2025-01-01",
to="2025-03-31",
)
print(f"Total spent: {stats['summary']['total_spent']} credits")
for m in stats["by_module"]:
print(f"{m['module_key']}: {m['total']}")
curl -X GET "https://hub.banditshq.com/api/v1/credits/stats?from=2025-01-01&to=2025-03-31" \
-H "Authorization: Bearer lasso_..."
{
"period": { "from": "2025-01-01", "to": "2025-03-31" },
"summary": {
"total_spent": 4200,
"previous_period_spent": 3800,
"previous_period_change_pct": 10.5,
"monthly_allocation": 50000,
"period_end": "2025-04-18T00:00:00.000Z",
"cost_per_credit": {
"amount": 0.02,
"currency": "EUR",
"monthly_fee": 1000,
"monthly_credits": 50000
}
},
"daily": [
{
"date": "2025-01-01",
"total": 120,
"by_module": { "lasso": 120 },
"by_user": { "5f0e...": 120 }
}
],
"by_module": [{ "module_key": "lasso", "total": 3000 }],
"by_service": [{ "service_type": "ai_field", "total": 1500 }],
"by_user": [{ "user_id": "5f0e...", "total": 800 }],
"lasso": {
"credits_spent": 3000,
"products_enhanced": 450,
"credits_per_product": 6.67,
"by_table": [
{
"table_id": "9b81...",
"name": "Summer catalog",
"total": 800,
"products": 120
}
]
},
"currency_config": {
"monthly_fee_czk": 25000,
"monthly_fee_eur": 1000,
"monthly_credits": 50000,
"auto_eur": false
}
}

