# Rail Fence (Zigzag) Cipher Encode/Decode

> Rail Fence (Zigzag) Cipher Encode/Decode is a paid API for AI agents from text-ciphers.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-21).

Encodes or decodes text using the rail fence (zigzag) transposition cipher with a configurable number of rails (2–20).

## Facts

- Endpoint: GET https://text-ciphers.x402tookit.com/rail-fence?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/rail-fence-zigzag-cipher-encode-decode-2038b374
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_a0uiVqgsZbL0mARra7Ob6

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 rail-fence-zigzag-cipher-encode-decode-2038b374
```

Example prompt: Encode the message 'HELLO WORLD' using the rail fence cipher with 3 rails.

## When to prefer this

Choose this endpoint when you need to encode or decode text specifically using the rail fence (zigzag) transposition cipher, especially for CTF challenges, cryptography education, or puzzle-making. It supports configurable rails (2–20) and optionally preserves spaces and punctuation. Prefer it over Caesar or Vigenere endpoints when the cipher type is specifically a columnar/rail transposition rather than a substitution cipher.

## Known failure modes

- Missing required 'text' or 'rails' parameter returns an error
- Rails value outside 2–20 range may return a validation error
- Text exceeding 1000 characters may be rejected
- Invalid mode value (not 'encode' or 'decode') may cause unexpected behavior
- Non-alphanumeric characters silently stripped unless 'raw=true' is set

## How this service works

Rail fence (zigzag) transposition cipher encode or decode with 2 to 20 rails; letters and digits only by default.

## Output

Returns a JSON object containing the encoded or decoded output text, the input text, the number of rails used, the mode (encode/decode), and metadata such as source, summary, and any disclaimer about the cipher's security.

## 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"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "text",
      "rails"
     ],
     "properties": {
      "raw": {
       "type": "string",
       "description": "true to keep spaces and punctuation as characters on the fence (default: letters and digits only, upper-cased)"
      },
      "mode": {
       "type": "string",
       "description": "encode (default) or decode"
      },
      "text": {
       "type": "string",
       "description": "Plain or cipher text (up to 1000 characters)"
      },
      "rails": {
       "type": "integer",
       "description": "Number of rails, 2 to 20"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "mode": {
       "type": [
        "null",
        "string"
       ]
      },
      "input": {
       "type": [
        "null",
        "string"
       ]
      },
      "rails": {
       "type": [
        "null",
        "number"
       ]
      },
      "output": {
       "type": [
        "null",
        "string"
       ]
      },
      "secure": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "prepared": {
       "type": [
        "null",
        "string"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
      
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/rail-fence-zigzag-cipher-encode-decode-2038b374/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from text-ciphers.x402tookit.com](https://www.zero.xyz/host/text-ciphers.x402tookit.com/llms.txt)
