Kredity
Získat využití kreditů
Načtení stránkované historie kreditových transakcí.
GET
/
v1
/
credits
/
usage
const usage = await client.credits.usage({
from: "2025-01-01T00:00:00Z",
to: "2025-03-31T23:59:59Z",
limit: 50,
});
console.log(`Total used: ${usage.total_used} credits`);
for (const tx of usage.data) {
console.log(`${tx.service}: ${tx.amount} credits - ${tx.description}`);
}
usage = client.credits.usage(
from_="2025-01-01T00:00:00Z",
to="2025-03-31T23:59:59Z",
limit=50,
)
print(f"Total used: {usage['total_used']} credits")
for tx in usage["data"]:
print(f"{tx['service']}: {tx['amount']} credits - {tx['description']}")
curl -X GET "https://hub.banditshq.com/api/v1/credits/usage?from=2025-01-01T00:00:00Z&to=2025-03-31T23:59:59Z&limit=50" \
-H "Authorization: Bearer lasso_..."
{
"data": [
{
"id": "tx_abc123",
"service": "enhancement",
"amount": -12,
"table_id": "tbl_xyz789",
"description": "Enhanced 6 rows × description column",
"created_at": "2025-03-10T14:30:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 128
},
"total_used": 3420
}
Query parametry
integer
výchozí:"1"
Číslo stránky pro stránkování.
integer
výchozí:"25"
Počet položek na stránku (max 100).
string
Filtrování transakcí od tohoto data ISO 8601.
string
Filtrování transakcí do tohoto data ISO 8601.
string
Filtrování podle typu služby (např.
extraction, enhancement).Odpověď
array
object
number
Celkový počet spotřebovaných kreditů napříč všemi odpovídajícími transakcemi (nejen aktuální stránka).
const usage = await client.credits.usage({
from: "2025-01-01T00:00:00Z",
to: "2025-03-31T23:59:59Z",
limit: 50,
});
console.log(`Total used: ${usage.total_used} credits`);
for (const tx of usage.data) {
console.log(`${tx.service}: ${tx.amount} credits - ${tx.description}`);
}
usage = client.credits.usage(
from_="2025-01-01T00:00:00Z",
to="2025-03-31T23:59:59Z",
limit=50,
)
print(f"Total used: {usage['total_used']} credits")
for tx in usage["data"]:
print(f"{tx['service']}: {tx['amount']} credits - {tx['description']}")
curl -X GET "https://hub.banditshq.com/api/v1/credits/usage?from=2025-01-01T00:00:00Z&to=2025-03-31T23:59:59Z&limit=50" \
-H "Authorization: Bearer lasso_..."
{
"data": [
{
"id": "tx_abc123",
"service": "enhancement",
"amount": -12,
"table_id": "tbl_xyz789",
"description": "Enhanced 6 rows × description column",
"created_at": "2025-03-10T14:30:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 128
},
"total_used": 3420
}
⌘I
const usage = await client.credits.usage({
from: "2025-01-01T00:00:00Z",
to: "2025-03-31T23:59:59Z",
limit: 50,
});
console.log(`Total used: ${usage.total_used} credits`);
for (const tx of usage.data) {
console.log(`${tx.service}: ${tx.amount} credits - ${tx.description}`);
}
usage = client.credits.usage(
from_="2025-01-01T00:00:00Z",
to="2025-03-31T23:59:59Z",
limit=50,
)
print(f"Total used: {usage['total_used']} credits")
for tx in usage["data"]:
print(f"{tx['service']}: {tx['amount']} credits - {tx['description']}")
curl -X GET "https://hub.banditshq.com/api/v1/credits/usage?from=2025-01-01T00:00:00Z&to=2025-03-31T23:59:59Z&limit=50" \
-H "Authorization: Bearer lasso_..."
{
"data": [
{
"id": "tx_abc123",
"service": "enhancement",
"amount": -12,
"table_id": "tbl_xyz789",
"description": "Enhanced 6 rows × description column",
"created_at": "2025-03-10T14:30:00.000Z"
}
],
"pagination": {
"page": 1,
"limit": 50,
"total": 128
},
"total_used": 3420
}

