Spend API
Read balances, agents, holds and payment history for any KryptWarden wallet.
Base URL: https://api.kryptwarden.xyz
The indexer polls Soroban RPC for wallet events every 4 seconds and stores them. Every /wallets/:wallet/... read also triggers a sync for that wallet first, so results are current. A wallet starts being tracked the first time you ask for it.
GET /wallets/:wallet/overview
Everything the dashboard's Overview page needs, in one call.
curl https://api.kryptwarden.xyz/wallets/CBRSOOZPMVB3SX6LPRG6ESCRBOPP6G4OZHVIQUNCVRQPNMCUE5BB4NVO/overviewinterface WalletOverview {
walletAddress: string;
ownerAddress: string | null;
paused: boolean;
walletBalanceUsdc: string;
unreservedBalanceUsdc: string;
pendingApprovalsCount: number;
reconciliation: ReconcileReport;
agents: Agent[];
holds: Hold[]; // live, from the contract
recentPayments: LedgerItem[]; // latest 50
}
interface Agent {
agentPublicKey: string;
agentKeyHex: string;
name: string; // from metadata, else "Agent GABC12..."
purpose: string;
status: "Active" | "Paused" | "Revoked" | "Expired";
rawStatus: "Active" | "Paused" | "Revoked";
isExpired: boolean;
policyVersion: number;
dailyBudgetUsdc: string; dailyBudgetStroops: string;
autoApproveLimitUsdc: string; autoApproveLimitStroops: string;
spentTodayUsdc: string; spentTodayStroops: string;
reservedHoldsUsdc: string; reservedHoldsStroops: string;
remainingBudgetUsdc: string; remainingBudgetStroops: string;
expiresAt: number;
approvalTimeoutSecs: number;
allowedSellers: { address: string; displayName: string }[];
}400 if :wallet isn't a valid C… address.
GET /wallets/:wallet/ledger
Payment history, newest first, up to 200 items.
| Query | Example | Filters by |
|---|---|---|
agent | G… | Agent public key |
seller | G… | Seller address |
status | Settled, Rejected, all | Decision |
curl "https://api.kryptwarden.xyz/wallets/CBRSOOZPMVB3SX6LPRG6ESCRBOPP6G4OZHVIQUNCVRQPNMCUE5BB4NVO/ledger?status=Rejected"{
"items": [
{
"id": "44b5aaef…4696:0025858786908504064-0000000000",
"agentPublicKey": "GC72VNLHJHRLYIP3S5M73YZ3YMNYLEU6C4Z6BZDF2SNEKTPDFDCZ733W",
"agentName": "Agent GC72VN...",
"sellerAddress": "GCR2AFLRWQW5JWUZEQECG7E3YKIWZIOTB6XGCPHXOP2N2E4PYUWJLL63",
"sellerDisplayName": "scrape.xyz",
"paymentMethod": "x402",
"amountStroops": "1000000",
"amountUsdc": "0.10",
"decision": "Rejected",
"reason": "Seller not allowed",
"holdId": null,
"policyVersion": 1,
"txHash": "44b5aaef…4696",
"explorerUrl": "https://stellar.expert/explorer/testnet/tx/44b5aaef…4696",
"eventId": "0025858786908504064-0000000000",
"ledgerSeq": 6020718,
"timestamp": 1796127236
}
]
}decision | reason values |
|---|---|
Settled | Auto-approved, Owner approved, Owner withdrawal |
Rejected | Seller not allowed, Would exceed daily budget, Agent paused or revoked, Agent past expiry, Approval timeout expired, Wallet emergency paused |
Owner withdrawals appear as Settled rows with agentPublicKey: "OWNER_WITHDRAW".
GET /wallets/:wallet/holds
Holds read live from the contract.
{
"holds": [
{
"id": 7,
"agentPublicKey": "G…",
"agentName": "Research Agent",
"sellerAddress": "GB2TWY2XJE5OY33VPOQSOY6IDJ7OOUO6ZKAIAOHOJNTXIG3CAJ4ROORF",
"sellerDisplayName": "data.demo",
"amountStroops": "30000000",
"amountUsdc": "3.00",
"status": "Pending",
"createdAt": 1796127000,
"expiresAt": 1796127600,
"secondsLeft": 412,
"policyVersion": 1
}
]
}status is one of Pending, Approved, Denied, Consumed, Expired, Cancelled. To approve or deny, the owner signs a contract call; see Approve and control.
GET /wallets/:wallet/reconcile
Compares each agent's spend today on-chain (get_agent_summary) with what the indexer recorded.
interface ReconcileReport {
walletAddress: string;
matched: boolean; // true when every agent matches
checkedAt: string; // ISO 8601
walletBalanceUsdc: string;
unreservedBalanceUsdc: string;
paused: boolean;
ownerAddress: string | null;
agents: {
agentPublicKey: string;
onChainSpentTodayUsdc: string;
indexedSpentTodayUsdc: string;
matched: boolean;
deltaStroops: string;
}[];
}POST /wallets/track
Start tracking a wallet and sync it now. Reading any wallet endpoint does this too.
curl -X POST https://api.kryptwarden.xyz/wallets/track \
-H "Content-Type: application/json" \
-d '{"walletAddress":"C..."}'201 { "tracked": true, "walletAddress": "C…" }, or 400 for an invalid address.
PUT /wallets/:wallet/agents/:agent/metadata
Set display labels. Labels live only in the indexer and never affect the contract.
{
"name": "Research Agent",
"purpose": "Buys search and datasets",
"sellerAliases": { "GB2TWY2XJE5OY33VPOQSOY6IDJ7OOUO6ZKAIAOHOJNTXIG3CAJ4ROORF": "data.demo" }
}| Field | Rules |
|---|---|
name | Required, 1–80 characters |
purpose | Optional, up to 240 characters |
sellerAliases | Optional map of G… address → display name |
200 { "updated": true }, or 400 with the validation message.
GET /health
{
"service": "kryptwarden-indexer-and-spend-api",
"status": "healthy",
"rpcUrl": "https://soroban-testnet.stellar.org",
"usdcSacAddress": "CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA"
}