Skip to the documentation

Grid Search API

Search 162,749 published crossword grids from 175 outlets from your own code: find the layouts that hold your theme entries, or search by black-square pattern, shape, size, outlet, day and word lengths. JSON over HTTPS, free, and no key needed.

Quick start

Every address starts with https://ugleh.com/gridsearch/api/v1. Ask for every 15×15 New York Times grid with at least four 15-letter entries:

Python request
import requests

params = {"width": 15, "height": 15, "outlet": "nyt", "words_15": ">=4", "limit": 2}
answer = requests.get("https://ugleh.com/gridsearch/api/v1/search", params=params, timeout=60)
print(answer.json())
JavaScript request
const params = new URLSearchParams({width: 15, height: 15, outlet: "nyt", words_15: ">=4", limit: 2});
const answer = await fetch(`https://ugleh.com/gridsearch/api/v1/search?${params}`);
console.log(await answer.json());
Shell request
curl -G --compressed https://ugleh.com/gridsearch/api/v1/search \
  -d width=15 -d height=15 -d outlet=nyt \
  --data-urlencode 'words_15=>=4' -d limit=2
PHP request
<?php
$params = ['width' => 15, 'height' => 15, 'outlet' => 'nyt', 'words_15' => '>=4', 'limit' => 2];
$json = file_get_contents('https://ugleh.com/gridsearch/api/v1/search?' . http_build_query($params));
print_r(json_decode($json, true));

The answer counts every match (1,035), gives the first page of them, newest first (two here, because of limit=2), and a cursor for the next page:

Answer
{
  "counts": {
    "matches": 1035,
    "transformed": 0,
    "exact": 0,
    "compared": 1035
  },
  "results": [
    {
      "id": 162451,
      "xdid": null,
      "outlet": "New York Times",
      "date": "2026-11-19",
      "weekday": "Thursday",
      "width": 15,
      "height": 15,
      "grid": "---.----.---------.----.---------------------------.---.--------..-----.---------------------.----..----....----.----....----..----.---------------------.-----..--------.---.---------------------------.----.---------.----.---",
      "blocks": 33,
      "words": 74,
      "link": "https://www.xwordinfo.com/Crossword?date=11/19/2026",
      "transform": "none",
      "exact": false
    },
    {
      "id": 161222,
      "xdid": "nyt2026-10-16",
      "outlet": "New York Times",
      "date": "2026-10-16",
      "weekday": "Friday",
      "width": 15,
      "height": 15,
      "grid": "-----.---.--------------------------------------.-------.-------.-----.---------.....-----.-------------....---------....-------------.-----.....---------.-----.-------.-------.--------------------------------------.---.-----",
      "blocks": 32,
      "words": 68,
      "link": "https://crosswordreference.com/puzzle/xd/nyt2026-10-16",
      "transform": "none",
      "exact": false
    }
  ],
  "next_cursor": "WzE3OTIxMDg4MDAsIk5ldyBZb3JrIFRpbWVzIiwxNjEyMjJd"
}

A grid comes as text, row by row: . is a black square and - a white one. link opens the puzzle elsewhere on the web. GridSearch has grids only: no answers, clues or titles.

Looking for a grid that holds your theme? Skip to Grids for a theme: give the size and your themers' lengths and get the published layouts that fit, most used first.

Building with an AI assistant? Give it the plain-text copy of this page: https://ugleh.com/gridsearch/api/llms.txt. It has everything here, without the page around it.

Grids for a theme

GET/gridsearch/api/v1/themes

What constructors ask most: I have two 15-letter theme entries and two 11s; which 15×15 grids hold them? Give the size and the themers' lengths, and get every published layout that fits, the most used first, each with one way to place the themers and its newest puzzles.

Python request
import requests

params = {"width": 15, "height": 15, "themers": "15a,15a,11a,11a", "limit": 1}
answer = requests.get("https://ugleh.com/gridsearch/api/v1/themes", params=params, timeout=60)
print(answer.json())
JavaScript request
const params = new URLSearchParams({width: 15, height: 15, themers: "15a,15a,11a,11a", limit: 1});
const answer = await fetch(`https://ugleh.com/gridsearch/api/v1/themes?${params}`);
console.log(await answer.json());
Shell request
curl -G --compressed https://ugleh.com/gridsearch/api/v1/themes \
  -d width=15 -d height=15 -d themers=15a,15a,11a,11a \
  -d limit=1
PHP request
<?php
$params = ['width' => 15, 'height' => 15, 'themers' => '15a,15a,11a,11a', 'limit' => 1];
$json = file_get_contents('https://ugleh.com/gridsearch/api/v1/themes?' . http_build_query($params));
print_r(json_decode($json, true));

1,246 layouts hold two 15s and two 11s across, used by 1,477 puzzles in all (253 layouts in the New York Times alone, with outlet=nyt). The most used, 39 times:

1342
  1. 15 across, row 3, column 1
  2. 15 across, row 13, column 1
  3. 11 across, row 6, column 1
  4. 11 across, row 10, column 5

36 black squares, 78 words. The newest of its puzzles ran in The Cornell Daily Sun on September 23, 2026.

