{
  "openapi": "3.1.1",
  "info": {
    "title": "Sudoku Maker (4×4 to 16×16, with Answer Key) API",
    "version": "1.0.0",
    "summary": "Printable sudokus with one solution, graded by the solving techniques needed.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://printshopsudoku.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Printable sudokus with one solution, graded by the solving techniques needed.",
        "description": "Make printable sudokus from 4 × 4 for young children to 16 × 16 for experts. Every puzzle is proven to have exactly one solution, its difficulty is graded by the techniques a person needs (singles, locked candidates, pairs, triples, X-wing), and answer-key pages follow. Up to six per page, as a true-size PDF.\n\nMethodology:\n- A full grid is filled by a randomised depth-first search that always tries the cell with the fewest candidates. Clues are then removed in a seeded order (in pairs when symmetric); a removal is kept only when a counting solver still finds exactly one solution — a count that runs out of its node budget keeps the clue, so uniqueness is always proven.\n- Difficulty: a logic solver applies techniques from simple to hard — naked and hidden singles (easy), locked candidates (medium), naked and hidden pairs, naked triples and X-wing (hard). The grade is the hardest technique it needed; “expert” puzzles are unique but need more (chains or trial and error). For easy and medium a removal is also undone when the puzzle would need harder techniques.\n- Easy puzzles keep at least 45 % of the cells as clues, medium at least 32 %. Several digging orders are tried and the one that matches the requested level best is kept; the printed level is always the measured one.\n\nDifficulty is measured by technique, not by solving time; people find different techniques hard. 16 × 16 grids have a time budget and may keep a few extra clues.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "printshop_sudoku",
        "x-owner-app": "printshop",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintshopSudokuInput"
              },
              "examples": {
                "example1": {
                  "summary": "Four medium 9 × 9 sudokus on one page",
                  "value": {
                    "size": "9",
                    "difficulty": "medium",
                    "count": 4,
                    "perPage": "4",
                    "seed": "sudoku-1"
                  }
                },
                "example2": {
                  "summary": "Six easy 6 × 6 sudokus for children",
                  "value": {
                    "size": "6",
                    "difficulty": "easy",
                    "count": 6,
                    "perPage": "6",
                    "seed": "kids-1"
                  }
                },
                "example3": {
                  "summary": "One hard 12 × 12 sudoku",
                  "value": {
                    "size": "12",
                    "difficulty": "hard",
                    "count": 1,
                    "perPage": "1",
                    "seed": "big-1"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrintshopSudokuResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PrintshopSudokuInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "size": {
            "title": "Grid size",
            "type": "string",
            "enum": [
              "4",
              "6",
              "8",
              "9",
              "12",
              "16"
            ],
            "default": "9"
          },
          "difficulty": {
            "title": "Difficulty",
            "type": "string",
            "enum": [
              "easy",
              "medium",
              "hard",
              "expert"
            ],
            "default": "medium"
          },
          "count": {
            "title": "Number of sudokus",
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "default": 4
          },
          "perPage": {
            "title": "Sudokus per page",
            "type": "string",
            "enum": [
              "1",
              "2",
              "4",
              "6"
            ],
            "default": "4"
          },
          "symmetric": {
            "title": "Symmetric clues (180° rotation)",
            "type": "boolean",
            "default": true
          },
          "seed": {
            "title": "Seed",
            "description": "The same seed and settings always give the same puzzles. Change it for new ones.",
            "type": "string",
            "maxLength": 80,
            "default": "sudoku-1"
          },
          "title": {
            "title": "Title on the page (optional)",
            "type": "string",
            "maxLength": 120,
            "default": ""
          },
          "answers": {
            "title": "Answer-key pages",
            "type": "boolean",
            "default": true
          },
          "header": {
            "title": "Name and date line",
            "type": "boolean",
            "default": true
          },
          "paper": {
            "title": "Paper size",
            "type": "string",
            "enum": [
              "a3",
              "a4",
              "a5",
              "a6",
              "b5",
              "letter",
              "legal",
              "tabloid",
              "halfletter"
            ],
            "default": "a4"
          },
          "orientation": {
            "title": "Orientation",
            "type": "string",
            "enum": [
              "portrait",
              "landscape"
            ],
            "default": "portrait"
          }
        },
        "required": []
      },
      "PrintshopSudokuResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "size",
              "puzzles",
              "seed",
              "pages",
              "puzzlePages",
              "answerPages",
              "pageWidthMm",
              "pageHeightMm",
              "warnings",
              "files",
              "openInApp"
            ],
            "properties": {
              "size": {
                "type": "integer"
              },
              "puzzles": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "puzzle",
                    "solution",
                    "clues",
                    "difficulty",
                    "requested"
                  ],
                  "properties": {
                    "puzzle": {
                      "type": "string"
                    },
                    "solution": {
                      "type": "string"
                    },
                    "clues": {
                      "type": "integer"
                    },
                    "difficulty": {
                      "type": "string"
                    },
                    "requested": {
                      "type": "string"
                    }
                  }
                }
              },
              "seed": {
                "type": "string"
              },
              "pages": {
                "type": "integer"
              },
              "puzzlePages": {
                "type": "integer"
              },
              "answerPages": {
                "type": "integer"
              },
              "pageWidthMm": {
                "type": "number"
              },
              "pageHeightMm": {
                "type": "number"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "files": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "pdf",
                  "svg",
                  "png"
                ],
                "properties": {
                  "pdf": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "artifactId",
                      "filename",
                      "mime",
                      "bytes",
                      "sha256",
                      "path"
                    ],
                    "properties": {
                      "artifactId": {
                        "type": "string"
                      },
                      "filename": {
                        "type": "string"
                      },
                      "mime": {
                        "type": "string"
                      },
                      "bytes": {
                        "type": "integer"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string",
                        "description": "Download path on the same site (valid for about 2 hours)."
                      }
                    }
                  },
                  "svg": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "artifactId",
                      "filename",
                      "mime",
                      "bytes",
                      "sha256",
                      "path"
                    ],
                    "properties": {
                      "artifactId": {
                        "type": "string"
                      },
                      "filename": {
                        "type": "string"
                      },
                      "mime": {
                        "type": "string"
                      },
                      "bytes": {
                        "type": "integer"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string",
                        "description": "Download path on the same site (valid for about 2 hours)."
                      }
                    }
                  },
                  "png": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "artifactId",
                      "filename",
                      "mime",
                      "bytes",
                      "sha256",
                      "path"
                    ],
                    "properties": {
                      "artifactId": {
                        "type": "string"
                      },
                      "filename": {
                        "type": "string"
                      },
                      "mime": {
                        "type": "string"
                      },
                      "bytes": {
                        "type": "integer"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string",
                        "description": "Download path on the same site (valid for about 2 hours)."
                      }
                    }
                  }
                }
              },
              "openInApp": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}