All docs

Usage & Metering

Read your organization's credit balance and transaction ledger over the API

Every metered operation in graph8 (enrichment, AI calls, dialer minutes, sends, …) draws down your organization’s credit balance. The Usage API lets you read that balance and the full transaction ledger programmatically — so you can build budget alerts, cost dashboards, or reconcile spend without leaving your own tooling.

All endpoints are authenticated with an org API key: Authorization: Bearer <api_key>. They are read-only.


Get current balance

GET /usage

Returns the organization’s credit balance, held credits, available credits, and lifetime totals.

cURL

curl "https://be.graph8.com/api/v1/usage" \
  -H "Authorization: Bearer $API_KEY"

Python

import requests

resp = requests.get(
    "https://be.graph8.com/api/v1/usage",
    headers={"Authorization": f"Bearer {API_KEY}"},
)
balance = resp.json()["data"]
print(balance["available_credits"])

TypeScript

const resp = await fetch("https://be.graph8.com/api/v1/usage", {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const { data } = await resp.json();
console.log(data.available_credits);

Response

{
  "data": {
    "customer_id": "org_aBc123",
    "credits": 10000,
    "held_credits": 150,
    "available_credits": 9850,
    "total_earned": 50000,
    "total_used": 40000
  }
}
FieldDescription
creditsTotal credit balance
held_creditsCredits reserved by in-flight holds (e.g. dialer minutes)
available_creditsSpendable now (creditsheld_credits)
total_earned / total_usedLifetime totals

List transactions

GET /usage/transactions

Returns the credit-transaction ledger, most recent first, paginated.

Query parameters

ParamDefaultDescription
page1Page number (1-indexed)
limit50Items per page (max 200)

cURL

curl "https://be.graph8.com/api/v1/usage/transactions?page=1&limit=50" \
  -H "Authorization: Bearer $API_KEY"

Python

import requests

resp = requests.get(
    "https://be.graph8.com/api/v1/usage/transactions",
    headers={"Authorization": f"Bearer {API_KEY}"},
    params={"page": 1, "limit": 50},
)
body = resp.json()
for tx in body["data"]:
    print(tx["created_at"], tx["service"], tx["amount"])
print("more pages:", body["pagination"]["has_next"])

TypeScript

const resp = await fetch(
  "https://be.graph8.com/api/v1/usage/transactions?page=1&limit=50",
  { headers: { Authorization: `Bearer ${apiKey}` } },
);
const body = await resp.json();
for (const tx of body.data) console.log(tx.created_at, tx.service, tx.amount);

Response

{
  "data": [
    {
      "id": "9f2c…",
      "type": "usage",
      "amount": -10,
      "service": "ai_enrichment",
      "quantity": 1,
      "llm_tier": "g8_t2",
      "description": "Bulk enrichment",
      "created_at": "2026-06-29T12:00:00Z"
    }
  ],
  "pagination": { "page": 1, "limit": 50, "total": 1240, "has_next": true }
}
FieldDescription
amountCredit delta — negative = spend, positive = top-up/grant
serviceThe service charged (e.g. ai_enrichment, dialer, web_visitor). Group by this for a per-feature cost breakdown.
llm_tierg8_t1 / g8_t2 / g8_t3 when the charge was an LLM call
typeTransaction type (usage, purchase, …)

Errors

Failures return the standard error envelope with a request_id. A 404 means the org has no credit customer record yet (no usage incurred).

Build with graph8