{
  "openapi": "3.1.1",
  "info": {
    "title": "Project Backup Builder API",
    "version": "1.0.0",
    "summary": "Combine usefulweb project files into one Bundlekeep backup with checksums.",
    "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://bundlekeepbackupbuilder.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Combine usefulweb project files into one Bundlekeep backup with checksums.",
        "description": "Give a list of project files from any usefulweb premium apps: the tool packs them unchanged into one Bundlekeep backup, names each file after its project, skips identical copies and records a SHA-256 checksum per file.\n\nMethodology:\n- Each entry is kept as text: entries given with \"content\" stay byte for byte, project objects are written as indented JSON. Entries must be JSON objects or arrays of at most 10 MB.\n- File names come from the entry or from the project name plus the app’s extension (for example kitchen.kerfwise.json); clashing names get a number, names without folders or reserved characters are enforced.\n- Identical files (same SHA-256 of the text) are added once. Limits: 200 files and 50 MB per backup.\n- The backup only records a date when you enter one, so the same files and settings always produce the identical backup file and checksum.\n- The backup is the Bundlekeep format described in project.schema.json; open it in Bundlekeep to review, verify and restore single files.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "bundlekeep_backup_builder",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BundlekeepBackupBuilderInput"
              },
              "examples": {
                "example1": {
                  "summary": "Back up a cabinet and a circuit",
                  "value": {}
                },
                "example2": {
                  "summary": "Keep exact file names and skip a duplicate",
                  "value": {
                    "name": "Studio files",
                    "projects": "[{\"name\":\"my-base-cabinet.kerfwise.json\",\"content\":\"{\\n  \\\"format\\\": \\\"kerfwise\\\",\\n  \\\"version\\\": 1,\\n  \\\"name\\\": \\\"Base cabinet 600\\\",\\n  \\\"cabinets\\\": [\\n    {\\n      \\\"id\\\": \\\"c1\\\",\\n      \\\"name\\\": \\\"Base 600\\\",\\n      \\\"type\\\": \\\"base\\\",\\n      \\\"x\\\": 0,\\n      \\\"y\\\": 0,\\n      \\\"rot\\\": 0,\\n      \\\"params\\\": {\\n        \\\"width\\\": 600,\\n        \\\"height\\\": 870,\\n        \\\"depth\\\": 560,\\n        \\\"doorCount\\\": 1,\\n        \\\"shelfCount\\\": 1,\\n        \\\"topType\\\": \\\"rails\\\",\\n        \\\"countertop\\\": false\\n      }\\n    }\\n  ]\\n}\"},{\"name\":\"copy.json\",\"content\":\"{\\n  \\\"format\\\": \\\"kerfwise\\\",\\n  \\\"version\\\": 1,\\n  \\\"name\\\": \\\"Base cabinet 600\\\",\\n  \\\"cabinets\\\": [\\n    {\\n      \\\"id\\\": \\\"c1\\\",\\n      \\\"name\\\": \\\"Base 600\\\",\\n      \\\"type\\\": \\\"base\\\",\\n      \\\"x\\\": 0,\\n      \\\"y\\\": 0,\\n      \\\"rot\\\": 0,\\n      \\\"params\\\": {\\n        \\\"width\\\": 600,\\n        \\\"height\\\": 870,\\n        \\\"depth\\\": 560,\\n        \\\"doorCount\\\": 1,\\n        \\\"shelfCount\\\": 1,\\n        \\\"topType\\\": \\\"rails\\\",\\n        \\\"countertop\\\": false\\n      }\\n    }\\n  ]\\n}\"},{\"format\":\"twinworks-project\",\"version\":1,\"name\":\"3-station line\",\"active\":\"base\",\"scenarios\":[{\"id\":\"base\",\"name\":\"Baseline\",\"notes\":\"\",\"model\":{\"format\":\"twinworks-model\",\"version\":1,\"name\":\"3-station line\",\"description\":\"A simple serial line: random arrivals, three machines with triangular cycle times and two small buffers. The classic starting point.\",\"settings\":{\"horizon\":28800,\"warmup\":1800,\"seed\":12345,\"replications\":5,\"confidence\":0.95,\"sampleInterval\":null,\"currency\":\"EUR\",\"timeUnit\":\"s\",\"lengthUnit\":\"m\",\"gridSize\":0.5},\"products\":[{\"id\":\"P1\",\"name\":\"Bracket\",\"color\":\"#2563eb\",\"priority\":0,\"materialCost\":4.2,\"price\":19,\"routing\":[]}],\"calendars\":[],\"pools\":[],\"nodes\":[{\"id\":\"SRC1\",\"type\":\"source\",\"name\":\"Raw parts\",\"x\":2,\"y\":6,\"rotation\":0,\"calendar\":null,\"routing\":\"first\",\"note\":\"\",\"arrival\":\"interval\",\"interval\":{\"type\":\"exponential\",\"mean\":55},\"firstAt\":0,\"batchSize\":1,\"maxArrivals\":null,\"mix\":[],\"schedule\":[],\"repeatEvery\":null,\"whenBlocked\":\"queue\"},{\"id\":\"M1\",\"type\":\"machine\",\"name\":\"Saw\",\"x\":6,\"y\":6,\"rotation\":0,\"calendar\":null,\"routing\":\"first\",\"note\":\"\",\"servers\":1,\"cycle\":{\"type\":\"triangular\",\"min\":35,\"mode\":40,\"max\":50},\"cycleByProduct\":{},\"setup\":null,\"idealCycleTime\":null,\"batchSize\":1,\"scrapPct\":0,\"failure\":null,\"maintenance\":null,\"operator\":null,\"costPerHour\":38,\"costPerPart\":0},{\"id\":\"B1\",\"type\":\"buffer\",\"name\":\"Buffer 1\",\"x\":10,\"y\":6,\"rotation\":0,\"calendar\":null,\"routing\":\"first\",\"note\":\"\",\"capacity\":5,\"discipline\":\"fifo\"},{\"id\":\"M2\",\"type\":\"machine\",\"name\":\"Mill\",\"x\":14,\"y\":6,\"rotation\":0,\"calendar\":null,\"routing\":\"first\",\"note\":\"\",\"servers\":1,\"cycle\":{\"type\":\"triangular\",\"min\":40,\"mode\":48,\"max\":58},\"cycleByProduct\":{},\"setup\":null,\"idealCycleTime\":null,\"batchSize\":1,\"scrapPct\":0,\"failure\":null,\"maintenance\":null,\"operator\":null,\"costPerHour\":65,\"costPerPart\":0},{\"id\":\"B2\",\"type\":\"buffer\",\"name\":\"Buffer 2\",\"x\":18,\"y\":6,\"rotation\":0,\"calendar\":null,\"routing\":\"first\",\"note\":\"\",\"capacity\":5,\"discipline\":\"fifo\"},{\"id\":\"M3\",\"type\":\"machine\",\"name\":\"Deburr\",\"x\":22,\"y\":6,\"rotation\":0,\"calendar\":null,\"routing\":\"first\",\"note\":\"\",\"servers\":1,\"cycle\":{\"type\":\"triangular\",\"min\":30,\"mode\":38,\"max\":45},\"cycleByProduct\":{},\"setup\":null,\"idealCycleTime\":null,\"batchSize\":1,\"scrapPct\":0,\"failure\":null,\"maintenance\":null,\"operator\":null,\"costPerHour\":30,\"costPerPart\":0},{\"id\":\"OUT1\",\"type\":\"sink\",\"name\":\"Finished goods\",\"x\":26,\"y\":6,\"rotation\":0,\"calendar\":null,\"routing\":\"first\",\"note\":\"\"}],\"links\":[{\"id\":\"L1\",\"from\":\"SRC1\",\"to\":\"M1\",\"weight\":1,\"products\":[],\"kind\":\"normal\",\"qty\":1},{\"id\":\"L2\",\"from\":\"M1\",\"to\":\"B1\",\"weight\":1,\"products\":[],\"kind\":\"normal\",\"qty\":1},{\"id\":\"L3\",\"from\":\"B1\",\"to\":\"M2\",\"weight\":1,\"products\":[],\"kind\":\"normal\",\"qty\":1},{\"id\":\"L4\",\"from\":\"M2\",\"to\":\"B2\",\"weight\":1,\"products\":[],\"kind\":\"normal\",\"qty\":1},{\"id\":\"L5\",\"from\":\"B2\",\"to\":\"M3\",\"weight\":1,\"products\":[],\"kind\":\"normal\",\"qty\":1},{\"id\":\"L6\",\"from\":\"M3\",\"to\":\"OUT1\",\"weight\":1,\"products\":[],\"kind\":\"normal\",\"qty\":1}],\"cost\":{\"overheadPerHour\":20,\"scrapDisposal\":0},\"notes\":[]}}]}]",
                    "created": "2026-10-31"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BundlekeepBackupBuilderResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "BundlekeepBackupBuilderInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "title": "Backup name",
            "type": "string",
            "maxLength": 120,
            "default": "My project backup"
          },
          "projects": {
            "title": "Project files (JSON array)",
            "description": "Either project objects, or {\"name\": \"file.json\", \"content\": \"<project text>\"} to keep the exact text and name.",
            "type": "string",
            "maxLength": 14000000,
            "default": "[\n  {\n    \"format\": \"kerfwise\",\n    \"version\": 1,\n    \"name\": \"Base cabinet 600\",\n    \"cabinets\": [\n      {\n        \"id\": \"c1\",\n        \"name\": \"Base 600\",\n        \"type\": \"base\",\n        \"x\": 0,\n        \"y\": 0,\n        \"rot\": 0,\n        \"params\": {\n          \"width\": 600,\n          \"height\": 870,\n          \"depth\": 560,\n          \"doorCount\": 1,\n          \"shelfCount\": 1,\n          \"topType\": \"rails\",\n          \"countertop\": false\n        }\n      }\n    ]\n  },\n  {\n    \"format\": \"ohmforge\",\n    \"version\": 1,\n    \"name\": \"LED with series resistor\",\n    \"parts\": [\n      {\n        \"id\": \"BT1\",\n        \"kind\": \"battery\",\n        \"x\": 0,\n        \"y\": 0,\n        \"rot\": 0,\n        \"flip\": false,\n        \"props\": {\n          \"voltage\": \"9\",\n          \"rint\": \"1\"\n        }\n      },\n      {\n        \"id\": \"SW1\",\n        \"kind\": \"switch\",\n        \"x\": 4,\n        \"y\": -6,\n        \"rot\": 0,\n        \"flip\": false,\n        \"props\": {\n          \"closed\": true,\n          \"ron\": \"10m\"\n        }\n      },\n      {\n        \"id\": \"R1\",\n        \"kind\": \"resistor\",\n        \"x\": 10,\n        \"y\": -6,\n        \"rot\": 0,\n        \"flip\": false,\n        \"props\": {\n          \"value\": \"390\",\n          \"power\": \"0.25\",\n          \"tolerance\": \"5%\"\n        }\n      },\n      {\n        \"id\": \"D1\",\n        \"kind\": \"led\",\n        \"x\": 14,\n        \"y\": -4,\n        \"rot\": 90,\n        \"flip\": false,\n        \"props\": {\n          \"colour\": \"red\",\n          \"imax\": \"20m\"\n        }\n      },\n      {\n        \"id\": \"GND1\",\n        \"kind\": \"ground\",\n        \"x\": 0,\n        \"y\": 4,\n        \"rot\": 0,\n        \"flip\": false,\n        \"props\": {}\n      }\n    ],\n    \"wires\": [\n      {\n        \"id\": \"w1\",\n        \"pts\": [\n          [\n            0,\n            -2\n          ],\n          [\n            0,\n            -6\n          ],\n          [\n            2,\n            -6\n          ]\n        ]\n      },\n      {\n        \"id\": \"w2\",\n        \"pts\": [\n          [\n            6,\n            -6\n          ],\n          [\n            8,\n            -6\n          ]\n        ]\n      },\n      {\n        \"id\": \"w3\",\n        \"pts\": [\n          [\n            12,\n            -6\n          ],\n          [\n            14,\n            -6\n          ]\n        ]\n      },\n      {\n        \"id\": \"w4\",\n        \"pts\": [\n          [\n            14,\n            -2\n          ],\n          [\n            14,\n            4\n          ],\n          [\n            0,\n            4\n          ],\n          [\n            0,\n            2\n          ]\n        ]\n      }\n    ],\n    \"notes\": [\n      {\n        \"id\": \"n1\",\n        \"x\": 17,\n        \"y\": -7,\n        \"text\": \"R = (9 V − 1.9 V) / 0.02 A ≈ 355 Ω → 390 Ω\"\n      },\n      {\n        \"id\": \"n2\",\n        \"x\": 17,\n        \"y\": -5,\n        \"text\": \"Try 47 Ω to see the LED burn out\"\n      }\n    ],\n    \"sim\": {\n      \"mode\": \"op\",\n      \"tran\": {\n        \"tstop\": \"10m\",\n        \"tstep\": \"10u\",\n        \"method\": \"trap\",\n        \"uic\": false\n      },\n      \"ac\": {\n        \"fstart\": \"10\",\n        \"fstop\": \"1Meg\",\n        \"ppd\": 20\n      },\n      \"dc\": {\n        \"start\": \"0\",\n        \"stop\": \"10\",\n        \"step\": \"0.1\"\n      },\n      \"speed\": 0.001\n    },\n    \"description\": \"Sizing an LED resistor: R = (Vs − Vf) / If = (9 V − 1.9 V) / 20 mA ≈ 355 Ω → 390 Ω (E12), giving ≈ 18 mA.\",\n    \"instruments\": {\n      \"meter\": {\n        \"mode\": \"A\",\n        \"part\": \"D1\"\n      }\n    }\n  }\n]"
          },
          "notes": {
            "title": "Backup notes (optional)",
            "type": "string",
            "maxLength": 4000,
            "default": ""
          },
          "created": {
            "title": "Backup date (optional)",
            "description": "Recorded as the backup and file date. Empty = no date, so the same files always give the identical backup.",
            "type": "string",
            "format": "date"
          }
        },
        "required": []
      },
      "BundlekeepBackupBuilderResult": {
        "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": [
              "summary",
              "inventory",
              "skippedDuplicates",
              "backupFile"
            ],
            "properties": {
              "summary": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "files",
                  "bytes",
                  "apps",
                  "unknown",
                  "embeddedDataUrls",
                  "verified",
                  "changed",
                  "unchecked",
                  "warnings"
                ],
                "properties": {
                  "files": {
                    "type": "integer"
                  },
                  "bytes": {
                    "type": "integer"
                  },
                  "apps": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "integer"
                    }
                  },
                  "unknown": {
                    "type": "integer"
                  },
                  "embeddedDataUrls": {
                    "type": "integer"
                  },
                  "verified": {
                    "type": "integer"
                  },
                  "changed": {
                    "type": "integer"
                  },
                  "unchecked": {
                    "type": "integer"
                  },
                  "warnings": {
                    "type": "integer"
                  }
                }
              },
              "inventory": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "name",
                    "app",
                    "format",
                    "projectName",
                    "bytes",
                    "embeddedDataUrls",
                    "sha256",
                    "check",
                    "warnings"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "app": {
                      "type": "string"
                    },
                    "format": {
                      "type": "string"
                    },
                    "projectName": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer"
                    },
                    "embeddedDataUrls": {
                      "type": "integer"
                    },
                    "sha256": {
                      "type": "string"
                    },
                    "check": {
                      "enum": [
                        "verified",
                        "changed",
                        "unchecked"
                      ]
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "skippedDuplicates": {
                "type": "integer"
              },
              "backupFile": {
                "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)."
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}