{"openapi":"3.1.0","info":{"title":"Agent Economy OS 2047","version":"0.3.0","description":"Pay-per-call AI-agent pre-action policy evaluation. It evaluates caller-supplied budget, permitted domains and review thresholds; not a safety certification or autonomous authorization."},"servers":[{"url":"https://jzallxzbbdtelcpabfgr.supabase.co/functions/v1/agent-economy-commerce"}],"tags":[{"name":"agent-commerce","description":"USDC micropayments through x402 on Base"}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"PAYMENT-SIGNATURE","description":"x402 v2 signed payment authorization."}},"schemas":{"DecisionRequest":{"type":"object","required":["task_id","action","policy"],"additionalProperties":false,"properties":{"task_id":{"type":"string","maxLength":80},"action":{"type":"object","required":["kind","target_url","estimated_cost_usdc"],"properties":{"kind":{"type":"string","enum":["purchase","api_call","data_export"]},"target_url":{"type":"string","format":"uri"},"estimated_cost_usdc":{"type":"string","pattern":"^(0|[1-9][0-9]{0,8})(\\.[0-9]{1,6})?$"}}},"policy":{"type":"object","required":["allowed_kinds","allowed_domains","max_cost_usdc","require_evidence"],"properties":{"allowed_kinds":{"type":"array","items":{"type":"string","enum":["purchase","api_call","data_export"]}},"allowed_domains":{"type":"array","items":{"type":"string"}},"max_cost_usdc":{"type":"string"},"review_above_usdc":{"type":"string"},"require_evidence":{"type":"boolean"}}},"evidence":{"type":"array","items":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"}}}}}},"paths":{"/health":{"get":{"summary":"Service health and payment testing status","responses":{"200":{"description":"Health response"}}}},"/catalog.json":{"get":{"summary":"Read machine-readable product catalog","responses":{"200":{"description":"Product discovery"}}}},"/api/v1/demo":{"get":{"summary":"Free example of a policy decision","responses":{"200":{"description":"Example result"}}}},"/api/v1/preflight":{"post":{"summary":"Free request validation and budget preview","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRequest"}}}},"responses":{"200":{"description":"Preflight accepted"},"400":{"description":"Invalid payload"}}}},"/api/v1/agent-purchase-policy-check":{"post":{"operationId":"checkAgentPurchasePolicy","summary":"AI agent purchase budget policy check and allowed-domain review","description":"Paid x402 USDC pre-action review for AI agents: spending limits, domain allowlists, review thresholds and SHA-256 evaluation digest. Does not execute or authorize a purchase.","tags":["agent-commerce"],"security":[{"x402Payment":[]}],"x-payment-info":{"protocols":["x402"],"price":{"mode":"fixed","currency":"USD","amount":"0.10"},"network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0x935ad91b70c6d0769871416c5904d06fbf9ef586"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRequest"},"example":{"task_id":"agent-demo-1","action":{"kind":"purchase","target_url":"https://example.com/cart","estimated_cost_usdc":"9.99"},"policy":{"allowed_kinds":["purchase"],"allowed_domains":["example.com"],"max_cost_usdc":"10.00","review_above_usdc":"5.00","require_evidence":false}}}}},"responses":{"200":{"description":"Settled paid policy review"},"400":{"description":"Invalid input"},"402":{"description":"Payment required","headers":{"PAYMENT-REQUIRED":{"schema":{"type":"string"}}}}}}},"/api/v1/decision":{"post":{"operationId":"purchaseAgentPolicyDecision","summary":"Purchase AI-agent policy review for 0.10 USDC on Base","description":"Evaluates policy for a proposed agent action. Payment must be authorized by the purchasing agent's owner. Paid evaluation returns a JSON policy verdict, not a purchase authorization.","tags":["agent-commerce"],"security":[{"x402Payment":[]}],"x-payment-info":{"protocols":["x402"],"price":{"mode":"fixed","currency":"USD","amount":"0.10"},"network":"eip155:8453","asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0x935ad91b70c6d0769871416c5904d06fbf9ef586"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionRequest"},"example":{"task_id":"agent-demo-1","action":{"kind":"purchase","target_url":"https://example.com/cart","estimated_cost_usdc":"9.99"},"policy":{"allowed_kinds":["purchase"],"allowed_domains":["example.com"],"max_cost_usdc":"10.00","review_above_usdc":"5.00","require_evidence":false}}}}},"responses":{"200":{"description":"Paid and settled policy decision","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Invalid decision request"},"402":{"description":"Payment required; x402 v2 challenge in PAYMENT-REQUIRED response header","headers":{"PAYMENT-REQUIRED":{"schema":{"type":"string"},"description":"Base64-encoded x402 payment requirements"}}}}}}}}