{
  "openapi": "3.1.1",
  "info": {
    "title": "Ohmforge Wire Gauge, Voltage Drop & Harness Calculator API",
    "version": "1.0.0",
    "summary": "Wire size from current, length and voltage drop; AWG ↔ mm²; harness cut list, BOM and netlist check.",
    "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://ohmforgewiregauge.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Wire size from current, length and voltage drop; AWG ↔ mm²; harness cut list, BOM and netlist check.",
        "description": "Pick the conductor for a DC, single-phase or three-phase run from the current, the cable length and the voltage drop you allow, with copper or aluminium at the conductor temperature — results in AWG and in metric mm², with drop, power loss and a fuse suggestion as guidance. Convert between AWG and mm² with the ASTM B258 formula, or turn a harness wire list into a cut list with allowances, a bill of materials per gauge and colour, CSV exports and a continuity check against an Ohmforge schematic.\n\nMethodology:\n- Resistance R = ρ(T)·L/A with ρ(T) = ρ20·(1 + α20·(T − 20 °C)). Copper: ρ20 = 1/58 Ω·mm²/m (IEC 60028 annealed copper, 100 % IACS), α20 = 0.00393 /K. Aluminium: ρ20 = 0.028264 Ω·mm²/m (61 % IACS, IEC 60889), α20 = 0.00403 /K.\n- Voltage drop ΔV = k·I·ρ·L/A with k = 2 for a feed and return wire (DC, single-phase), 1 for a chassis return (chassis resistance ignored) and √3 for a balanced three-phase line. The smallest conductor is A = k·ρ·L·I/ΔVmax; the tool picks the smallest AWG and the smallest IEC 60228 size at or above it and reports drop and loss (I²R in all current-carrying conductors).\n- AWG diameter d = 0.127 mm × 92^((36 − n)/39) (ASTM B258), with n = −3 … 0 for 4/0 … 1/0; area = πd²/4 of a solid conductor (stranded wire of the same gauge has about the same copper area).\n- Fuse guidance: the next standard rating at or above 125 % of the continuous load current. The fuse must also be at or below the current rating (ampacity) of the chosen wire, which depends on insulation, bundling, ambient temperature and the applicable standard; ampacity is deliberately not computed here.\n- Harness: cut length = routed length × (1 + slack %) + 2 × allowance per end. The bill of materials groups the cut lengths by gauge and colour. The continuity check joins all harness wires (splices included) and compares every group with the schematic's nets: a group spanning two nets is a short, a net spread over several groups is open, and a pin of a part the harness touches that has no wire is missing.\n\nElectrical safety: this is a design aid, not a substitute for the wiring rules that apply to you (for example IEC 60364/VDE 0100, NEC/NFPA 70, ISO 10133 or ABYC E-11 for boats, vehicle manufacturer rules). Wire current ratings (ampacity) and fuse selection must be checked against those rules and the cable maker's data. Mains installations must be done by a qualified electrician.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "ohmforge_wire_gauge",
        "x-owner-app": "ohmforge",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OhmforgeWireGaugeInput"
              },
              "examples": {
                "example1": {
                  "summary": "12 V, 20 A over 5 m (van or boat)",
                  "value": {
                    "mode": "size",
                    "voltage": 12,
                    "current": 20,
                    "lengthM": 5,
                    "circuit": "dc",
                    "maxDropPercent": 3,
                    "temperatureC": 20,
                    "material": "copper",
                    "fuseSeries": "blade"
                  }
                },
                "example2": {
                  "summary": "Solar: 24 V, 15 A, 12 m, 2 % drop at 60 °C",
                  "value": {
                    "mode": "size",
                    "voltage": 24,
                    "current": 15,
                    "lengthM": 12,
                    "circuit": "dc",
                    "maxDropPercent": 2,
                    "temperatureC": 60,
                    "material": "copper",
                    "fuseSeries": "blade"
                  }
                },
                "example3": {
                  "summary": "AWG ↔ mm²: what is 2.5 mm² in AWG?",
                  "value": {
                    "mode": "table",
                    "convert": "2.5 mm²",
                    "material": "copper",
                    "temperatureC": 20
                  }
                },
                "example4": {
                  "summary": "Harness of a 12 V lamp circuit, checked against its schematic",
                  "value": {
                    "mode": "harness",
                    "wires": "# id, from, to, length (m), gauge, colour\nW1, BT1.+, F1.1, 0.30, 4 mm², RD\nW2, F1.2, SW1.1, 1.20, 1.5 mm², RD\nW3, SW1.2, LP1.1, 2.50, 1.5 mm², YE\nW4, LP1.2, BT1.-, 2.80, 1.5 mm², BK\n",
                    "allowancePerEndMm": 20,
                    "slackPercent": 5,
                    "project": "{\"format\":\"ohmforge\",\"version\":1,\"name\":\"12 V lamp harness\",\"parts\":[{\"id\":\"BT1\",\"kind\":\"battery\",\"x\":0,\"y\":0,\"rot\":0,\"flip\":false,\"props\":{\"voltage\":\"12\",\"rint\":\"0.02\"}},{\"id\":\"F1\",\"kind\":\"fuse\",\"x\":6,\"y\":-6,\"rot\":0,\"flip\":false,\"props\":{\"rating\":\"5\",\"tblow\":\"100m\",\"r\":\"0.1\"}},{\"id\":\"SW1\",\"kind\":\"switch\",\"x\":14,\"y\":-6,\"rot\":0,\"flip\":false,\"props\":{\"closed\":true,\"ron\":\"10m\"}},{\"id\":\"LP1\",\"kind\":\"lamp\",\"x\":20,\"y\":0,\"rot\":90,\"flip\":false,\"props\":{\"voltage\":\"12\",\"power\":\"21\"}},{\"id\":\"GND1\",\"kind\":\"ground\",\"x\":0,\"y\":2,\"rot\":0,\"flip\":false,\"props\":{}}],\"wires\":[{\"id\":\"w1\",\"pts\":[[0,-2],[0,-6],[4,-6]]},{\"id\":\"w2\",\"pts\":[[8,-6],[12,-6]]},{\"id\":\"w3\",\"pts\":[[16,-6],[20,-6],[20,-2]]},{\"id\":\"w4\",\"pts\":[[20,2],[0,2]]}],\"notes\":[],\"sim\":{\"mode\":\"op\",\"tran\":{\"tstop\":\"10m\",\"tstep\":\"10u\",\"method\":\"trap\",\"uic\":false},\"ac\":{\"fstart\":\"10\",\"fstop\":\"1Meg\",\"ppd\":20},\"dc\":{\"start\":\"0\",\"stop\":\"10\",\"step\":\"0.1\"},\"speed\":0.001},\"description\":\"Battery, fuse, switch and lamp of a small vehicle circuit. Instruments → Wiring harness… builds the wire list from these connections.\"}"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OhmforgeWireGaugeResult"
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      },
      "OhmforgeWireGaugeInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mode": {
            "title": "Task",
            "type": "string",
            "enum": [
              "size",
              "table",
              "harness"
            ],
            "default": "size"
          },
          "voltage": {
            "title": "Supply voltage",
            "description": "Three-phase: line-to-line voltage.",
            "type": "number",
            "minimum": 0.001,
            "maximum": 1000000,
            "default": 12,
            "x-unit": "V"
          },
          "current": {
            "title": "Load current",
            "type": "number",
            "minimum": 0.000001,
            "maximum": 100000,
            "default": 20,
            "x-unit": "A"
          },
          "lengthM": {
            "title": "Cable length (one way)",
            "description": "Distance from the source to the load; the return conductor is added automatically.",
            "type": "number",
            "minimum": 0.001,
            "maximum": 1000000,
            "default": 5,
            "x-unit": "m"
          },
          "circuit": {
            "title": "Circuit",
            "type": "string",
            "enum": [
              "dc",
              "chassis",
              "three-phase"
            ],
            "default": "dc"
          },
          "maxDropPercent": {
            "title": "Allowed voltage drop",
            "type": "number",
            "minimum": 0.01,
            "maximum": 50,
            "default": 3,
            "x-unit": "%"
          },
          "temperatureC": {
            "title": "Conductor temperature",
            "description": "Resistance rises about 0.4 % per °C; use the operating temperature for a conservative result.",
            "type": "number",
            "minimum": -60,
            "maximum": 250,
            "default": 20,
            "x-unit": "°C"
          },
          "material": {
            "title": "Conductor",
            "type": "string",
            "enum": [
              "copper",
              "aluminium"
            ],
            "default": "copper"
          },
          "fuseSeries": {
            "title": "Fuse ratings",
            "type": "string",
            "enum": [
              "blade",
              "iec"
            ],
            "default": "blade"
          },
          "convert": {
            "title": "Size to convert (table)",
            "description": "For example 12 AWG, 4/0, 2.5 mm² or 0.75mm2.",
            "type": "string",
            "maxLength": 32,
            "default": "2.5 mm²"
          },
          "wires": {
            "title": "Wire list (harness)",
            "description": "One wire per line: id, from, to, length, gauge, colour (comma, semicolon or tab). Ends as REF.PIN (BT1.+, F1.1) to check them against a schematic; ends without a dot are splices or studs.",
            "type": "string",
            "maxLength": 200000,
            "default": "# id, from, to, length (m), gauge, colour\nW1, BT1.+, F1.1, 0.30, 4 mm², RD\nW2, F1.2, SW1.1, 1.20, 1.5 mm², RD\nW3, SW1.2, LP1.1, 2.50, 1.5 mm², YE\nW4, LP1.2, BT1.-, 2.80, 1.5 mm², BK\n"
          },
          "lengthUnit": {
            "title": "Length unit of the wire list",
            "type": "string",
            "enum": [
              "m",
              "mm"
            ],
            "default": "m"
          },
          "bareGauge": {
            "title": "A bare whole number in the gauge column means",
            "type": "string",
            "enum": [
              "awg",
              "metric"
            ],
            "default": "awg"
          },
          "allowancePerEndMm": {
            "title": "Strip and termination allowance per end",
            "type": "number",
            "minimum": 0,
            "maximum": 1000,
            "default": 20,
            "x-unit": "mm"
          },
          "slackPercent": {
            "title": "Slack and service loops",
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "default": 5,
            "x-unit": "%"
          },
          "project": {
            "title": "Ohmforge project for the continuity check (optional)",
            "description": "Paste a .ohmforge.json project; the harness is checked against its nets.",
            "type": "string",
            "maxLength": 400000
          }
        },
        "required": []
      },
      "OhmforgeWireGaugeResult": {
        "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",
            "required": [
              "mode",
              "sizing",
              "table",
              "conversion",
              "harness"
            ],
            "additionalProperties": false,
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "size",
                  "table",
                  "harness"
                ]
              },
              "sizing": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "properties": {
                  "material": {
                    "type": "string"
                  },
                  "temperatureC": {
                    "type": "number"
                  },
                  "resistivityOhmMm2PerM": {
                    "type": "number"
                  },
                  "circuit": {
                    "type": "string"
                  },
                  "pathFactor": {
                    "type": "number"
                  },
                  "voltage": {
                    "type": "number"
                  },
                  "current": {
                    "type": "number"
                  },
                  "lengthM": {
                    "type": "number"
                  },
                  "maxDropPercent": {
                    "type": "number"
                  },
                  "maxDropV": {
                    "type": "number"
                  },
                  "minAreaMm2": {
                    "type": "number"
                  },
                  "awg": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "label": {
                        "type": "string"
                      },
                      "system": {
                        "type": "string"
                      },
                      "areaMm2": {
                        "type": "number"
                      },
                      "conductorOhms": {
                        "type": "number"
                      },
                      "dropV": {
                        "type": "number"
                      },
                      "dropPercent": {
                        "type": "number"
                      },
                      "lossW": {
                        "type": "number"
                      },
                      "meetsDrop": {
                        "type": "boolean"
                      }
                    }
                  },
                  "metric": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "label": {
                        "type": "string"
                      },
                      "system": {
                        "type": "string"
                      },
                      "areaMm2": {
                        "type": "number"
                      },
                      "conductorOhms": {
                        "type": "number"
                      },
                      "dropV": {
                        "type": "number"
                      },
                      "dropPercent": {
                        "type": "number"
                      },
                      "lossW": {
                        "type": "number"
                      },
                      "meetsDrop": {
                        "type": "boolean"
                      }
                    }
                  },
                  "table": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "system": {
                          "type": "string"
                        },
                        "areaMm2": {
                          "type": "number"
                        },
                        "conductorOhms": {
                          "type": "number"
                        },
                        "dropV": {
                          "type": "number"
                        },
                        "dropPercent": {
                          "type": "number"
                        },
                        "lossW": {
                          "type": "number"
                        },
                        "meetsDrop": {
                          "type": "boolean"
                        }
                      }
                    }
                  },
                  "fuse": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "continuousA": {
                        "type": "number"
                      },
                      "suggestedA": {
                        "type": [
                          "number",
                          "null"
                        ]
                      },
                      "series": {
                        "type": "string"
                      }
                    }
                  },
                  "notes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "table": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "awg": {
                      "type": "integer"
                    },
                    "label": {
                      "type": "string"
                    },
                    "diameterMm": {
                      "type": "number"
                    },
                    "diameterIn": {
                      "type": "number"
                    },
                    "areaMm2": {
                      "type": "number"
                    },
                    "kcmil": {
                      "type": "number"
                    },
                    "ohmsPerKm": {
                      "type": "number"
                    },
                    "metricAtLeast": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  }
                }
              },
              "conversion": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "properties": {
                  "input": {
                    "type": "string"
                  },
                  "areaMm2": {
                    "type": "number"
                  },
                  "diameterMm": {
                    "type": "number"
                  },
                  "nearestAwg": {
                    "type": "string"
                  },
                  "nearestAwgAreaMm2": {
                    "type": "number"
                  },
                  "differencePercent": {
                    "type": "number"
                  },
                  "metricAtLeast": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "metricBelow": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "ohmsPerKm": {
                    "type": "number"
                  }
                }
              },
              "harness": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "properties": {
                  "cutList": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string"
                        },
                        "gauge": {
                          "type": "string"
                        },
                        "areaMm2": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "colour": {
                          "type": "string"
                        },
                        "lengthM": {
                          "type": "number"
                        },
                        "cutLengthM": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "bom": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "gauge": {
                          "type": "string"
                        },
                        "colour": {
                          "type": "string"
                        },
                        "wires": {
                          "type": "integer"
                        },
                        "lengthM": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "gaugeTotals": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "gauge": {
                          "type": "string"
                        },
                        "wires": {
                          "type": "integer"
                        },
                        "lengthM": {
                          "type": "number"
                        }
                      }
                    }
                  },
                  "totalRoutedM": {
                    "type": "number"
                  },
                  "totalCutM": {
                    "type": "number"
                  },
                  "allowancePerEndMm": {
                    "type": "number"
                  },
                  "slackPercent": {
                    "type": "number"
                  },
                  "check": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": false,
                    "properties": {
                      "ok": {
                        "type": "boolean"
                      },
                      "netsChecked": {
                        "type": "integer"
                      },
                      "netsOk": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "issues": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "short",
                                "open",
                                "missing",
                                "unknown-pin"
                              ]
                            },
                            "text": {
                              "type": "string"
                            },
                            "nets": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "pins": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "warnings": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "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"
              }
            }
          }
        }
      }
    }
  }
}