# encoding-detect

> encoding-detect is a paid API for AI agents from x402.agentindex.world, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-02).

Detects whether hex-encoded bytes represent ASCII, UTF-8, or UTF-16 (with BOM) by testing decode validity and BOM presence

## Facts

- Endpoint: GET https://x402.agentindex.world/encoding/detect?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/encoding-detect-84664d2d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_4XLSU2YNmsswfiT0Zjbdu

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 encoding-detect-84664d2d
```

Example prompt: Can you check what character encoding these hex bytes use — EF BB BF 48 65 6C 6C 6F — and tell me if there's a BOM and whether they decode cleanly?

## When to prefer this

Use this endpoint when you need a fast, deterministic structural check on hex-encoded bytes to classify them as ASCII, UTF-8, or UTF-16 — especially when BOM detection matters. Prefer this over statistical language detectors when you want decode-validity guarantees rather than probabilistic guesses. Ideal for data pipelines, file processing agents, or any workflow where you receive raw bytes in hex form and need to know the encoding before attempting to decode them.

## Known failure modes

- Invalid hex string input returns an error (non-hex characters, odd-length string)
- Empty hex_bytes input may return an error or undefined result
- Ambiguous byte sequences (e.g. valid both as ASCII and UTF-8) may default to the more restrictive classification
- No statistical or language-level detection — exotic encodings like Latin-1 or Shift-JIS are not identified
- Payment failure or insufficient funds returns 402 before any processing occurs

## How this service works

Detect whether hex-encoded bytes are ASCII, UTF-8, or UTF-16 with a BOM, by decode-validity and BOM presence (not statistical language detection).

## Output

Returns the detected encoding type (ASCII, UTF-8, or UTF-16), whether a BOM is present, and whether the bytes decode validly — based on structural decode-validity checks and BOM detection rather than statistical language guessing.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "hex_bytes": {
   "type": "string",
   "title": "Hex Bytes"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/encoding-detect-84664d2d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.agentindex.world](https://www.zero.xyz/host/x402.agentindex.world/llms.txt)
