DocsSpending Policies

Spending Policies

Control how much your AI agent can spend with configurable Modexia limits. Policies are enforced actively on every payment payload — requests that violate these limits are rejected server-side to protect you.

Available Limits

Limit PropertyEnforcement Description
dailyLimitMaximum total USDC your agent can spend in any 24-hour window.
hourlyLimitMaximum total USDC per any rolling hour.
maxPerRequestMaximum USDC per single payment transfer API call.

Set API Limits per Agent

Apply specific limits explicitly for one specific address in your fleet.

bash
curl -X POST https://api.modexia.software/api/v1/agent/policy \
  -H "x-modexia-key: mx_test_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "agentAddress": "0xYourAgentAddress...",
    "dailyLimit": "100",
    "hourlyLimit": "25",
    "maxPerRequest": "10"
  }'

Set Default Global Limits

Define an overriding default baseline for any wallet interacting using your key or under your account hierarchy.

bash
curl -X POST https://api.modexia.software/api/v1/user/policy \
  -H "x-modexia-key: mx_test_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "dailyLimit": "50",
    "hourlyLimit": "10",
    "maxPerRequest": "5"
  }'

Why set hard limits?

Policies protect you from runaway scripts, infinite loop bugs, or hallucinated AI agent decisions that could drain your wallet balance uncontrollably. Modexia acts as the hard ceiling for agents. An agent hitting a policy violation receives a 403 error containing the remaining allowance mathematically remaining.