{
  "openapi": "3.1.1",
  "info": {
    "title": "Graph, Dot, Isometric, Hex and Music Paper API",
    "version": "1.0.0",
    "summary": "Printable grid, dot, isometric, hexagon, music staff and lined paper at exact sizes.",
    "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://printshopgraphpaper.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Printable grid, dot, isometric, hexagon, music staff and lined paper at exact sizes.",
        "description": "Make printable paper with a square grid (with major lines), dot grid, isometric triangles, hexagons, music staves or writing lines. Spacing is exact in millimetres, the grid is centred on the page and a 10 cm scale bar lets you check the printer scale.\n\nMethodology:\n- Square and dot grids use whole cells centred in the area inside the margin, so leftover space is split evenly. Major lines count from the first line.\n- Isometric paper draws three families of lines (horizontal and ±60°) that form equilateral triangles of the given side; hexagons are regular with the given side, in offset rows (pointy top) or columns (flat top).\n- Music staves have five lines with the given spacing and a gap of 1.75 staff heights between staves. Lined paper starts one line spacing below the top margin.\n\nPrint at 100 % (actual size) and check the 10 cm scale bar: “fit to page” changes every spacing.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "printshop_graph_paper",
        "x-owner-app": "printshop",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintshopGraphPaperInput"
              },
              "examples": {
                "example1": {
                  "summary": "5 mm grid with centimetre lines",
                  "value": {
                    "kind": "grid",
                    "spacing": 5,
                    "majorEvery": 2
                  }
                },
                "example2": {
                  "summary": "Dot grid journal page",
                  "value": {
                    "kind": "dots",
                    "spacing": 5,
                    "majorEvery": 0,
                    "color": "#8f9aa6"
                  }
                },
                "example3": {
                  "summary": "Isometric drawing paper",
                  "value": {
                    "kind": "isometric",
                    "spacing": 8,
                    "majorEvery": 0
                  }
                },
                "example4": {
                  "summary": "Music staff paper",
                  "value": {
                    "kind": "music",
                    "spacing": 2,
                    "header": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrintshopGraphPaperResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "PrintshopGraphPaperInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "kind": {
            "title": "Paper type",
            "type": "string",
            "enum": [
              "grid",
              "dots",
              "isometric",
              "hex",
              "music",
              "lined"
            ],
            "default": "grid"
          },
          "spacing": {
            "title": "Spacing (mm, 0 = usual for the paper type)",
            "description": "Grid/dot pitch, triangle or hexagon side, line distance, or the distance between two staff lines. 0 uses 5 mm for grid and dots, 8 mm for isometric, hexagons and lined paper, 2 mm for music staves.",
            "type": "number",
            "minimum": 0,
            "maximum": 50,
            "default": 0
          },
          "majorEvery": {
            "title": "Major line every … cells",
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "default": 5
          },
          "lineWidth": {
            "title": "Line width (mm)",
            "type": "number",
            "minimum": 0.05,
            "maximum": 2,
            "default": 0.15
          },
          "color": {
            "title": "Line colour",
            "type": "string",
            "maxLength": 7,
            "default": "#9db7d5"
          },
          "majorColor": {
            "title": "Major line colour",
            "type": "string",
            "maxLength": 7,
            "default": "#5f86b5"
          },
          "margin": {
            "title": "Margin (mm)",
            "type": "number",
            "minimum": 0,
            "maximum": 50,
            "default": 10
          },
          "marginLine": {
            "title": "Margin line for lined paper (mm from the left)",
            "type": "number",
            "minimum": 0,
            "maximum": 200,
            "default": 0
          },
          "header": {
            "title": "Name and date line at the top",
            "type": "boolean",
            "default": false
          },
          "hexOrientation": {
            "title": "Hexagon orientation",
            "type": "string",
            "enum": [
              "pointy",
              "flat"
            ],
            "default": "pointy"
          },
          "pages": {
            "title": "Pages",
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "default": 1
          },
          "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": []
      },
      "PrintshopGraphPaperResult": {
        "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": [
              "kind",
              "spacingMm",
              "cellsPerPage",
              "pages",
              "pageWidthMm",
              "pageHeightMm",
              "warnings",
              "files",
              "openInApp"
            ],
            "properties": {
              "kind": {
                "type": "string"
              },
              "spacingMm": {
                "type": "number"
              },
              "cellsPerPage": {
                "type": "integer"
              },
              "pages": {
                "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"
              }
            }
          }
        }
      }
    }
  }
}