Answer
{
  "themers": [
    {
      "length": 15,
      "direction": "across"
    },
    {
      "length": 15,
      "direction": "across"
    },
    {
      "length": 11,
      "direction": "across"
    },
    {
      "length": 11,
      "direction": "across"
    }
  ],
  "counts": {
    "layouts": 1246,
    "puzzles": 1477,
    "complete": true
  },
  "results": [
    {
      "width": 15,
      "height": 15,
      "grid": "-----.----.---------.----.----------------------.----.------...----.----...-----------.--------..---.--------.-----.--------.---..--------.-----------...----.----...------.----.----------------------.----.---------.----.-----",
      "blocks": 36,
      "words": 78,
      "symmetry": ["rot180"],
      "puzzles": 39,
      "themers": [
        {
          "length": 15,
          "direction": "across",
          "row": 3,
          "col": 1
        },
        {
          "length": 15,
          "direction": "across",
          "row": 13,
          "col": 1
        },
        {
          "length": 11,
          "direction": "across",
          "row": 6,
          "col": 1
        },
        {
          "length": 11,
          "direction": "across",
          "row": 10,
          "col": 5
        }
      ],
      "examples": [
        {
          "id": 160288,
          "xdid": "cdsun2026-09-23",
          "outlet": "The Cornell Daily Sun",
          "date": "2026-09-23",
          "transform": "none",
          "link": "https://crosswordreference.com/puzzle/xd/cdsun2026-09-23"
        },
        {
          "id": 151733,
          "xdid": "tfts2026-01-20",
          "outlet": "The Tufts Daily",
          "date": "2026-01-20",
          "transform": "none",
          "link": "https://crosswordreference.com/puzzle/xd/tfts2026-01-20"
        },
        {
          "id": 150082,
          "xdid": "uva2025-11-30",
          "outlet": "The Cavalier Daily",
          "date": "2025-11-30",
          "transform": "none",
          "link": "https://crosswordreference.com/puzzle/xd/uva2025-11-30"
        }
      ]
    }
  ],
  "next_cursor": "dDE"
}

Writing themers

themers lists up to 12 theme entries, separated by commas. Each is a length (3 or more), then if you like a direction, then if you like the square it starts on:

ThemerMeans
15A 15-letter entry, across or down.
15a, 15acrossA 15-letter entry across.
9d, 9downA 9-letter entry down.
15a@r3c1A 15-letter entry across starting on row 3, column 1. Rows and columns count from 1 at the top left.
9@r1c4A 9-letter entry, across or down, starting on row 1, column 4.

Mix them freely: themers=15a@r3c1,15a@r13c1,9d@r1c4 finds 405 layouts with 15s across rows 3 and 13 and a 9 down from the top of column 4. A themer needs an entry of exactly its length, from black square (or edge) to black square, and two themers never share an entry.

Parameters

ParameterWhat it does
width, heightRequired. The grid's size, 1 to 64. A layout published the other way round (15 wide and 21 tall, for width=21&height=15) is turned on its side to fit.
themersRequired. The theme entries, as above.
pattern, codeSquares the layout must have, as for Search: for instance a black square in each corner.
outlet, days, blocks, words, words_N, symmetryThe filters of Search, such as words=78 or symmetry=mirror_lr. A layout counts the puzzles that pass them.
limit, cursor, image, grid_formatAs for Search.

The answer

FieldWhat it holds
themersThe themers as read: length, direction (across, down or any), and row and col when you gave a start.
countsOn every page. layouts: the layouts that fit. puzzles: the puzzles that use them. complete: false when the themers fit nearly every grid (a lone short entry, say), and only the 20,000 most used layouts were looked at.
resultsThe page of layouts, most used first; fields below.
next_cursorSend it as cursor for the next page; null on the last.
Result fieldWhat it holds
width, height, gridThe layout, turned to the size you asked for and so the themers fit; as published when it can be. With grid_format=code, code in place of grid.
blocks, words, symmetryBlack squares, entries, and every symmetry the layout has.
puzzlesHow many published puzzles use this layout, whichever way they were turned or flipped.
themersWhere your themers go, in the order you gave them: length, direction, row and col (from 1) of the first letter.
examplesUp to three of those puzzles, newest first: id, xdid, outlet, date, link, and transform, how that puzzle as published turns into the layout shown (as in Search; /grids/{id}.svg?transform= draws it so).
svgWith image=svg only: a picture of the layout.

Good to know

  • A layout is one arrangement of black squares, counted once however it was turned or flipped, so the same grid never fills a page eight times.
  • The placement is one way the themers fit; a layout often has others. It is not a claim about which entries the original puzzles used for their theme, and GridSearch has no letters, so nothing about the words themselves is checked.
  • Pages go by position, and counts comes on every page. Each page runs the search again, so take 100 at a time.
  • Themers that nearly any grid holds can take a couple of seconds; one or two long themers answer in well under a second.

The top layouts, themers marked

The five most used layouts for two 15s and two 11s across, each drawn as text with its themers' squares marked # (the Shell version lists where each themer starts).

Python
# Python 3 with requests (pip install requests).
import requests

API = "https://ugleh.com/gridsearch/api/v1"
answer = requests.get(f"{API}/themes", timeout=60,
                      params={"width": 15, "height": 15, "themers": "15a,15a,11a,11a", "limit": 5},
                      headers={"User-Agent": "my-theme-helper/1.0 (you@example.com)"})
