# ScanPay Agent Sanitize

> ScanPay Agent Sanitize is a paid API for AI agents from scanpay-edge.alextaghiashvili.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-02).

Strips invisible characters and HTML comments from text and returns injection flags and a sanitized string

## Facts

- Endpoint: GET https://scanpay-edge.alextaghiashvili.workers.dev/api/v1/agent-sanitize?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/scanpay-agent-sanitize-4e6d5ddc
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_61pDQWZHQGVWGCLP79TPB

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 scanpay-agent-sanitize-4e6d5ddc
```

Example prompt: Can you sanitize this text for me — strip out any invisible characters, zero-width chars, HTML comments, and bidi overrides, and tell me if there are any injection flags: 'Hellozerofffwidthworld'?

## When to prefer this

Choose this endpoint when you need a deterministic, lightweight sanitizer focused specifically on invisible Unicode characters (zero-width, bidi overrides, control characters) and HTML comments — especially before passing untrusted text to an LLM or AI agent. It is purpose-built for prompt-injection defense and AI pipeline hygiene, unlike general-purpose HTML sanitizers or DOMPurify which focus on tag-based XSS. Prefer it when you also need explicit injection flags and token-savings estimates as structured output.

## Known failure modes

- Empty or missing 'text' query parameter returns validation error
- Text exceeding 200,000 character limit is rejected
- Network timeout on Cloudflare Workers edge
- Payment failure via x402 protocol results in 402 response before sanitization occurs
- Non-UTF-8 encoded text may cause unexpected behavior

## How this service works

Pay-per-call x402 APIs for AI agents: OpenAI-compatible LLM chat, perp funding and arbitrage spreads, crypto prices, gas, FX, Solana SPL mint audit, token price by contract, x402 delivery-receipt verification, web search, clean page extraction, batch tools and deterministic code-security scanning. USDC on Base or Solana, no signup, no API key, from $0.0001 a call.

## Output

Returns a JSON object with: the cleaned text string, original and cleaned character lengths, a breakdown of removed character types (bidi, controls, zero_width, html_comments), an array of injection flags if suspicious patterns were detected, and an estimated token savings count.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "title": "AgentSanitizeRequest",
     "required": [
      "text"
     ],
     "properties": {
      "text": {
       "type": "string",
       "title": "Text",
       "maxLength": 200000,
       "minLength": 1
      },
      "max_chars": {
       "anyOf": [
        {
         "type": "integer",
         "maximum": 200000,
         "minimum": 1
        },
        {
         "type": "null"
        }
       ],
       "title": "Max Chars",
       "default": null
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "flags": [],
  "product": "scanpay.agent_sanitize",
  "removed": {
   "bidi": 0,
   "controls": 0,
   "zero_width": 1,
   "html_comments": 1
  },
  "clean_len": 11,
  "clean_text": "Hello world",
  "original_len": 27,
  "tokens_saved_est": 4
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/scanpay-agent-sanitize-4e6d5ddc/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from scanpay-edge.alextaghiashvili.workers.dev](https://www.zero.xyz/host/scanpay-edge.alextaghiashvili.workers.dev/llms.txt)
