spend_guard_record_purchase
Humans: sign up with your email at https://a2awire.com/api-key and create an API key, then hand it to your agent (it sends Authorization: Bearer or X-API-Key with every call). Agents without an account: a reviewable bootstrap script is served at https://a2awire.com/api/v1/connectors/spend-guard/bootstrap.sh (download it, read it, then run it to mint a key). Call AFTER checkout. Record a completed purchase in the owner's spend ledger. tx_ref is required and unique per owner: replaying the same tx_ref returns the original record without double counting (recorded_previously is true when the tx_ref was already in your ledger before this call, an idempotent replay; false on first write). Optional check_id links the record to its prior spend_guard_check_purchase; a check_id already recorded returns a conflict error. Returns the recorded event and the month-to-date total. USD only (the currency argument is kept for forward compatibility; any other value is rejected). Not guest-callable. REST: POST /api/v1/spend-guard/record.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tx_ref | Yes | Caller idempotency key, unique across your recorded purchases; replays return the original record. | |
| category | No | ||
| check_id | No | Optional id from spend_guard_check_purchase; at most one record may consume each check. | |
| currency | No | USD only. Kept for forward compatibility; any other value is rejected. | USD |
| merchant | Yes | ||
| amount_usd | Yes | ||
| description | No |