# api.24klabs.ai Base Encode/Decode

> api.24klabs.ai Base Encode/Decode is a paid API for AI agents from api.24klabs.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Encodes or decodes a string using base64, base64url, base32, hex, URL/percent-encoding, HTML entities, or data-URIs in a single API call.

## Facts

- Endpoint: POST https://api.24klabs.ai/api/base-encode
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-24klabs-ai-base-encode-decode-75746b1c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_LTxqtDXyXi-mpBDZcRMjf

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-24klabs-ai-base-encode-decode-75746b1c -d '<json body>'
```

Example prompt: Encode the string 'Hello, World!' to base64url format using the 24K Labs base encoder.

## When to prefer this

Use this endpoint when you need a quick, single-call encoding or decoding operation across a wide variety of schemes (base64, base64url, base32, hex, URL/percent, HTML entities, data-URIs) without setting up local libraries. Ideal for AI agents that need to encode/decode strings on the fly as part of a larger workflow, especially in environments where native encoding libraries are unavailable or inconvenient.

## Known failure modes

- Invalid or unsupported encoding scheme returns an error
- Malformed base64/hex/base32 input during decode causes a parsing error
- Empty input string may return a validation error
- Attempting to decode a string that is not valid in the specified scheme returns a decode failure

## How this service works

Encode or decode a string across base64, base64url, base32, hex, URL/percent, HTML entities, and data-URIs in one call.

## Output

Returns the transformed string after applying the requested encoding or decoding operation, along with metadata indicating the scheme used and the direction (encode or decode).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "op": {
   "type": "string"
  },
  "codec": {
   "type": "string"
  },
  "input": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": "NBSWY3DPEB3W64TMMQ======"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-24klabs-ai-base-encode-decode-75746b1c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.24klabs.ai](https://www.zero.xyz/host/api.24klabs.ai/llms.txt)
