Sudoku
Generate Sudoku puzzles of varying difficulty levels. Each response includes the puzzle grid (with 0 for empty cells) and the complete solution.
Descripción general
Casos de uso
- Puzzle and brain-training apps
- Educational platforms
- Games and entertainment widgets
- Daily challenge features
Funcionalidades
Puntos finales de la API
Batch Generate Sudoku Puzzles
Generate up to 20 Sudoku puzzles in a single request. Results are returned in the same order as the input array. Each puzzle in the batch counts as one unit of API usage.
https://requiems.xyz/v1/entertainment/sudoku/batch
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| puzzles | array<string> |
Obligatorio | Array of difficulty levels to generate (min: 1, max: 20). Each must be one of: easy, medium, hard. |
Pruébalo
Demostración en vivoSolicitud
Array of difficulty levels to generate (min: 1, max: 20). Each must be one of: easy, medium, hard.
Campos de respuesta
| Campo | Tipo | Descripción |
|---|---|---|
| results | array<object> |
Generated puzzles in the same order as the input array. Each item has the same fields as the single-puzzle endpoint. |
| results[].difficulty | string |
The difficulty level of the puzzle (easy, medium, or hard) |
| results[].puzzle | array<object> |
9×9 grid as an array of 9 rows, each row an array of 9 integers — 0 means an empty cell to be filled in |
| results[].solution | array<object> |
9×9 grid as an array of 9 rows, each row an array of 9 integers — complete, valid solution |
| total | integer |
Number of puzzles returned. Matches the length of the input array. |
Ejemplos de código
curl -X POST "https://requiems.xyz/v1/entertainment/sudoku/batch" \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"puzzles":["easy","medium","hard"]}'
import requests
url = "https://requiems.xyz/v1/entertainment/sudoku/batch"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {"puzzles": ["easy", "medium", "hard"]}
response = requests.post(url, headers=headers, json=payload)
for puzzle in response.json()["data"]["results"]:
print(puzzle["difficulty"], puzzle["puzzle"])
const response = await fetch(
'https://requiems.xyz/v1/entertainment/sudoku/batch',
{
method: 'POST',
headers: {
'requiems-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ puzzles: ['easy', 'medium', 'hard'] })
}
);
const { data } = await response.json();
data.results.forEach(p => console.log(p.difficulty, p.puzzle));
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/entertainment/sudoku/batch')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = { puzzles: ['easy', 'medium', 'hard'] }.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
JSON.parse(response.body)['data']['results'].each do |p|
puts "#{p['difficulty']}: #{p['puzzle'].inspect}"
end
Respuestas de error
The request body is missing or contains malformed JSON.
The puzzles array is missing, empty, exceeds 20 items, or contains a value other than easy, medium, or hard.
Missing API key
Invalid or revoked API key
Get Sudoku Puzzle
Returns a randomly generated Sudoku puzzle and its solution. Difficulty defaults to medium when not specified.
https://requiems.xyz/v1/entertainment/sudoku
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| difficulty | string |
Opcional | Puzzle difficulty level. One of: easy, medium, hard. Defaults to medium. |
Pruébalo
Demostración en vivoSolicitud
Puzzle difficulty level. One of: easy, medium, hard. Defaults to medium.
Campos de respuesta
| Campo | Tipo | Descripción |
|---|---|---|
| difficulty | string |
The difficulty level of the returned puzzle (easy, medium, or hard) |
| puzzle | array<object> |
9×9 grid as an array of 9 rows, each row an array of 9 integers — 0 means an empty cell to be filled in |
| solution | array<object> |
9×9 grid as an array of 9 rows, each row an array of 9 integers — complete, valid solution |
Ejemplos de código
curl "https://requiems.xyz/v1/entertainment/sudoku?difficulty=hard" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://requiems.xyz/v1/entertainment/sudoku"
headers = {"requiems-api-key": "YOUR_API_KEY"}
params = {"difficulty": "hard"}
response = requests.get(url, headers=headers, params=params)
data = response.json()
print(data["data"]["puzzle"])
const response = await fetch(
'https://requiems.xyz/v1/entertainment/sudoku?difficulty=hard',
{ headers: { 'requiems-api-key': 'YOUR_API_KEY' } }
);
const { data } = await response.json();
console.log(data.puzzle);
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/entertainment/sudoku')
uri.query = URI.encode_www_form(difficulty: 'hard')
request = Net::HTTP::Get.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)
puts data['data']['puzzle'].inspect
Respuestas de error
The difficulty parameter is not one of easy, medium, or hard
Missing API key
Invalid or revoked API key