Overview
Pass a difficulty level of easy, medium, hard, or expert, or omit the parameter to default to medium. The API creates a 9x9 number grid containing the puzzle, marking unfilled spaces with zeros. Paid tiers also return the complete solution grid.
Live Test Sudoku Generator API →
Endpoint
One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.
curl "https://api.apiverve.com/v1/sudoku?difficulty=medium" \
-H "x-api-key: your_api_key_here"const res = await fetch('https://api.apiverve.com/v1/sudoku?difficulty=medium', {
headers: { 'x-api-key': 'your_api_key_here' },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data } = await res.json();
console.log(data);import requests
res = requests.get(
"https://api.apiverve.com/v1/sudoku?difficulty=medium",
headers={"x-api-key": "your_api_key_here"},
timeout=15,
)
res.raise_for_status()
print(res.json()["data"])package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.apiverve.com/v1/sudoku?difficulty=medium", nil)
req.Header.Set("x-api-key", "your_api_key_here")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.
Authentication
Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.
A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.
Parameters
Sent in the query string. Premium parameters are accepted on every plan but only take effect on plans that include them.
| Parameter | Type | Description |
|---|---|---|
difficultyOptional | string | The difficulty level of the Sudoku puzzle to generateeasymediumhardexpertdefault medium |
Response
Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.
{
"status": "ok",
"error": null,
"data": {
"puzzle": {
"grid": "674--3---1---72-9-5----1--4------8-3-1---8--52----61--7-1----8--53-97--19--8-4---",
"html": "<html><head><title>Sudoku Puzzle</title><style>table {border-collapse: collapse; width: 300px; height: 300px;}td {text-align: center; width: 30px; height: 30px; padding: 0;}input {width: 100%; height:…",
"image": {
"imageName": "d1b59df4-7ab2-474e-b269-e34ce212b469_puzzle.png",
"format": ".png",
"downloadURL": "https://storage.googleapis.com/apiverve/APIData/sudoku/d1b59df4-7ab2-474e-b269-e34ce212b469_puzzle.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766010586&Signature=…",
"expires": 1766010586784
}
},
"solution": {
"grid": "674953218138472596592681734465129873319748625287536149741365982853297461926814357",
"html": "<html><head><title>Sudoku Solution</title><style>table {border-collapse: collapse; width: 300px; height: 300px;}td {text-align: center; width: 30px; height: 30px; padding: 0;}input {width: 100%; heigh…",
"image": {
"imageName": "d0a6a5a0-c0e3-44cb-8417-e6590f793a7c_solution.png",
"format": ".png",
"downloadURL": "https://storage.googleapis.com/apiverve/APIData/sudoku/d0a6a5a0-c0e3-44cb-8417-e6590f793a7c_solution.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766010586&Signatur…",
"expires": 1766010586850
}
},
"difficulty": "medium"
}
}
Response fields
Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.
| Field | Type | Example | Description |
|---|---|---|---|
puzzle | object | {...} | 9x9 grid representing the Sudoku puzzle with 0s for empty cells |
grid | string | "674--3---1---72-9-5----1--4------8-3-1---8--52----61--7-1----8--53-97--19--8-4---" | |
html | string | "<html><head><title>Sudoku Puzzle</title><style>table {border-collapse: collapse; width: 300px; heigh…" | |
image | object | {...} | |
imageName | string | "d1b59df4-7ab2-474e-b269-e34ce212b469_puzzle.png" | |
format | string | ".png" | |
downloadURL | string | "https://storage.googleapis.com/apiverve/APIData/sudoku/d1b59df4-7ab2-474e-b269-e34ce212b469_puzzle.p…" | |
expires | number | 1766010586784 | |
solutionPremium | object | {...} | Complete solution grid for the puzzle |
gridPremium | string | "674953218138472596592681734465129873319748625287536149741365982853297461926814357" | |
htmlPremium | string | "<html><head><title>Sudoku Solution</title><style>table {border-collapse: collapse; width: 300px; hei…" | |
imagePremium | object | {...} | |
imageNamePremium | string | "d0a6a5a0-c0e3-44cb-8417-e6590f793a7c_solution.png" | |
formatPremium | string | ".png" | |
downloadURLPremium | string | "https://storage.googleapis.com/apiverve/APIData/sudoku/d0a6a5a0-c0e3-44cb-8417-e6590f793a7c_solution…" | |
expiresPremium | number | 1766010586850 | |
difficulty | string | "medium" | Difficulty level of the generated puzzle |
Errors
Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.
| Status | Meaning | What to do |
|---|---|---|
400 | Input was rejected | Read error; it names the parameter. |
401 | Key missing or invalid | Check the header name and the key value. |
403 | Key valid, but not permitted | A key restriction or IP allow-list; see key scoping. |
429 | Rate limited, or out of credits | Read error to tell them apart; see rate limits. |
Use cases
- Daily Newspaper Puzzles
- Editors generate fresh grids every morning to populate print syndicated puzzle columns across graded difficulty levels.
- Mobile Brain Teasers
- When a player starts a new match, game servers fetch a 9x9 board matching the player's chosen challenge tier.
- Classroom Logic Exercises
- Math instructors build printable worksheets featuring easy and medium grids to teach deduction rules to elementary students.
- Senior Mental Fitness
- Deliver randomized daily logic challenges directly to retirement community web portals without storing or manually designing static boards.
Other ways to use Sudoku Generator
Set up Sudoku Generator on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.
Related
More in Entertainment: