Spend
AgentPay records each successful payment as a spend event. Events are scoped to the API key that made the payment and include the amount, currency, and the URL that was paid. You can list events via the API or view them in the dashboard to audit spend and attribute costs.
List spend events
Send GET /v1/spend with your API key. Optionally include a limit query parameter (default 100, max 500) to control how many events are returned. Events are returned in reverse chronological order (newest first).
GET /v1/spend?limit=100
X-Api-Key: pk_...
# Response 200
{
"events": [
{
"id": "uuid",
"amount": "1000000",
"currency": "USDC",
"request_url": "https://paid-api.example/resource",
"created_at": "2025-03-06T..."
}
]
}Event fields
- id — Unique identifier for the event.
- amount — Amount in the smallest unit (e.g. USDC with 6 decimals).
- currency — Asset identifier (e.g.
USDC). - request_url — The URL that was paid (the request that triggered the 402 and subsequent payment).
- created_at — Timestamp when the payment was recorded.
Use cases
- Audit and compliance — See exactly which endpoints were paid and when.
- Cost attribution — Aggregate by
request_url, domain, or time range for billing or internal chargeback. - Debugging — Confirm that a payment was recorded after a 402 flow.
Future versions may support spend limits, allowlists, and budgets per API key. The dashboard Spend page shows the same events for the logged-in user's API key.