answer.raise_for_status()
page = answer.json()
print(page["counts"]["layouts"], "layouts hold these themers")
for layout in page["results"]:
    w = layout["width"]
    rows = [list(layout["grid"][i:i + w]) for i in range(0, len(layout["grid"]), w)]
    for t in layout["themers"]:  # mark each themer's squares with #
        for k in range(t["length"]):
            across = t["direction"] == "across"
            rows[t["row"] - 1 + (0 if across else k)][t["col"] - 1 + (k if across else 0)] = "#"
    print(layout["puzzles"], "puzzles, the newest:", layout["examples"][0]["link"])
    print("\n".join("".join(row) for row in rows), end="\n\n")
JavaScript
// Node 18 and later (save as themes.mjs), or a module script in a web page (leave out the User-Agent there).
const API = "https://ugleh.com/gridsearch/api/v1";
const query = new URLSearchParams({width: 15, height: 15, themers: "15a,15a,11a,11a", limit: 5});
const answer = await fetch(`${API}/themes?${query}`, {headers: {"User-Agent": "my-theme-helper/1.0 (you@example.com)"}});
if (!answer.ok) throw new Error((await answer.json()).message);
const page = await answer.json();
console.log(page.counts.layouts, "layouts hold these themers");
for (const layout of page.results) {
  const w = layout.width, rows = [];
  for (let i = 0; i < layout.grid.length; i += w) rows.push([...layout.grid.slice(i, i + w)]);
  for (const t of layout.themers) {  // mark each themer's squares with #
    for (let k = 0; k < t.length; k++) {
      const across = t.direction === "across";
      rows[t.row - 1 + (across ? 0 : k)][t.col - 1 + (across ? k : 0)] = "#";
    }
  }
  console.log(layout.puzzles, "puzzles, the newest:", layout.examples[0].link);
  console.log(rows.map((row) => row.join("")).join("\n") + "\n");
}
Shell
# Bash, with curl and jq: each layout, then where each themer starts.
curl -sS --compressed --retry 5 -A 'my-theme-helper/1.0 (you@example.com)' -G https://ugleh.com/gridsearch/api/v1/themes \
  -d width=15 -d height=15 -d themers=15a,15a,11a,11a -d limit=5 |
jq -r '"\(.counts.layouts) layouts hold these themers", (.results[] |
  "\(.puzzles) puzzles, the newest: \(.examples[0].link)",
  (.width as $w | .grid | range(0; length; $w) as $i | .[$i:$i + $w]),
  (.themers[] | "  \(.length) \(.direction) from row \(.row), column \(.col)"), "")'
PHP
<?php
// PHP 8 with the curl extension.
$query = http_build_query(['width' => 15, 'height' => 15, 'themers' => '15a,15a,11a,11a', 'limit' => 5]);
$curl = curl_init("https://ugleh.com/gridsearch/api/v1/themes?$query");
curl_setopt_array($curl, [CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_TIMEOUT => 60,
    CURLOPT_USERAGENT => 'my-theme-helper/1.0 (you@example.com)']);
$page = json_decode(curl_exec($curl) ?: throw new RuntimeException(curl_error($curl)), true, flags: JSON_THROW_ON_ERROR);
if (isset($page['error'])) throw new RuntimeException($page['message']);
echo "{$page['counts']['layouts']} layouts hold these themers\n";
foreach ($page['results'] as $layout) {
    $rows = array_map('str_split', str_split($layout['grid'], $layout['width']));
    foreach ($layout['themers'] as $t) {  // mark each themer's squares with #
        for ($k = 0; $k < $t['length']; $k++) {
            $across = $t['direction'] === 'across';
            $rows[$t['row'] - 1 + ($across ? 0 : $k)][$t['col'] - 1 + ($across ? $k : 0)] = '#';
        }
    }
    echo "{$layout['puzzles']} puzzles, the newest: {$layout['examples'][0]['link']}\n";
    echo implode("\n", array_map('implode', $rows)), "\n\n";
}

Grids and patterns

A grid is one string, read row by row from the top left: . is a black square and - a white one, so a 15×15 grid is 225 characters. A pattern you send uses the same two, plus _ for a square that can be either.

This 5×3 pattern asks for a black square in each top corner and does not care about the rest:

Pattern, row by row, then as sent
.___.
_____
_____

pattern=.___.__________

To get rows back from a grid, cut it every width characters. In Python: [g[i:i + w] for i in range(0, len(g), w)].

Shape search

GET/gridsearch/api/v1/shape

Grids that hold a shape anywhere, as published: shapes are not turned or flipped. pattern is the shape, with width and height its size, and must set at least one square. It takes the same filters as Search, but grid_width and grid_height default to any. Each result gives position, the row and column (counted from 0) of the shape's top-left square where it first fits, in place of transform and exact; counts has only matches and compared.

Times grids with a plus sign of black squares:

Python request
import requests

params = {"width": 3, "height": 3, "pattern": "_._..._._", "outlet": "nyt", "limit": 1}
answer = requests.get("https://ugleh.com/gridsearch/api/v1/shape", params=params, timeout=60)
print(answer.json())
JavaScript request
const params = new URLSearchParams({width: 3, height: 3, pattern: "_._..._._", outlet: "nyt", limit: 1});
const answer = await fetch(`https://ugleh.com/gridsearch/api/v1/shape?${params}`);
console.log(await answer.json());
Shell request
curl -G --compressed https://ugleh.com/gridsearch/api/v1/shape \
  -d width=3 -d height=3 -d pattern=_._..._._ -d outlet=nyt \
  -d limit=1
