# X Pay Base64 Encode

> X Pay Base64 Encode is a paid API for AI agents from www.api-xpay.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-02).

Encodes arbitrary data to Base64 format via a pay-per-request API using USDC on Base (x402 protocol).

## Facts

- Endpoint: POST https://www.api-xpay.com/x402/base64?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x-pay-base64-encode-4d158035
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_mx-yrUMtxX7Pkxpq1dd3f

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 x-pay-base64-encode-4d158035 -d '<json body>'
```

Example prompt: Can you base64-encode this JSON payload for me: {"hello": "world"} — just send it as a POST with a JSON body and give me the encoded result?

## When to prefer this

Choose this endpoint when you need a simple, stateless base64 encoding utility accessible via API without setting up a local library, especially in agent pipelines where micro-payment per call (via x402/USDC on Base) is acceptable and convenience matters. Prefer it over self-hosted solutions when operating in an environment already integrated with the x402 payment protocol.

## Known failure modes

- Missing required 'input' field returns a validation error
- Invalid 'method' value (not POST/PUT/PATCH) causes a 400-level error
- Unsupported 'bodyType' enum value results in rejection
- Payment failure or insufficient USDC balance causes a 402 Payment Required response
- Empty or malformed body may return an empty or unexpected base64 result

## How this service works

Pay-per-request utility APIs powered by x402 using USDC on Base.

## Output

Returns a JSON object with fields: 'success' (boolean), 'result' (the base64-encoded string), 'action' (always 'encode'), 'asset' (USDC), and 'network' (base). On success, 'result' contains the full base64 representation of the submitted body.

## 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",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object"
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST",
      "PUT",
      "PATCH"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "asset": "USDC",
  "action": "encode",
  "result": "aGVsbG8=",
  "network": "base",
  "success": true
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x-pay-base64-encode-4d158035/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from www.api-xpay.com](https://www.zero.xyz/host/www.api-xpay.com/llms.txt)
