{"uid":"cap_NioOEyepVdgtLvReEqLkS","slug":"writerslogic-spend-ledger-8f7c8cd4","name":"WritersLogic Spend Ledger","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/spend-ledger?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"op":{"enum":["open","reserve","commit","release","status"],"type":"string"},"ledger":{"type":"string","pattern":"^[A-Za-z0-9_.:/@+-]{1,200}$","description":"Ledger name, e.g. task:research-42."},"currency":{"type":"string","pattern":"^[A-Z0-9]{2,12}$","description":"open: currency or token code, e.g. USD or USDC."},"tenantId":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$","description":"Required for API-key callers (namespaced as key:<tenantId>; keep it unguessable). Ignored when a wallet paid: the payer address is the tenant."},"requestId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,128}$","description":"Caller-chosen id for this mutation. A retry with the same id and same input returns the stored response (24 h) instead of applying twice; the same id with different input is rejected. Send one on every mutation you may retry: without it a retry is applied again (fleet-memory record appends a duplicate; a repeated spend-ledger commit or release answers NO_HOLD because the first call already took effect)."},"ttlSeconds":{"type":"integer","maximum":86400,"minimum":1,"description":"reserve: hold lifetime; default 600."},"amountMinor":{"type":"integer","maximum":1000000000000000,"minimum":0,"description":"reserve: amount to hold. commit: amount actually spent (at most the hold)."},"budgetMinor":{"type":"integer","maximum":1000000000000000,"minimum":0,"description":"open: total budget in minor units."},"reservationId":{"type":"string","pattern":"^[A-Za-z0-9_.:-]{1,128}$"}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_tqsk9TooeO-8EcwuZQa5t","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Manages a shared budget ledger for a task tree with atomic reserve, commit, and release operations in integer minor currency units","exampleAgentPrompt":"Open a new spend ledger called 'task:research-42' with a total budget of 50000 minor units of USD, then reserve 5000 units for the next subtask with a 10-minute hold.","exampleUseCases":[{"title":"Multi-agent research task budget","prompt":"I'm running a research pipeline with 10 parallel agents all sharing a $50 budget — open a ledger called 'task:pipeline-99' with 5000000 minor units of USDC and have each agent reserve what it needs before starting so they never overspend collectively."},{"title":"Commit actual spend after task completion","prompt":"My agent just finished its subtask and only used 3200 of the 5000 minor units it reserved on ledger 'task:research-42' — commit 3200 as the actual spend and free the rest using reservation ID 'res:worker-7'."},{"title":"Release unused hold on task cancellation","prompt":"The subtask assigned to worker-3 got cancelled before it started, so please release the hold with reservation ID 'res:worker-3' on ledger 'task:pipeline-99' so other agents can use that budget."}],"resultDescription":"Returns the current state of the ledger operation: for 'open', the new ledger details and total budget; for 'reserve', a reservation ID and confirmation that funds are held; for 'commit', the amount recorded as spent; for 'release', confirmation that the hold is freed; for 'status', remaining budget, active holds, and total committed spend.","failureModes":["Insufficient remaining budget causes reserve to fail — returns an error indicating how much is available","Expired reservation ID on commit or release returns not-found or expired error","Duplicate requestId with different input is rejected with a conflict error","Invalid ledger name pattern returns a 400 validation error","TTL exceeds 86400 seconds returns a validation error","Unknown operation enum value returns a 400 bad request","Ledger not found when committing or releasing returns a 404 error"],"whenToPreferThis":"Use this endpoint when multiple AI agents or workers share a single finite budget and you need atomic, race-condition-free spend control — specifically when two parallel workers must not both claim the last available funds. Prefer this over a simple counter or snapshot approach when you need three-phase reserve/commit/release semantics, idempotent retries via requestId, and automatic expiry of stale holds.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-18T00:38:50.879Z","isFirstParty":false,"canonicalSlug":"writerslogic-spend-ledger-8f7c8cd4"}