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:
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())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());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
$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:
{
"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.
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())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());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
$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:
- 15 across, row 3, column 1
- 15 across, row 13, column 1
- 11 across, row 6, column 1
- 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.
{
"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:
| Themer | Means |
|---|---|
15 | A 15-letter entry, across or down. |
15a, 15across | A 15-letter entry across. |
9d, 9down | A 9-letter entry down. |
15a@r3c1 | A 15-letter entry across starting on row 3, column 1. Rows and columns count from 1 at the top left. |
9@r1c4 | A 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
| Parameter | What it does |
|---|---|
width, height | Required. 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. |
themers | Required. The theme entries, as above. |
pattern, code | Squares the layout must have, as for Search: for instance a black square in each corner. |
outlet, days, blocks, words, words_N, symmetry | The filters of Search, such as words=78 or symmetry=mirror_lr. A layout counts the puzzles that pass them. |
limit, cursor, image, grid_format | As for Search. |
The answer
| Field | What it holds |
|---|---|
themers | The themers as read: length, direction (across, down or any), and row and col when you gave a start. |
counts | On 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. |
results | The page of layouts, most used first; fields below. |
next_cursor | Send it as cursor for the next page; null on the last. |
| Result field | What it holds |
|---|---|
width, height, grid | The 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, symmetry | Black squares, entries, and every symmetry the layout has. |
puzzles | How many published puzzles use this layout, whichever way they were turned or flipped. |
themers | Where your themers go, in the order you gave them: length, direction, row and col (from 1) of the first letter. |
examples | Up 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). |
svg | With 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
countscomes 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 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")// 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");
}# 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 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=.___.__________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)].
Search
GET/gridsearch/api/v1/search
Whole grids that fit a pattern, as the search page finds them. A grid fits when every square the pattern sets matches, either as published or turned or flipped any of the eight ways. Each puzzle comes once, turned to line up with your pattern if it had to be. Leave out pattern to get every grid of the size.
| Parameter | What it does |
|---|---|
width, height | Required. The pattern's size, 1 to 64. Unless you set grid_width or grid_height, also the size of the grids searched. |
pattern | width × height characters of ., - and _. Default: all _, every grid of the size. |
code | If you prefer, a grid code such as 15.ASA3SA27aN2aA27CA3C in place of width, height and pattern. |
grid_width, grid_height | The size of the grids to search: a number, a comparison such as >=15, or any. In a larger grid the pattern sits in the top-left corner. |
outlet | One outlet, by name or code from /outlets, such as nyt or LA Times. Default: all. |
days | Days of the week the puzzle ran, such as sat,sun. |
blocks | Black squares: a number or a comparison, such as <=38. |
words | Entries (across and down runs of two or more white squares), such as 78 or >=72. |
words_N | Entries of length N, 3 to 64, such as words_15=>=4 or words_3=<=12. Use as many as you like. |
symmetry | One of the symmetries, such as rot180, or any or none. |
limit | Results per page, 1 to 100. Default 50. |
cursor | The next_cursor of the page before. See Pages. |
image | svg adds a picture of each grid. See Pictures. |
grid_format | code gives each grid as a grid code in a code field, in place of grid. Default: text. |
The answer
| Field | What it holds |
|---|---|
counts | First page only. matches: every grid that fits. transformed: how many of those had to be turned or flipped. exact: how many are your pattern exactly, as published, with _ read as white. compared: how many grids passed the filters and were big enough to compare. |
results | The page of grids, newest first; fields below. |
next_cursor | Send it as cursor for the next page; null on the last. |
| Result field | What it holds |
|---|---|
id | GridSearch's number for the puzzle. Use it with /grids/{id}. |
xdid | The puzzle's id in the xd Crossword Corpus, such as nyt2012-04-05; null for a puzzle GridSearch added after its copy of the corpus was made. |
outlet, date, weekday | Where and when it ran. date is YYYY-MM-DD. |
width, height, grid | The grid, turned to line up with your pattern if it had to be. With grid_format=code, code in place of grid. |
blocks, words | Black squares and entries. |
transform | How the published grid was turned to fit: none, rotate90, rotate180 or rotate270 (clockwise), or flipped: mirror_lr (left to right), mirror_tb (top to bottom), mirror_diag (across the diagonal from top left) or mirror_anti (across the other diagonal). |
exact | true when the published grid is your pattern exactly, with _ read as white. |
link | The puzzle's page elsewhere (Cross(word) Reference for corpus puzzles), or null. |
svg | With image=svg only: the grid as an SVG picture. |
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:
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())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());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
$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));{
"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.
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())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());curl -G --compressed https://ugleh.com/gridsearch/api/v1/heatmap \
-d width=15 -d height=15 -d outlet=nyt -d days=mon<?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));{
"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.
{
"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.
{
"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.
{
"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_widthandgrid_heighttake 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'srequestsand JavaScript'sURLSearchParamsdo 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_diagandmirror_anti(across either diagonal),any(at least one of these) ornone. 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
400and 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=svgto a search or shape search, and each result gets ansvgfield holding the picture. - Or fetch
/grids/{id}.svgfor one grid, as published or withtransform. - Or draw the grid yourself from its text. In a web page, where only JavaScript runs:
// 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=.
Try a code
Type or paste a code, or a search-page link with one in it. The grid it stands for appears below in the search page’s colours. Choose any part of the code to see what it does.
- Black
- White
- Wildcard
How a code is written
- The size:
15for 15×15, or15x21for 15 wide and 21 tall. A code that is only a size is a grid of wildcards. - A separator:
.for a grid that may have wildcards, or-for one with none. - Letters, taking the squares row by row from the top left. Letters count from 0:
AtoZare 0 to 25 andatozare 26 to 51. After., each letter is three squares, each 0 (wildcard), 1 (white) or 2 (black), read as a number in base 3:Ais 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:Ais five white squares,f(31) five black ones. - Repeats: a number after a letter repeats it that many more times, so
A21is 22As. A pair is written as two letters. - 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:
___.___________
___.___________
_______________
_______________
_______________
_______________
_______________
...---------...
_______________
_______________
_______________
_______________
_______________
___________.___
___________.___Search with it, and get the matches back as codes:
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())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());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
$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));{
"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.
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 codeExamples
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 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])// 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));
}
}# 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 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 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)// 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());# 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 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,/shapeand/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-Agentthat 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:
{
"error": "invalid_parameter",
"message": "pattern must have width × height = 225 characters; it has 3."
}| Status | error | Meaning |
|---|---|---|
| 400 | invalid_parameter | A parameter is missing, unknown or out of range; the message says which. |
| 404 | not_found | No such endpoint, or no grid with that id or xdid. |
| 405 | method_not_allowed | The API only answers GET (and HEAD). |
| 429 | rate_limited | Over a limit. Wait for Retry-After seconds. |
| 503 | too_slow | The search took too long. Narrow it. |
| 503 | unavailable | Something 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.