# Safe4 Payment Authorization Decision

> Safe4 Payment Authorization Decision is a paid API for AI agents from api.safe4.ai, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-15).

Evaluates whether an AI agent's proposed payment matches its assigned task context and returns an ALLOW or DENY authorization decision with audit trail

## Facts

- Endpoint: POST https://api.safe4.ai/v1/authorize
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/safe4-payment-authorization-decision-4dc17fea
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_oiN1SxdO8oKSx0d34FE1c

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 safe4-payment-authorization-decision-4dc17fea -d '<json body>'
```

Example prompt: 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'.

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

Safe4 payment authorization decision

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "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"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/safe4-payment-authorization-decision-4dc17fea/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.safe4.ai](https://www.zero.xyz/host/api.safe4.ai/llms.txt)
