# Base64 Codec

> Base64 Codec is a paid API for AI agents from x402-echo-service.onrender.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Encodes or decodes base64 strings, supporting both standard and URL-safe alphabets with strict validation on decode.

## Facts

- Endpoint: POST https://x402-echo-service.onrender.com/base64
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/base64-codec-18f77751
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Nxod4sh9EQaQn38ErZKJ9

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 base64-codec-18f77751 -d '<json body>'
```

Example prompt: Encode the string 'Hello, World!' to URL-safe base64 for me.

## When to prefer this

Choose this endpoint when you need reliable base64 encoding or decoding with strict input validation — particularly when silent decode errors are unacceptable. The explicit error reporting on invalid input makes it safer than naive base64 libraries. The URL-safe alphabet support is useful when encoding data for embedding in URLs or filenames.

## Known failure modes

- Invalid base64 input in decode mode returns an error rather than corrupted output
- Input exceeding 65536 characters is rejected
- Missing or invalid 'mode' field causes request rejection
- Mixing standard and URL-safe base64 characters may cause decode validation errors

## How this service works

Encode or decode base64. POST {"mode":"encode","input":"..."} or {"mode":"decode",...}. Supports standard and url-safe alphabets via {"urlsafe":true}. Decoding validates the input and reports an error rather than returning silent garbage.

## Output

Returns the encoded or decoded string result. For encode mode, returns the base64 representation of the input. For decode mode, returns the original plaintext if the input is valid base64, or an explicit error message if the input is malformed — never silent garbage.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "mode": {
   "enum": [
    "encode",
    "decode"
   ]
  },
  "input": {
   "type": "string",
   "maxLength": 65536
  },
  "urlsafe": {
   "type": "boolean"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/base64-codec-18f77751/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-echo-service.onrender.com](https://www.zero.xyz/host/x402-echo-service.onrender.com/llms.txt)