PHP request
<?php
$params = ['width' => 3, 'height' => 3, 'pattern' => '_._..._._', 'outlet' => 'nyt', 'limit' => 1];
$json = file_get_contents('https://ugleh.com/gridsearch/api/v1/shape?' . http_build_query($params));
print_r(json_decode($json, true));
Answer
{
  "counts": {
    "matches": 1382,
    "compared": 28185
  },
  "results": [
    {
      "id": 162307,
      "xdid": "nyt2026-11-12",
      "outlet": "New York Times",
      "date": "2026-11-12",
      "weekday": "Thursday",
      "width": 15,
      "height": 17,
      "grid": "...............---.---.---.----------.--------------.-------------...------..-----.-----..---.-------.-------.-----.--------.-----.---------.---.--------.---.---.---------...------...----.----....-------------.--------------------.---.----------.---.-----",
      "blocks": 55,
      "words": 78,
      "link": "https://crosswordreference.com/puzzle/xd/nyt2026-11-12",
      "position": {
        "row": 3,
        "col": 6
      }
    }
  ],
  "next_cursor": "WzE3OTQ0NDE2MDAsIk5ldyBZb3JrIFRpbWVzIiwxNjIzMDdd"
}

Heatmap

GET/gridsearch/api/v1/heatmap

For each square of the pattern, how often it is black among every grid that fits, as the search page's heatmap shows it. It takes the parameters of Search except limit, cursor, image and grid_format. black has a row for each row of the pattern, each square a share from 0 to 1, or null where no matching grid has a square (when smaller grids are searched). It reads every match, so it costs as much as the first page of a search.

Python request
import requests

params = {"width": 15, "height": 15, "outlet": "nyt", "days": "mon"}
answer = requests.get("https://ugleh.com/gridsearch/api/v1/heatmap", params=params, timeout=60)
print(answer.json())
JavaScript request
const params = new URLSearchParams({width: 15, height: 15, outlet: "nyt", days: "mon"});
const answer = await fetch(`https://ugleh.com/gridsearch/api/v1/heatmap?${params}`);
console.log(await answer.json());
Shell request
curl -G --compressed https://ugleh.com/gridsearch/api/v1/heatmap \
  -d width=15 -d height=15 -d outlet=nyt -d days=mon
PHP request
<?php
$params = ['width' => 15, 'height' => 15, 'outlet' => 'nyt', 'days' => 'mon'];
$json = file_get_contents('https://ugleh.com/gridsearch/api/v1/heatmap?' . http_build_query($params));
print_r(json_decode($json, true));
Answer, shortened
{
  "matches": 3913,
  "width": 15,
  "height": 15,
  "black": [
    [
      0.0496,
      0.0097,
      0.001,
      0.0606,
      0.608,
      … 10 more
    ],
    [
      0.0107,
      0,
      0,
      0.0373,
      0.5827,
      … 10 more
    ],
    [
      0.0015,
      0,
      0,
      0.0197,
      0.31,
      … 10 more
    ],
    … 12 more rows
  ]
}

One grid

GET/gridsearch/api/v1/grids/{id or xdid}

One puzzle's grid as published, by its id or its xdid, with the result fields above plus symmetry (every symmetry it has, using the names below) and word_lengths (how many entries of each length). Add grid_format=code for a grid code in place of grid.

Answer for /gridsearch/api/v1/grids/nyt2012-04-05
{
  "grid": {
    "id": 64368,
    "xdid": "nyt2012-04-05",
    "outlet": "New York Times",
    "date": "2012-04-05",
    "weekday": "Thursday",
    "width": 15,
    "height": 15,
    "grid": "------.----.---------.----.--------------.---.....-----.-------.----------------.-.-.-----------.-.----..-----.-.-.-----..----.-.-----------.-.-.----------------.-------.-----.....---.--------------.----.---------.----.------",
    "blocks": 41,
    "words": 70,
    "link": "https://crosswordreference.com/puzzle/xd/nyt2012-04-05",
    "symmetry": ["rot180"],
    "word_lengths": {
      "3": 20,
      "4": 14,
      "5": 14,
      "6": 12,
      "7": 4,
      "11": 6
    }
  }
}

GET/gridsearch/api/v1/grids/{id or xdid}.svg

A picture of the grid: SVG, black and white, 20 units to a square. Add transform, with a value from a search result, to turn it the way the search showed it, such as ?transform=rotate90.

Outlets and sizes

GET/gridsearch/api/v1/outlets

Every outlet, with the code you can use for outlet and how many grids it has, largest first.

Answer, shortened
{
  "outlets": [
    {
      "name": "New York Times",
      "slug": "nyt",
      "grids": 28185
    },
    {
      "name": "Newsday",
      "slug": "newsday",
      "grids": 10562
    },
    {
      "name": "LA Times",
      "slug": "lat",
      "grids": 10519
    },
    … 172 more outlets
  ]
}

GET/gridsearch/api/v1/sizes

Every grid size with how many grids have it, most common first. Add outlet for one outlet's.

