Catalog/gen-maze

Generators

Seeded maze generator API

Generates a perfect maze (one unique path between any two cells) on a WxH grid via the recursive-backtracker algorithm, returning per-cell wall flags. The value-add: stable, solvable maze layouts from a seed, with the carving algorithm done right. Answers 'Generate a maze from this seed', 'How do I build a deterministic perfect maze grid?'.

Price$0.02per request
MethodPOST
Route/v1/generate/maze
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
mazegridrecursive-backtrackerperfect-mazedeterministicseedgamegenerate
API URLhttps://x402.hexl.dev/v1/generate/maze
Integration docs
Example request
{
  "width": 3,
  "height": 3,
  "seed": "abc"
}
Example response
{
  "width": 3,
  "height": 3,
  "walls": [
    [
      "NEW",
      "NW",
      "NE"
    ],
    [
      "EW",
      "ESW",
      "EW"
    ],
    [
      "SW",
      "NS",
      "ES"
    ]
  ],
  "cellCount": 9,
  "algorithm": "recursive-backtracker",
  "entrance": [
    0,
    0
  ],
  "exit": [
    2,
    2
  ],
  "seed": "abc",
  "deterministic": true,
  "interpretation": "Perfect maze (one path between any two cells); walls[y][x] lists present walls. Stable per seed."
}
Input schema
{
  "type": "object",
  "required": [
    "width",
    "height",
    "seed"
  ],
  "properties": {
    "width": {
      "type": "integer",
      "minimum": 2,
      "maximum": 50,
      "examples": [
        3
      ]
    },
    "height": {
      "type": "integer",
      "minimum": 2,
      "maximum": 50,
      "examples": [
        3
      ]
    },
    "seed": {
      "type": [
        "string",
        "number"
      ],
      "examples": [
        "abc"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}