{
  "openapi": "3.1.1",
  "info": {
    "title": "Finger-Joint Box Generator (laser \u0026 CNC) API",
    "version": "1.0.0",
    "summary": "Laser-cut and CNC finger-joint boxes with kerf compensation, lids and dividers.",
    "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://kerfwisefingerjointbox.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Laser-cut and CNC finger-joint boxes with kerf compensation, lids and dividers.",
        "description": "Generate a finger-joint (box-joint) box from inside or outside dimensions and the material thickness: closed lid, open tray or sliding lid, a grid of cross-halved dividers, kerf compensation for lasers and dog-bone reliefs for CNC routers. Every joint gets an odd number of equal fingers; the parts are nested onto your laser bed or stock sheet and exported as layered SVG, DXF R12, a 1:1 PDF with a scale bar and, for routers, G-code.\n\nMethodology:\n- Outside size = inside size + 2 × thickness in width and depth; in height + 2 × thickness with a lid, + 1 × thickness for an open tray, and + 2 × thickness + the lid slot for a sliding lid.\n- Each panel starts as its full outside rectangle. Where two panels overlap along a box edge, the T × T column is divided into an odd number n of equal fingers (n = the odd number nearest to length ÷ target width). Front and back own the end fingers against the sides, the walls own them against bottom and lid, and a corner cube shared by three panels goes to the highest-ranked one; each panel loses what its neighbours own. A point-sampling check in the test suite confirms that the panels fill the box shell exactly once.\n- Kerf compensation offsets outer outlines outwards and inner cut-outs inwards by half the kerf, so the parts come out at their nominal size. Dog-bones add a circle of the cutter radius through every inside corner so square fingers seat after routing.\n- Dividers are loose, cross-halved where they meet (slots of thickness + fit from the top of one and the bottom of the other). Nesting uses the Kerfwise MaxRects sheet nester; G-code uses the Kerfwise CNC engine (outside profiles with cutter compensation, inner cut-outs first, tabs).\n- 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\nLaser 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_finger_joint_box",
        "x-owner-app": "kerfwise",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KerfwiseFingerJointBoxInput"
              },
              "examples": {
                "example1": {
                  "summary": "Box with lid, 160 × 100 × 60 mm inside, 3 mm plywood",
                  "value": {
                    "width": 160,
                    "depth": 100,
                    "height": 60,
                    "thickness": 3,
                    "finger": 10,
                    "kerf": 0.15,
                    "lid": "closed"
                  }
                },
                "example2": {
                  "summary": "Open tray with 3 × 2 dividers",
                  "value": {
                    "width": 200,
                    "depth": 140,
                    "height": 40,
                    "thickness": 3,
                    "lid": "open",
                    "columns": 3,
                    "rows": 2,
                    "kerf": 0.12
                  }
                },
                "example3": {
                  "summary": "Sliding-lid pencil box nested on a 400 × 300 mm laser bed",
                  "value": {
                    "width": 190,
                    "depth": 60,
                    "height": 35,
                    "thickness": 4,
                    "finger": 8,
                    "lid": "sliding",
                    "sheetWidth": 400,
                    "sheetHeight": 300,
                    "kerf": 0.15
                  }
                },
                "example4": {
                  "summary": "CNC-routed 12 mm plywood crate with dog-bones and GRBL G-code",
                  "value": {
                    "width": 400,
                    "depth": 300,
                    "height": 250,
                    "dims": "outer",
                    "thickness": 12,
                    "finger": 50,
                    "kerf": 0,
                    "lid": "open",
                    "dogbone": 6,
                    "sheetWidth": 1220,
                    "sheetHeight": 1220,
                    "spacing": 10,
                    "cnc": "grbl",
                    "toolDiameter": 6,
                    "feed": 3000,
                    "plunge": 600,
                    "stepdown": 4
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KerfwiseFingerJointBoxResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "KerfwiseFingerJointBoxInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "width": {
            "title": "Width (mm)",
            "type": "number",
            "minimum": 10,
            "maximum": 2000,
            "default": 160
          },
          "depth": {
            "title": "Depth (mm)",
            "type": "number",
            "minimum": 10,
            "maximum": 2000,
            "default": 100
          },
          "height": {
            "title": "Height (mm)",
            "type": "number",
            "minimum": 5,
            "maximum": 2000,
            "default": 60
          },
          "dims": {
            "title": "Dimensions are",
            "type": "string",
            "enum": [
              "inner",
              "outer"
            ],
            "default": "inner"
          },
          "thickness": {
            "title": "Material thickness (mm)",
            "description": "Measure your sheet with calipers: 3 mm plywood is often 2.8–3.2 mm.",
            "type": "number",
            "minimum": 0.5,
            "maximum": 40,
            "default": 3
          },
          "finger": {
            "title": "Finger width (target, mm)",
            "description": "Each joint is divided into an odd number of equal fingers close to this width.",
            "type": "number",
            "minimum": 1,
            "maximum": 500,
            "default": 10
          },
          "kerf": {
            "title": "Kerf compensation (mm, 0 = off)",
            "description": "The width of material the laser burns away. Find it with the kerf test coupon.",
            "type": "number",
            "minimum": 0,
            "maximum": 3,
            "default": 0.15
          },
          "fit": {
            "title": "Fit clearance for slots and sliding lid (mm)",
            "type": "number",
            "minimum": 0,
            "maximum": 3,
            "default": 0.2
          },
          "lid": {
            "title": "Lid",
            "type": "string",
            "enum": [
              "closed",
              "open",
              "sliding"
            ],
            "default": "closed"
          },
          "columns": {
            "title": "Compartments across the width",
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "default": 1
          },
          "rows": {
            "title": "Compartments across the depth",
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "default": 1
          },
          "dogbone": {
            "title": "Dog-bone reliefs for a router bit of diameter (mm, 0 = off)",
            "type": "number",
            "minimum": 0,
            "maximum": 25,
            "default": 0
          },
          "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
          },
          "paper": {
            "title": "PDF pages",
            "type": "string",
            "enum": [
              "fit",
              "a3",
              "a4",
              "a5",
              "a6",
              "b5",
              "letter",
              "legal",
              "tabloid",
              "halfletter"
            ],
            "default": "fit"
          },
          "cnc": {
            "title": "CNC G-code",
            "type": "string",
            "enum": [
              "none",
              "grbl",
              "linuxcnc",
              "fanuc"
            ],
            "default": "none"
          },
          "toolDiameter": {
            "title": "Cutter diameter (mm)",
            "type": "number",
            "minimum": 0.5,
            "maximum": 25,
            "default": 3.175
          },
          "feed": {
            "title": "Feed (mm/min)",
            "type": "number",
            "minimum": 50,
            "maximum": 30000,
            "default": 1200
          },
          "plunge": {
            "title": "Plunge (mm/min)",
            "type": "number",
            "minimum": 20,
            "maximum": 10000,
            "default": 300
          },
          "stepdown": {
            "title": "Depth per pass (mm)",
            "type": "number",
            "minimum": 0.1,
            "maximum": 30,
            "default": 1.5
          }
        },
        "required": []
      },
      "KerfwiseFingerJointBoxResult": {
        "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": [
              "outside",
              "inside",
              "joints",
              "dividers",
              "gcode",
              "sheets",
              "parts",
              "pdfPages",
              "warnings",
              "files",
              "openInApp"
            ],
            "properties": {
              "outside": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "width",
                  "depth",
                  "height"
                ],
                "properties": {
                  "width": {
                    "type": "number"
                  },
                  "depth": {
                    "type": "number"
                  },
                  "height": {
                    "type": "number"
                  }
                }
              },
              "inside": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "width",
                  "depth",
                  "height"
                ],
                "properties": {
                  "width": {
                    "type": "number"
                  },
                  "depth": {
                    "type": "number"
                  },
                  "height": {
                    "type": "number"
                  }
                }
              },
              "joints": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "between",
                    "length",
                    "fingers",
                    "fingerWidth"
                  ],
                  "properties": {
                    "between": {
                      "type": "string"
                    },
                    "length": {
                      "type": "number"
                    },
                    "fingers": {
                      "type": "integer"
                    },
                    "fingerWidth": {
                      "type": "number"
                    }
                  }
                }
              },
              "dividers": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "columns",
                  "rows",
                  "height",
                  "compartmentWidth",
                  "compartmentDepth"
                ],
                "properties": {
                  "columns": {
                    "type": "integer"
                  },
                  "rows": {
                    "type": "integer"
                  },
                  "height": {
                    "type": "number"
                  },
                  "compartmentWidth": {
                    "type": "number"
                  },
                  "compartmentDepth": {
                    "type": "number"
                  }
                }
              },
              "gcode": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "dialect",
                  "sheets",
                  "lines",
                  "timeSec"
                ],
                "properties": {
                  "dialect": {
                    "type": "string"
                  },
                  "sheets": {
                    "type": "integer"
                  },
                  "lines": {
                    "type": "integer"
                  },
                  "timeSec": {
                    "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"
              }
            }
          }
        }
      }
    }
  }
}