Answer for /gridsearch/api/v1/sizes?outlet=nyt, shortened
{
  "outlet": "New York Times",
  "sizes": [
    {
      "width": 15,
      "height": 15,
      "grids": 23359
    },
    {
      "width": 21,
      "height": 21,
      "grids": 2932
    },
    {
      "width": 23,
      "height": 23,
      "grids": 1392
    },
    … 31 more sizes
  ]
}

Filter values

Comparisons
blocks, words, words_N, grid_width and grid_height take a number, for exactly that many, or a number after >=, <=, > or <. In a URL, encode them like any value (words=%3E%3D72); curl's --data-urlencode, Python's requests and JavaScript's URLSearchParams do it for you.
Days
mon, tue, wed, thu, fri, sat, sun, or the full names, separated by commas.
Symmetries
rot180 (the same turned halfway: the usual American symmetry), rot90 (the same turned a quarter), mirror_lr (left to right), mirror_tb (top to bottom), mirror_diag and mirror_anti (across either diagonal), any (at least one of these) or none. The filter applies to the grid as it is shown.
Outlets
A name or a code from /outlets, in any case. An unknown outlet is an error, not an empty answer.
Mistakes
A parameter the endpoint does not know is refused with a 400 and a message, so a misspelt filter never silently matches everything.

Pages

Results come newest first (layouts from /themes most used first), 50 to a page unless you set limit (at most 100). For the next page, send the same request with cursor set to the answer's next_cursor; it is null on the last page. Only the first page has counts (on /themes, every page does).

A cursor marks the last puzzle you were given, so a puzzle added while you page through cannot shift or repeat what you get. A page costs the server about as much whatever its size, so if you want everything, ask for 100 at a time.

Pictures

Answers carry each grid as text, which is all most programs need: a 15×15 grid is 225 characters. Pictures are there if you want them, but only when you ask, since one is about 46 times larger than the text of the same grid.

  • Add image=svg to a search or shape search, and each result gets an svg field holding the picture.
  • Or fetch /grids/{id}.svg for one grid, as published or with transform.
  • Or draw the grid yourself from its text. In a web page, where only JavaScript runs:
JavaScript, in a web page
// In a web page, in a <script type="module">: draw grids from their text, no pictures needed.
const API = "https://ugleh.com/gridsearch/api/v1";
const query = new URLSearchParams({width: 21, height: 21, outlet: "nyt", symmetry: "mirror_lr", limit: 10});
const answer = await fetch(`${API}/search?${query}`);
if (!answer.ok) throw new Error((await answer.json()).message);
const page = await answer.json();

function drawGrid({width, grid}) {
  const box = document.createElement("div");
  box.style.cssText = `display:grid;grid-template-columns:repeat(${width},10px);gap:1px;` +
    "background:#000;border:1px solid #000;width:max-content;margin:8px 0";
  for (const square of grid) {
    const cell = document.createElement("div");
    cell.style.cssText = `height:10px;background:${square === "." ? "#000" : "#fff"}`;
    box.append(cell);
  }
  return box;
}
document.body.append(...page.results.map(drawGrid));

Grid codes Optional

You never need these. Everything on this page works with width, height and pattern. A grid code is a shorter way to write the same grid: the one the search page keeps in its address bar while you draw, as in https://ugleh.com/gridsearch/#g=15.ASA3SA27aN2aA27CA3C. Codes are handy when you already have search-page links, or want smaller answers: a finished 15×15 grid is 225 characters as text and usually 40 to 50 as a code.

To use them, send code in place of width, height and pattern, and add grid_format=code to get codes back in place of grids. To open any code in the search page, add it to https://ugleh.com/gridsearch/#g=.

How a code is written

  1. The size: 15 for 15×15, or 15x21 for 15 wide and 21 tall. A code that is only a size is a grid of wildcards.
  2. A separator: . for a grid that may have wildcards, or - for one with none.
  3. Letters, taking the squares row by row from the top left. Letters count from 0: A to Z are 0 to 25 and a to z are 26 to 51. After ., each letter is three squares, each 0 (wildcard), 1 (white) or 2 (black), read as a number in base 3: A is three wildcards, S (18) is black then two wildcards, a (26) is three black squares. After -, each letter is five squares, each 0 (white) or 1 (black), in base 2: A is five white squares, f (31) five black ones.
  4. Repeats: a number after a letter repeats it that many more times, so A21 is 22 As. A pair is written as two letters.
  5. The end: letters that are all wildcards (after -, all white) at the end are left off. When the last letter runs past the grid's last square, the extra squares are ignored.

Of the two forms the shorter is used, so a grid always has the same code. Here is 15.ASA3SA27aN2aA27CA3C row by row:

Decoded
___.___________
___.___________
_______________
_______________
_______________
_______________
_______________
...---------...
_______________
_______________
_______________
_______________
_______________
___________.___
___________.___

Search with it, and get the matches back as codes:

Python request
import requests

params = {"code": "15.ASA3SA27aN2aA27CA3C", "outlet": "nyt", "grid_format": "code", "limit": 2}
answer = requests.get("https://ugleh.com/gridsearch/api/v1/search", params=params, timeout=60)
print(answer.json())
JavaScript request
const params = new URLSearchParams({code: "15.ASA3SA27aN2aA27CA3C", outlet: "nyt", grid_format: "code", limit: 2});
const answer = await fetch(`https://ugleh.com/gridsearch/api/v1/search?${params}`);
console.log(await answer.json());
Shell request
curl -G --compressed https://ugleh.com/gridsearch/api/v1/search \
  -d code=15.ASA3SA27aN2aA27CA3C -d outlet=nyt \
  -d grid_format=code -d limit=2
