# Hex Decode API

> Hex Decode API is a paid API for AI agents from x402-micro-pay.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-11-20).

Decodes a hex string into multiple representations: UTF-8 text, bytes32, Ethereum address, 4-byte function selector, and uint256

## Facts

- Endpoint: POST https://x402-micro-pay.com/api/skills/hex-decode?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-20
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/hex-decode-api-a4e03f8b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_XsGI-mJKxacF3nsE-Ji8r

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 hex-decode-api-a4e03f8b -d '<json body>'
```

Example prompt: Decode the hex string 0x48656c6c6f for me — I want to see it as UTF-8 text, as a bytes32 value, and check if it could be an Ethereum address.

## When to prefer this

Use this endpoint when you need to decode a raw hex string into one or more human-readable or Ethereum-typed representations in a single call, especially when working with blockchain data, smart contract calldata, or hex-encoded storage values. Prefer this over generic hex utilities when you need simultaneous multi-format output (UTF-8, address, bytes32, selector) and are already working within an x402 micropayment agent workflow.

## Known failure modes

- Invalid hex string (odd length or non-hex characters) returns validation error
- Hex string exceeds 4096 bytes (8194 character) maximum length
- Empty hex string rejected by minLength:1 constraint
- Requesting unsupported decode type in 'as' array returns error
- Payment not made returns HTTP 402 requiring x402 USDC payment on Base

## How this service works

41 pay-per-call JSON APIs for AI agents. No account or API key: an unpaid POST returns HTTP 402, pay in USDC on Base with x402 v2, retry. Prices from $0.001 per call.

## Output

A JSON object containing the decoded representations of the input hex string: utf8 text (if valid), bytes32 (left-padded), Ethereum address (if 20 bytes), 4-byte function selector, byte length, and validity flags for address and other formats. Also includes warnings (e.g. left-padding applied), confidence score, skill name, and suggested next skills.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "as": {
   "type": "array",
   "items": {
    "enum": [
     "utf8",
     "bytes32",
     "address",
     "selector",
     "uint256",
     "bytes"
    ],
    "type": "string"
   },
   "default": [
    "utf8",
    "bytes32",
    "address",
    "selector"
   ],
   "maxItems": 8,
   "minItems": 1,
   "uniqueItems": true
  },
  "hex": {
   "type": "string",
   "pattern": "^(?:0x)?[0-9a-fA-F]+$",
   "maxLength": 8194,
   "minLength": 1,
   "description": "Hex string (0x optional), even length, max 4096 bytes"
  },
  "request_id": {
   "type": "string",
   "pattern": "^[A-Za-z0-9._:-]+$",
   "maxLength": 64,
   "minLength": 1,
   "description": "Optional idempotency key. Echoed back; a credit-pack redemption with the same request_id and body is charged once."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "data": {
   "hex": "0x48656c6c6f",
   "utf8": "Hello",
   "address": null,
   "bytes32": "0x00000000000000000000000000000000000000000000000000000048656c6c6f",
   "selector": "0x48656c6c",
   "address_ok": false,
   "byte_length": 5,
   "selector_note": "4-byte function selector (local only; no 4byte.directory lookup)",
   "bytes32_utf8_stripped": "Hello"
  },
  "next": [
   "address_validate",
   "tx_status"
  ],
  "skill": "hex_decode",
  "charged": true,
  "service": "hex_decode",
  "sources": [
   {
    "url": "hex-decode",
    "name": "local",
    "fetched_at": "2026-10-26T14:00:00Z"
   }
  ],
  "summary": "hex-decode: 5 bytes, utf8",
  "version": "1.0.0",
  "warnings": [
   "left-padded to 32 bytes"
  ],
  "confidence": 1,
  "data_as_of": "2026-10-26T14:00:00Z",
  "generated_at": "2026-10-26T14:00:00Z"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/hex-decode-api-a4e03f8b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-micro-pay.com](https://www.zero.xyz/host/x402-micro-pay.com/llms.txt)
