{"uid":"cap_oiN1SxdO8oKSx0d34FE1c","slug":"safe4-payment-authorization-decision-4dc17fea","name":"Safe4 Payment Authorization Decision","description":"Safe4 payment authorization decision","url":"https://api.safe4.ai/v1/authorize","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"task":{"type":"string","maxLength":2000,"minLength":1},"amount":{"anyOf":[{"type":"number","maximum":1000000000000,"exclusiveMinimum":0},{"type":"string"}]},"task_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"default":null},"agent_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"default":null},"currency":{"type":"string","default":"USDC","maxLength":10,"minLength":2},"purchase":{"type":"string","maxLength":2000,"minLength":1},"counterparty":{"type":"string","maxLength":200,"minLength":1},"purchase_purpose":{"type":"string","maxLength":2000,"minLength":1},"service_category":{"type":"string","maxLength":80,"minLength":1},"allowed_counterparties":{"anyOf":[{"type":"array","items":{"type":"string"},"minItems":1},{"type":"null"}],"default":null},"allowed_service_categories":{"type":"array","items":{"type":"string"},"minItems":1}}},"responseSchema":{"type":"json","example":{"audit":{"entry_hash":"9f2c1d0a7b5e4c3f8a6d2b1e0c9f8a7d6b5e4c3f2a1d0b9c8e7f6a5d4c3b2a19","recorded_at":"2026-08-19T10:32:04.117Z","previous_hash":"3b1a9c8d7e6f5a4b3c2d1e0f9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a09","sequence_number":1841},"reason":"The proposed purchase matches the submitted task context.","payment":{"payer":"0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed","amount":"10000","network":"eip155:8453","transaction":"a7f3c9e2-4b1d-4f8a-9c2e-6d5b4a3f2e1c"},"decision":"ALLOW","match_score":0.75,"reason_code":"TASK_PURCHASE_MATCH","matched_concepts":["competitor","pricing","research"],"evaluator_version":"safe4-task-bound-v1"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_RrnLFQNB4Ra9ZJ29ritNS","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x036cbd53842c5426634e7929541ec2318f3dcf7e","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Evaluates whether an AI agent's proposed payment matches its assigned task context and returns an ALLOW or DENY authorization decision with audit trail","exampleAgentPrompt":"Before I pay $10 USDC to CompetitorDataCo for their pricing API, check with Safe4 whether this purchase is authorized — my task is 'research competitor pricing strategies', the purchase purpose is 'access to competitor pricing dataset', and the service category is 'market-research'.","exampleUseCases":[{"title":"Autonomous research agent spending guard","prompt":"I have an agent running a competitive intelligence task — before it pays $5 USDC to a data vendor called PriceTrack for 'real-time competitor pricing data', check Safe4 to confirm the purchase is actually within scope of the task 'analyze competitor pricing for Q3 report'."},{"title":"Multi-agent fleet policy enforcement","prompt":"My agent fleet has a task to 'summarize customer support tickets' — one agent wants to pay $2 USDC to TranslationHub for 'document translation services'. Run a Safe4 authorization check to see if this purchase matches the task, with allowed service categories set to 'translation' and 'text-processing'."},{"title":"High-value agent purchase approval","prompt":"Before my agent spends $50 USDC with CloudGPU Inc for 'GPU compute time to train a model', I need Safe4 to authorize it against the task 'fine-tune an NLP model on internal data' and give me a match score and the audit hash so I can log it."}],"resultDescription":"A JSON object containing: a decision field (ALLOW or DENY), a match_score (0-1 float indicating how well the purchase aligns with the task), a human-readable reason string, a reason_code (e.g. TASK_PURCHASE_MATCH), matched_concepts (array of semantic concepts that linked task to purchase), evaluator_version, and a full audit object with entry_hash, previous_hash, sequence_number, and recorded_at timestamp for immutable audit trail purposes.","failureModes":["Missing required fields (task, purchase, purchase_purpose, counterparty, service_category, allowed_service_categories, amount) returns validation error","Task description too vague or purchase description too vague may result in low match_score and DENY decision","Invalid or unsupported currency code may cause rejection","Amount of zero or negative value is rejected by schema","Service category not in allowed_service_categories list likely results in DENY","Network or API availability issues may cause timeout"],"whenToPreferThis":"Use Safe4 when you need task-bound payment authorization with an immutable audit trail specifically designed for autonomous AI agents. Prefer this over generic payment gateways when you need semantic matching between an agent's assigned task and its proposed purchases, especially in multi-agent or agentic workflow contexts where spending governance and explainability (reason codes, matched concepts) are required. Ideal for x402-compatible payment flows where per-call micropayment authorization is needed.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:38:20.494Z","isFirstParty":false}