PHP request
<?php
$params = ['code' => '15.ASA3SA27aN2aA27CA3C', 'outlet' => 'nyt', 'grid_format' => 'code', 'limit' => 2];
$json = file_get_contents('https://ugleh.com/gridsearch/api/v1/search?' . http_build_query($params));
print_r(json_decode($json, true));
Answer
{
  "counts": {
    "matches": 220,
    "transformed": 160,
    "exact": 0,
    "compared": 23359
  },
  "results": [
    {
      "id": 161889,
      "xdid": "nyt2026-11-02",
      "outlet": "New York Times",
      "date": "2026-11-02",
      "weekday": "Monday",
      "width": 15,
      "height": 15,
      "code": "15-CAQCAQA3cA2IBDQCBAcAHAQIBYQCA2HA3BAIBAI",
      "blocks": 34,
      "words": 74,
      "link": "https://crosswordreference.com/puzzle/xd/nyt2026-11-02",
      "transform": "mirror_lr",
      "exact": false
    },
    {
      "id": 161179,
      "xdid": "nyt2026-10-15",
      "outlet": "New York Times",
      "date": "2026-10-15",
      "weekday": "Thursday",
      "width": 15,
      "height": 15,
      "code": "15-CBACBACBA2YAcAACABBDcAHYQQAIAAHADA2QIAQIAQI",
      "blocks": 38,
      "words": 74,
      "link": "https://crosswordreference.com/puzzle/xd/nyt2026-10-15",
      "transform": "none",
      "exact": false
    }
  ],
  "next_cursor": "WzE3OTIwMjI0MDAsIk5ldyBZb3JrIFRpbWVzIiwxNjExNzld"
}

Reading and writing codes in Python

These two functions match the search page's own; GridSearch's tests check that they agree on thousands of grids.

Python
import re

LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
# After the size: '.' = 3 squares per letter in base 3, '-' = 5 squares per letter in base 2.
MODES = {".": (3, 3, "_-."), "-": (5, 2, "-.")}  # squares per letter, base, the square for each digit


