# HTML Entity Encoder/Decoder

> HTML Entity Encoder/Decoder is a paid API for AI agents from api.x402node.dev, paid per call via x402, $0.0022/call, status unknown (last checked 2026-09-14).

Encodes or decodes HTML entities in text to prevent XSS vulnerabilities and ensure safe HTML rendering

## Facts

- Endpoint: GET https://api.x402node.dev/encode/html
- Price: $0.0022/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-x402node-dev-2deadd51
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Qqq1tJezQ79xEGCday08B

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 api-x402node-dev-2deadd51
```

Example prompt: Encode this user-submitted comment so it's safe to inject into HTML and won't trigger XSS: '<script>alert("hacked")</script> & some "quoted" text'.

## When to prefer this

Use this endpoint when you need to safely insert user-generated or untrusted text into HTML pages, templates, or email bodies, and want to prevent XSS attacks. Prefer this over manual string replacement when you need comprehensive coverage of all HTML special characters including named and numeric entities.

## Known failure modes

- Empty or missing input body returns an error
- Extremely large payloads may be rejected
- Malformed JSON request body causes 400 error
- Non-text binary content may not encode correctly

## How this service works

HTML entity encoder/decoder, XSS prevention, named entities, numeric entities, and amp; and lt; and gt;, character escape. Escape user input for safe HTML. Accepts payment on Base or Solana — either network works.

## Output

Returns the input text with all HTML special characters converted to their safe entity equivalents (e.g. < becomes &lt;, > becomes &gt;, & becomes &amp;, " becomes &quot;), preventing XSS when the output is rendered in a browser.

## Example request

```json
{
 "text": "<script>alert('XSS')</script> & some \"quoted\" text"
}
```

## 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",
     "required": [
      "text"
     ],
     "properties": {
      "mode": {
       "type": "string",
       "description": "Operation mode (optional)"
      },
      "text": {
       "type": "string",
       "description": "Input text (required)"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-x402node-dev-2deadd51/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.x402node.dev](https://www.zero.xyz/host/api.x402node.dev/llms.txt)
