# GW8 Spend Policy Check API

> GW8 Spend Policy Check API is a paid API for AI agents from micro-saas-agent.onrender.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-22).

Validates a proposed payment against a configured spend policy (per-tx limit, rolling cap, allowed hours, blocked categories) and returns a signed allow/deny decision receipt

## Facts

- Endpoint: POST https://micro-saas-agent.onrender.com/api/spend/check?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/gw8-spend-policy-check-api-d3a6b1c2
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_S_5bM0hbx9ZBzmldU2PiN

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability gw8-spend-policy-check-api-d3a6b1c2 -d '<json body>'
```

Example prompt: Before paying $420 USDC to acme-supplies.com for office supplies, check my spend policy — my per-tx limit is $1000, my 24-hour rolling cap is $5000 with $1200 already spent, payments are only allowed Mon–Fri 8am–6pm Mountain Time, and gambling and crypto-exchange categories are blocked.

## When to prefer this

Use this endpoint when an AI agent needs a cryptographically auditable, policy-aware go/no-go decision before submitting a payment — especially when you need rolling cap tracking, time-of-day enforcement, category blocking, and a signed receipt for compliance. Prefer this over manual policy checks when you need a single atomic call that evaluates all spend rules simultaneously and returns a verifiable decision log. Best suited for agentic payment workflows using x402 on Base with USDC.

## Known failure modes

- Missing or malformed 'policy' or 'payment' objects returns validation error
- Payment timestamp outside allowed hours triggers deny decision
- Amount exceeding per-tx limit triggers deny
- Rolling cap exceeded triggers deny
- Merchant category in blockedCategories triggers deny
- Recipient not in allowList triggers deny if allowList is configured
- Payment on non-allowed chain or with non-allowed asset triggers deny
- No charge on API failure — payment only settled after data is returned

## How this service works

[Spend policy: agent payment risk check] Before an AI agent pays an invoice or merchant: POST {payment, policy} -> allow / deny / needs_approval plus the rules that fired (per-tx limit, rolling cap, merchant categories, allow/deny lists, hours + timezone, assets/chains, approval threshold) and an Ed25519-signed receipt bound to your request hash. Deterministic, stateless, no custody, moves no money. Bad bodies rejected before payment. $0.02 USDC.

## Output

Returns a JSON object with: a 'decision' field ('allow' or 'deny'), an array of 'checks' showing each policy rule evaluated with pass/fail and detail, a 'reasons' array for any denials, 'remaining' budget figures (perTx and rollingCap before/after), the policy engine version, and a cryptographically signed 'decisionReceipt' (Ed25519) with a verify URL — enabling tamper-proof audit of spend decisions.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "policy": {
   "type": "object",
   "example": {
    "currency": "USDC",
    "allowList": [
     "acme-supplies.com"
    ],
    "perTxLimit": "1000",
    "rollingCap": {
     "limit": "5000",
     "spentSoFar": "1200",
     "windowHours": 24
    },
    "allowedHours": {
     "end": "18:00",
     "days": [
      "mon",
      "tue",
      "wed",
      "thu",
      "fri"
     ],
     "start": "08:00",
     "timezone": "America/Denver"
    },
    "allowedAssets": [
     "USDC"
    ],
    "allowedChains": [
     "base"
    ],
    "blockedCategories": [
     "gambling",
     "crypto-exchange"
    ],
    "requireApprovalAbove": "750"
   }
  },
  "payment": {
   "type": "object",
   "example": {
    "memo": "INV-10442",
    "chain": "base",
    "amount": "420.00",
    "agentId": "ap-agent-7",
    "currency": "USDC",
    "timestamp": "2026-10-21T15:30:00Z",
    "recipientId": "acct_acme_supplies",
    "recipientDomain": "acme-supplies.com",
    "merchantCategory": "office-supplies"
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "checks": [
   {
    "rule": "per_tx_limit",
    "detail": "420 <= per-tx limit 1000",
    "result": "pass"
   }
  ],
  "engine": "gw8-spend-policy/1",
  "reasons": [],
  "decision": "allow",
  "remaining": {
   "perTx": "1000",
   "rollingCapAfter": "3380",
   "rollingCapBefore": "3800"
  },
  "decisionReceipt": {
   "alg": "Ed25519",
   "query": {
    "decision": "allow",
    "requestSha256": "7faa…"
   },
   "signed": true,
   "payload": "eyJ2Ijox…",
   "endpoint": "POST /api/spend/check",
   "signature": "base64…",
   "accessType": "SPEND_POLICY_DECISION",
   "verify_url": "https://micro-saas-agent.onrender.com/api/receipt/verify",
   "response_sha256": "…"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/gw8-spend-policy-check-api-d3a6b1c2/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from micro-saas-agent.onrender.com](https://www.zero.xyz/host/micro-saas-agent.onrender.com/llms.txt)
