Token Payment History
Free with bearer tokenGET /api/payment/historyThe /api/payment/history endpoint returns your token's purchase audit trail: every USDC tx that funded credits on this bearer, with amount, credits added, block number, and confirmation timestamp. Pairs with /api/payment/usage (spend side) so an agent can reconcile its full token lifecycle.
When to use this endpoint
When an agent needs to audit how its credits were funded, reconcile on-chain spend against credit additions, or render a deposit history alongside spend history in an internal dashboard.
Example response
{
"ok": true,
"token_short": "tf_live_eb0d0155...",
"current_balance": 49,
"total_purchased_usd": 1.0,
"total_credits_added": 50,
"purchase_count": 1,
"purchases": [
{
"tx_hash": "0xabc...",
"amount_usd": 1.0,
"credits_added": 50,
"block_number": 12345678,
"confirmed_at": "2026-04-27T17:49:32.918Z"
}
]
}Code samples
Python SDK
from tensorfeed import TensorFeed
tf = TensorFeed(token="tf_live_...")
history = tf.payment_history()
for p in history["purchases"]:
print(f"+{p['credits_added']} credits via {p['tx_hash'][:12]}...")TypeScript SDK
import { TensorFeed } from 'tensorfeed';
const tf = new TensorFeed({ token: 'tf_live_...' });
const history = await tf.paymentHistory();
console.log(`${history.purchase_count} purchases totaling $${history.total_purchased_usd}`);FAQ
How far back does the purchase history go?
The ring buffer holds the last 100 purchases per token. At one purchase per token in typical agent usage, that is effectively unbounded; only an agent that repeatedly tops up the same bearer rather than minting fresh tokens would ever roll off the buffer.
What about tokens minted before this ledger existed?
Older tokens still authenticate cleanly and return current_balance, but the purchases array will be empty until a new top-up is recorded. The replay-protection ledger at pay:tx:{txHash} is the authoritative cross-reference if you need to audit a pre-ledger purchase.
Does this cost a credit?
No. /api/payment/history is free for the holder of the bearer token, same as /api/payment/balance and /api/payment/usage.