Spending Limits
Set an amount per time window for each signer.
Releasing soon
Allowance usage and delegate spends sent by the platform, with the
spend_limit_exceeded error, are being released.
Spend caps
A spend cap limits how much one signer can send of one asset within a rolling time window. We record it and check it before every payment, on every network the wallet holds.
| Field | Value |
|---|---|
signerId | The signer the cap applies to. |
asset | The asset, for example USD₮. |
limitBaseUnits | The cap, in the asset's base units. |
windowSeconds | The rolling window, in seconds. |
treasury | true for a treasury wallet (default), false for a customer wallet. |
| Action | Request |
|---|---|
| Set a cap | Set spend cap |
| List caps | List spend caps |
| Remove a cap | Remove spend cap |
Also enforced on chain
On treasuries that hold a Safe, the same cap can also be written to the Safe, which then enforces it itself. Add onChain to Set spend cap:
- The cap is recorded and enforced by us straight away.
- The response returns a
userOpHashfor the on-chain allowance. - Signers approve it like any payment; see Signers and Approvals.
If the on-chain step does not start, the recorded cap stays in force and the response says why.
To write allowances yourself instead, Create delegate address returns the signer's delegateAddress and the entityKey that authorises spending against it, for use in Prepare allowance setup. The signer must be a passkey registered on the treasury; any other signer is refused with 403.
Allowance usage (releasing soon)
List allowances returns each on-chain allowance with its cap, what was spent and what remains in the current window, and when the window resets.
Spending within the allowance (releasing soon)
A signer spends within their allowance with Prepare delegate spend and Submit delegate spend. The platform sends the payment and pays the network fee.
A spend above what remains is refused with 409 spend_limit_exceeded, which states the remaining amount and when the window resets. Nothing is sent.
Removing a cap
A cap linked to an on-chain allowance is removed only after the allowance is revoked; until then the request is refused with 409. Revoke it with Prepare allowance setup and a cap of zero.
Errors
| Code | Status | Cause |
|---|---|---|
spend_limit_exceeded | 409 | The amount is above what remains of the allowance. detail states what remains and when the window resets. |
forbidden | 403 | The signer is not a passkey registered on this treasury, or the Safe is not this treasury's. |
validation_failed | 409 | Removing a cap whose on-chain allowance is still in force, or that may have one we cannot check. Revoke the allowance first. |