def decode_grid(code):
    """'15.A18GA34G' -> (15, 15, '___...'): width, height, and the grid row by row."""
    m = re.fullmatch(r"(\d{1,2})(?:x(\d{1,2}))?(?:([.-])((?:[A-Za-z](?:[1-9]\d{0,3})?)*))?", code)
    if not m:
        raise ValueError(f"not a grid code: {code!r}")
    width, height = int(m[1]), int(m[2] or m[1])
    per, base, squares = MODES[m[3] or "."]
    cells = width * height
    symbols = []
    for letter, more in re.findall(r"([A-Za-z])(\d*)", m[4] or ""):
        symbols += [LETTERS.index(letter)] * (1 + int(more or 0))
    symbols += [0] * (-(-cells // per) - len(symbols))  # left-off letters are all zero
    grid = ""
    for symbol in symbols:
        group = ""
        for _ in range(per):
            group = squares[symbol % base] + group
            symbol //= base
        grid += group
    return width, height, grid[:cells]


def encode_grid(width, height, grid):
    """(15, 15, '___...') -> '15.A18GA34G', using '-' when there are no wildcards and that is shorter."""
    size = str(width) if width == height else f"{width}x{height}"

    def letters(mode):
        per, base, squares = MODES[mode]
        symbols = []
        for i in range(0, len(grid), per):
            symbol = 0
            for k in range(per):
                symbol = symbol * base + (squares.index(grid[i + k]) if i + k < len(grid) else 0)
            symbols.append(symbol)
        while symbols and symbols[-1] == 0:  # leave off trailing zeros
            symbols.pop()
        out, i = "", 0
        while i < len(symbols):
            j = i
            while j < len(symbols) and symbols[j] == symbols[i]:
                j += 1
            letter, run = LETTERS[symbols[i]], j - i
            out += letter if run == 1 else letter * 2 if run == 2 else f"{letter}{run - 1}"
            i = j
        return out

    general = letters(".")
    code = f"{size}.{general}" if general else size
    if "_" not in grid:
        compact = f"{size}-{letters('-') or 'A'}"
        if len(compact) < len(code):
            code = compact
    return code

Examples

The same jobs in Python, JavaScript, Shell and PHP. Choose a language on any of the tabbed blocks and the others follow; the page remembers it. Each program names itself in User-Agent: put your own program and how to reach you there.

Every match, page by page

Asks for 100 grids at a time, follows next_cursor to the last page, and waits when the API says it is over a limit.

Python
# Python 3 with requests (pip install requests).
import time
import requests

API = "https://ugleh.com/gridsearch/api/v1"
session = requests.Session()
session.headers["User-Agent"] = "my-grid-study/1.0 (you@example.com)"


def search(**params):
    """Every grid that fits, newest first, a page at a time."""
    params["limit"] = 100
    while True:
        answer = session.get(f"{API}/search", params=params, timeout=60)
        if answer.status_code == 429:  # over a limit: wait as long as asked
            time.sleep(int(answer.headers.get("Retry-After", "5")))
            continue
        if not answer.ok:
            raise RuntimeError(answer.json()["message"])
        page = answer.json()
        yield from page["results"]
        if not page["next_cursor"]:
            return
        params["cursor"] = page["next_cursor"]


# Times 15x15 grids with at least four 15-letter entries, printed row by row (. black, - white).
for grid in search(width=15, height=15, outlet="nyt", words_15=">=4"):
    w = grid["width"]
    print(grid["date"], grid["weekday"], grid["words"], "words", grid["link"])
    for start in range(0, len(grid["grid"]), w):
        print(grid["grid"][start:start + w])
JavaScript
// Node 18 and later (save as search.mjs), or a module script in a web page.
const API = "https://ugleh.com/gridsearch/api/v1";
// Name your program. Browsers send their own User-Agent, so leave it out in a web page.
const headers = {"User-Agent": "my-grid-study/1.0 (you@example.com)"};

/** Every grid that fits, newest first, a page at a time. */
async function* search(params) {
  const query = new URLSearchParams({...params, limit: 100});
  while (true) {
    const answer = await fetch(`${API}/search?${query}`, {headers});
    if (answer.status === 429) {  // over a limit: wait as long as asked
      const seconds = Number(answer.headers.get("Retry-After") ?? 5);
      await new Promise((resume) => setTimeout(resume, seconds * 1000));
      continue;
    }
    if (!answer.ok) throw new Error((await answer.json()).message);
    const page = await answer.json();
    yield* page.results;
    if (!page.next_cursor) return;
    query.set("cursor", page.next_cursor);
  }
}

// Times 15x15 grids with at least four 15-letter entries, printed row by row (. black, - white).
for await (const grid of search({width: 15, height: 15, outlet: "nyt", words_15: ">=4"})) {
  console.log(grid.date, grid.weekday, grid.words, "words", grid.link);
  for (let start = 0; start < grid.grid.length; start += grid.width) {
    console.log(grid.grid.slice(start, start + grid.width));
  }
}
Shell
# Bash, with curl and jq. curl waits and asks again when the API says it is over a limit.
API=https://ugleh.com/gridsearch/api/v1
cursor=()
while :; do
  page=$(curl -sS --compressed --retry 5 -A 'my-grid-study/1.0 (you@example.com)' -G "$API/search" \
    -d width=15 -d height=15 -d outlet=nyt --data-urlencode 'words_15=>=4' -d limit=100 "${cursor[@]}")
  if jq -e .error >/dev/null <<<"$page"; then jq -r .message <<<"$page" >&2; exit 1; fi
  # Times 15x15 grids with at least four 15-letter entries, printed row by row (. black, - white).
  jq -r '.results[] | "\(.date) \(.weekday) \(.words) words \(.link)",
    (.width as $w | .grid | range(0; length; $w) as $i | .[$i:$i + $w])' <<<"$page"
  next=$(jq -r '.next_cursor // empty' <<<"$page")
  [ -z "$next" ] && break
  cursor=(-d "cursor=$next")
done
PHP
<?php
// PHP 8 with the curl extension.
const API = 'https://ugleh.com/gridsearch/api/v1';

/** One call to the API; waits and asks again when it says it is over a limit. */
function call(string $path, array $params = []): array
{
    $wait = 5;
    $curl = curl_init(API . $path . '?' . http_build_query($params));
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',  // accept gzip
        CURLOPT_TIMEOUT => 60,
        CURLOPT_USERAGENT => 'my-grid-study/1.0 (you@example.com)',
        CURLOPT_HEADERFUNCTION => function ($curl, string $header) use (&$wait): int {
            if (preg_match('/^Retry-After:\s*(\d+)/i', $header, $m)) $wait = (int) $m[1];
            return strlen($header);
        },
    ]);
    while (true) {
        $body = curl_exec($curl);
        if ($body === false) throw new RuntimeException(curl_error($curl));
        $status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
        if ($status !== 429) break;
        sleep($wait);  // over a limit: wait as long as asked
    }
    $answer = json_decode($body, true, flags: JSON_THROW_ON_ERROR);
    if ($status !== 200) throw new RuntimeException($answer['message']);
    return $answer;
}

/** Every grid that fits, newest first, a page at a time. */
function search(array $params): Generator
{
    $params['limit'] = 100;
    do {
        $page = call('/search', $params);
        yield from $page['results'];
        $params['cursor'] = $page['next_cursor'];
    } while ($params['cursor']);
}

// Times 15x15 grids with at least four 15-letter entries, printed row by row (. black, - white).
foreach (search(['width' => 15, 'height' => 15, 'outlet' => 'nyt', 'words_15' => '>=4']) as $grid) {
    echo "{$grid['date']} {$grid['weekday']} {$grid['words']} words {$grid['link']}\n";
    echo implode("\n", str_split($grid['grid'], $grid['width'])), "\n";
}

One grid, row by row, and its picture

Fetches one puzzle by its xd id, prints it a row at a time, and saves its SVG picture.

Python
# Python 3 with requests (pip install requests).
import requests

API = "https://ugleh.com/gridsearch/api/v1"
session = requests.Session()
session.headers["User-Agent"] = "my-grid-study/1.0 (you@example.com)"

# One grid, by its xd id or GridSearch id, printed row by row (. black, - white).
answer = session.get(f"{API}/grids/nyt2012-04-05", timeout=60)
if not answer.ok:
    raise RuntimeError(answer.json()["message"])
