{
  "openapi": "3.1.1",
  "info": {
    "title": "Box Dieline Generator (tuck box, pillow box, gift box) API",
    "version": "1.0.0",
    "summary": "Printable and cuttable box templates with cut and fold lines for Cricut, Silhouette and lasers.",
    "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://kerfwiseboxdieline.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Printable and cuttable box templates with cut and fold lines for Cricut, Silhouette and lasers.",
        "description": "Make a folding box template at your exact size: reverse tuck-end box, pillow box, two-piece gift box (base and lid), pyramid or sleeve. Cut lines and fold lines sit on separate layers (or fold lines become perforations), the board thickness is added at the folds, and you get layered SVG and DXF for cutting machines plus a 1:1 PDF with a scale bar, tiled onto A4/Letter when the net is larger.\n\nMethodology:\n- Each net is a tree of panels joined by fold lines. Panels between two folds are one board thickness larger than the inside size (L + t, W + t, H + t), so the box closes around its contents. The cut outline is the boundary of the union of all panels; fold lines are the hinges between them.\n- Reverse tuck-end: four walls and a glue flap, the top lid on the back and the bottom lid on the front, rounded tuck flaps and tapered dust flaps. Gift box: base and lid trays with corner flaps; the lid is sized to slip over the base (inside = base outside + 1 mm). Pyramid: faces fold up by 180° − atan(height ÷ half base); glue flaps fold by the angle between the neighbouring face normals. Pillow box: curved ends are circular arcs with the given curve depth (sagitta).\n- The 3-D preview folds the same panel tree about every hinge (Rodrigues rotation), so the preview also checks the net. The pillow preview is illustrative.\n- Fold lines go to a blue score layer (Cricut: set the layer to Score and attach it; Silhouette: cut by line colour; laser: low-power pass), or become 4 mm cuts with 2 mm bridges on the cut layer. SVG files use millimetres (width/height in mm, 1 user unit = 1 mm) with one group per layer: cut (red #e4002b), score (blue #0067c5), engrave (black) and labels (grey). DXF R12 uses the same layers, millimetres, y up.\n\nTemplates are starting points: make one test box from scrap card before cutting a batch, and check the print scale with the 10 cm scale bar. Laser cutters and CNC routers can start fires and release harmful fumes: never leave the machine unattended, use extraction, and never cut PVC, vinyl or other chlorine-containing plastics. Sizes, kerf and fit are starting points — check them with a test cut and follow your machine maker's safety rules.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "kerfwise_box_dieline",
        "x-owner-app": "kerfwise",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KerfwiseBoxDielineInput"
              },
              "examples": {
                "example1": {
                  "summary": "Reverse tuck-end box for a 63 × 88 mm card deck",
                  "value": {
                    "style": "tuck-end",
                    "length": 66,
                    "width": 22,
                    "height": 92,
                    "caliper": 0.35
                  }
                },
                "example2": {
                  "summary": "Pillow box for a small gift",
                  "value": {
                    "style": "pillow",
                    "length": 90,
                    "height": 140,
                    "caliper": 0.3
                  }
                },
                "example3": {
                  "summary": "Two-piece gift box on A4, perforated folds",
                  "value": {
                    "style": "gift",
                    "length": 80,
                    "width": 80,
                    "height": 40,
                    "caliper": 0.4,
                    "foldStyle": "perforated",
                    "paper": "a4"
                  }
                },
                "example4": {
                  "summary": "Pyramid box",
                  "value": {
                    "style": "pyramid",
                    "length": 70,
                    "width": 70,
                    "height": 80,
                    "caliper": 0.3
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KerfwiseBoxDielineResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "KerfwiseBoxDielineInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "style": {
            "title": "Box style",
            "type": "string",
            "enum": [
              "tuck-end",
              "pillow",
              "gift",
              "pyramid",
              "sleeve"
            ],
            "default": "tuck-end"
          },
          "length": {
            "title": "Inside length — front width (mm)",
            "type": "number",
            "minimum": 10,
            "maximum": 1000,
            "default": 70
          },
          "width": {
            "title": "Inside width — depth (mm)",
            "type": "number",
            "minimum": 5,
            "maximum": 1000,
            "default": 40
          },
          "height": {
            "title": "Inside height (mm)",
            "description": "Pyramid: apex height. Sleeve: length of the sleeve.",
            "type": "number",
            "minimum": 5,
            "maximum": 1000,
            "default": 100
          },
          "caliper": {
            "title": "Board thickness (mm)",
            "description": "Paper 0.1–0.2, card 0.3–0.5, chipboard 1–2 mm.",
            "type": "number",
            "minimum": 0,
            "maximum": 5,
            "default": 0.4
          },
          "glue": {
            "title": "Glue flap width (mm)",
            "type": "number",
            "minimum": 3,
            "maximum": 50,
            "default": 12
          },
          "extra": {
            "title": "Lid height (gift box) or curve depth (pillow box), mm, 0 = automatic",
            "type": "number",
            "minimum": 0,
            "maximum": 1000,
            "default": 0
          },
          "notch": {
            "title": "Finger notch (tuck-end box, sleeve)",
            "type": "boolean",
            "default": true
          },
          "sheetWidth": {
            "title": "Sheet or laser bed width (mm, 0 = no sheet)",
            "description": "With a sheet size the parts are nested onto as many sheets as needed; 0 lays every part out in one drawing.",
            "type": "number",
            "minimum": 0,
            "maximum": 5000,
            "default": 0
          },
          "sheetHeight": {
            "title": "Sheet or laser bed height (mm, 0 = no sheet)",
            "type": "number",
            "minimum": 0,
            "maximum": 5000,
            "default": 0
          },
          "spacing": {
            "title": "Gap between parts (mm)",
            "description": "For CNC routing use at least the cutter diameter.",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 4
          },
          "labels": {
            "title": "Part names on a separate label layer",
            "type": "boolean",
            "default": true
          },
          "foldStyle": {
            "title": "Fold lines",
            "type": "string",
            "enum": [
              "score",
              "perforated"
            ],
            "default": "score"
          },
          "paper": {
            "title": "PDF pages",
            "type": "string",
            "enum": [
              "fit",
              "a3",
              "a4",
              "a5",
              "a6",
              "b5",
              "letter",
              "legal",
              "tabloid",
              "halfletter"
            ],
            "default": "fit"
          }
        },
        "required": []
      },
      "KerfwiseBoxDielineResult": {
        "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": [
              "style",
              "folded",
              "flat",
              "angles",
              "sheets",
              "parts",
              "pdfPages",
              "warnings",
              "files",
              "openInApp"
            ],
            "properties": {
              "style": {
                "type": "string"
              },
              "folded": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "length",
                  "width",
                  "height"
                ],
                "properties": {
                  "length": {
                    "type": "number"
                  },
                  "width": {
                    "type": "number"
                  },
                  "height": {
                    "type": "number"
                  }
                }
              },
              "flat": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "id",
                    "name",
                    "width",
                    "height",
                    "foldLength",
                    "cutLength"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "width": {
                      "type": "number"
                    },
                    "height": {
                      "type": "number"
                    },
                    "foldLength": {
                      "type": "number"
                    },
                    "cutLength": {
                      "type": "number"
                    }
                  }
                }
              },
              "angles": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "faceNS",
                  "faceEW",
                  "flap"
                ],
                "properties": {
                  "faceNS": {
                    "type": "number"
                  },
                  "faceEW": {
                    "type": "number"
                  },
                  "flap": {
                    "type": "number"
                  }
                }
              },
              "sheets": {
                "type": "integer"
              },
              "parts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "label",
                    "name",
                    "width",
                    "height",
                    "sheet"
                  ],
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "width": {
                      "type": "number"
                    },
                    "height": {
                      "type": "number"
                    },
                    "sheet": {
                      "type": "integer"
                    }
                  }
                }
              },
              "pdfPages": {
                "type": "integer"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "files": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "pdf"
                ],
                "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)."
                      }
                    }
                  }
                }
              },
              "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"
              }
            }
          }
        }
      }
    }
  }
}