grid = answer.json()["grid"]
print(grid["date"], grid["weekday"], grid["words"], "words, symmetry:", ", ".join(grid["symmetry"]))
w = grid["width"]
for start in range(0, len(grid["grid"]), w):
    print(grid["grid"][start:start + w])

# Its picture
picture = session.get(f"{API}/grids/nyt2012-04-05.svg", timeout=60)
picture.raise_for_status()
with open("nyt2012-04-05.svg", "wb") as file:
    file.write(picture.content)
JavaScript
// Node 18 and later (save as grid.mjs).
import {writeFile} from "node:fs/promises";

const API = "https://ugleh.com/gridsearch/api/v1";
const headers = {"User-Agent": "my-grid-study/1.0 (you@example.com)"};

// One grid, by its xd id or GridSearch id, printed row by row (. black, - white).
const answer = await fetch(`${API}/grids/nyt2012-04-05`, {headers});
if (!answer.ok) throw new Error((await answer.json()).message);
const {grid} = await answer.json();
console.log(grid.date, grid.weekday, grid.words, "words, symmetry:", grid.symmetry.join(", "));
for (let start = 0; start < grid.grid.length; start += grid.width) {
  console.log(grid.grid.slice(start, start + grid.width));
}

// Its picture
const picture = await fetch(`${API}/grids/nyt2012-04-05.svg`, {headers});
if (!picture.ok) throw new Error(`The picture answered ${picture.status}`);
await writeFile("nyt2012-04-05.svg", await picture.text());
Shell
# Bash, with curl and jq.
API=https://ugleh.com/gridsearch/api/v1
UA='my-grid-study/1.0 (you@example.com)'

# One grid, by its xd id or GridSearch id, printed row by row (. black, - white).
curl -sS --compressed --retry 5 -A "$UA" "$API/grids/nyt2012-04-05" | jq -r '.grid |
  "\(.date) \(.weekday) \(.words) words, symmetry: \(.symmetry | join(", "))",
  (.width as $w | .grid | range(0; length; $w) as $i | .[$i:$i + $w])'

# Its picture
curl -sS --fail --retry 5 -A "$UA" -o nyt2012-04-05.svg "$API/grids/nyt2012-04-05.svg"
PHP
<?php
// PHP 8 with the curl extension.
const API = 'https://ugleh.com/gridsearch/api/v1';

/** The body of one answer from the API. */
function get(string $url): string
{
    $curl = curl_init($url);
    curl_setopt_array($curl, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',  // accept gzip
        CURLOPT_TIMEOUT => 60,
        CURLOPT_USERAGENT => 'my-grid-study/1.0 (you@example.com)',
    ]);
    $body = curl_exec($curl);
    if ($body === false) throw new RuntimeException(curl_error($curl));
    $status = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
    if ($status !== 200) throw new RuntimeException("$url answered $status: $body");
    return $body;
}

// One grid, by its xd id or GridSearch id, printed row by row (. black, - white).
$grid = json_decode(get(API . '/grids/nyt2012-04-05'), true, flags: JSON_THROW_ON_ERROR)['grid'];
echo "{$grid['date']} {$grid['weekday']} {$grid['words']} words, symmetry: ", implode(', ', $grid['symmetry']), "\n";
echo implode("\n", str_split($grid['grid'], $grid['width'])), "\n";

// Its picture
file_put_contents('nyt2012-04-05.svg', get(API . '/grids/nyt2012-04-05.svg'));

Limits

No key and no sign-up. GridSearch runs on one small server, so to keep it quick for everyone each address may make:

  • 600 requests a minute in all, in bursts of up to 200;
  • of those, 120 a minute to /themes, /search, /shape and /heatmap, in bursts of up to 60, since each can take a second or so;
  • 3 requests at once.

The API also takes at most 6 requests at once from everyone together. Past any limit the answer is 429 with a Retry-After header: wait that many seconds and try again.

Answers are kept for a while (searches 10 minutes, lists an hour, single grids a day), so asking the same thing again is quick, though it still counts. A search across every outlet and size can take a few seconds; name an outlet or a size when you can. A search that runs past 5 seconds (10 for a shape search or a theme search) stops with 503 and too_slow.

Please

  • Send a User-Agent that names your program and how to reach you.
  • Accept gzip (most clients do; with curl, add --compressed).
  • Fetch 100 results a page and follow cursors, rather than making many small requests.
  • Do not use the API to copy the whole collection.

Errors

Every error is JSON with an error code for programs and a message for people:

Answer for a 15×15 search with pattern=...
{
  "error": "invalid_parameter",
  "message": "pattern must have width × height = 225 characters; it has 3."
}
StatuserrorMeaning
400invalid_parameterA parameter is missing, unknown or out of range; the message says which.
404not_foundNo such endpoint, or no grid with that id or xdid.
405method_not_allowedThe API only answers GET (and HEAD).
429rate_limitedOver a limit. Wait for Retry-After seconds.
503too_slowThe search took too long. Narrow it.
503unavailableSomething failed on the server. Try again in a minute.

Versions

This is version 1. It may gain endpoints, parameters and fields, so ignore fields you do not know. A change that would break a working program goes into a new version at /v2/ instead. https://ugleh.com/gridsearch/api/v1/ lists the endpoints and where these docs are, including the plain-text copy. This page was built on December 5, 2026, and its example answers are real answers from that day.