Zum Inhalt
HALOWERK

Bürowerk

doc merge

Takes three documents — the common base and the two versions derived from it — as text, public URLs or inline base64, reads PDF, DOCX, ODT, HTML and Markdown, and returns one merged document. The procedure is diff3 over paragraphs, or over lines if you ask for that: each version is first compared against the base with a Myers shortest-edit-script, the two comparisons together yield the passages that are identical in all three, and each region between them is resolved by rule. A region only.

POST https://buero.halowerk.com/v1/doc-merge

Eingaben

Felder des veröffentlichten Eingabeschemas
FeldTypPflichtBeschreibung
baseobjectJaThe common base both versions came from. Exactly one of text, url or content_base64.
aobjectJaThe first version. Same shape as base.
bobjectJaThe second version. Same shape as base.
label_astringNeinName for the first version, used in conflict markers and in the conflict list.
label_bstringNeinName for the second version.
conflict_stylestringNeinmarkers: conflicts appear in merged_text between labelled markers. keep_base: the base wording is kept at the conflict site and the conflict is still reported — this is not a resolution. none: merged_text is withheld while any conflict remains.
merge_unitstringNeinWhat counts as one piece. paragraph: blank lines separate, which is how a contract is read — but two changes inside one paragraph then collide even when they concern different sentences. line: merges more finely and conflicts less often, though a paragraph written as one long line stays one piece either way.
ignore_whitespacebooleanNeinTreat runs of spaces and tabs as one space before comparing. Applied to all three documents alike.
include_word_diffbooleanNeinInclude a word-level diff of each side against the base for every conflict.
max_conflicts_detailedintegerNeinHow many conflicts come back with their full text. Beyond this they are still counted and still marked in merged_text, only without the detail block.
Vollständiges Eingabeschema anzeigen
{
  "type": "object",
  "required": [
    "base",
    "a",
    "b"
  ],
  "additionalProperties": false,
  "properties": {
    "base": {
      "type": "object",
      "additionalProperties": false,
      "description": "The common base both versions came from. Exactly one of text, url or content_base64.",
      "properties": {
        "text": {
          "type": "string",
          "maxLength": 200000,
          "description": "The text directly. Cheapest and clearest — its length is billed as counted here."
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "description": "Public http(s) URL of a PDF, DOCX, ODT, HTML or text file. Private and local addresses are refused."
        },
        "content_base64": {
          "type": "string",
          "maxLength": 4000000,
          "description": "The file inline, base64."
        },
        "filename": {
          "type": "string",
          "maxLength": 260,
          "description": "Only consulted when the bytes carry no recognisable signature."
        },
        "format": {
          "type": "string",
          "enum": [
            "auto",
            "pdf",
            "docx",
            "odt",
            "html",
            "markdown",
            "rtf",
            "text"
          ],
          "default": "auto",
          "description": "Override the detected format. \"auto\" reads it from the bytes."
        }
      }
    },
    "a": {
      "type": "object",
      "additionalProperties": false,
      "description": "The first version. Same shape as base.",
      "properties": {
        "text": {
          "type": "string",
          "maxLength": 200000,
          "description": "The text directly. Cheapest and clearest — its length is billed as counted here."
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "description": "Public http(s) URL of a PDF, DOCX, ODT, HTML or text file. Private and local addresses are refused."
        },
        "content_base64": {
          "type": "string",
          "maxLength": 4000000,
          "description": "The file inline, base64."
        },
        "filename": {
          "type": "string",
          "maxLength": 260,
          "description": "Only consulted when the bytes carry no recognisable signature."
        },
        "format": {
          "type": "string",
          "enum": [
            "auto",
            "pdf",
            "docx",
            "odt",
            "html",
            "markdown",
            "rtf",
            "text"
          ],
          "default": "auto",
          "description": "Override the detected format. \"auto\" reads it from the bytes."
        }
      }
    },
    "b": {
      "type": "object",
      "additionalProperties": false,
      "description": "The second version. Same shape as base.",
      "properties": {
        "text": {
          "type": "string",
          "maxLength": 200000,
          "description": "The text directly. Cheapest and clearest — its length is billed as counted here."
        },
        "url": {
          "type": "string",
          "maxLength": 2048,
          "description": "Public http(s) URL of a PDF, DOCX, ODT, HTML or text file. Private and local addresses are refused."
        },
        "content_base64": {
          "type": "string",
          "maxLength": 4000000,
          "description": "The file inline, base64."
        },
        "filename": {
          "type": "string",
          "maxLength": 260,
          "description": "Only consulted when the bytes carry no recognisable signature."
        },
        "format": {
          "type": "string",
          "enum": [
            "auto",
            "pdf",
            "docx",
            "odt",
            "html",
            "markdown",
            "rtf",
            "text"
          ],
          "default": "auto",
          "description": "Override the detected format. \"auto\" reads it from the bytes."
        }
      }
    },
    "label_a": {
      "type": "string",
      "maxLength": 60,
      "default": "a",
      "description": "Name for the first version, used in conflict markers and in the conflict list."
    },
    "label_b": {
      "type": "string",
      "maxLength": 60,
      "default": "b",
      "description": "Name for the second version."
    },
    "conflict_style": {
      "type": "string",
      "enum": [
        "markers",
        "keep_base",
        "none"
      ],
      "default": "markers",
      "description": "markers: conflicts appear in merged_text between labelled markers. keep_base: the base wording is kept at the conflict site and the conflict is still reported — this is not a resolution. none: merged_text is withheld while any conflict remains."
    },
    "merge_unit": {
      "type": "string",
      "enum": [
        "paragraph",
        "line"
      ],
      "default": "paragraph",
      "description": "What counts as one piece. paragraph: blank lines separate, which is how a contract is read — but two changes inside one paragraph then collide even when they concern different sentences. line: merges more finely and conflicts less often, though a paragraph written as one long line stays one piece either way."
    },
    "ignore_whitespace": {
      "type": "boolean",
      "default": true,
      "description": "Treat runs of spaces and tabs as one space before comparing. Applied to all three documents alike."
    },
    "include_word_diff": {
      "type": "boolean",
      "default": true,
      "description": "Include a word-level diff of each side against the base for every conflict."
    },
    "max_conflicts_detailed": {
      "type": "integer",
      "minimum": 1,
      "maximum": 200,
      "default": 50,
      "description": "How many conflicts come back with their full text. Beyond this they are still counted and still marked in merged_text, only without the detail block."
    }
  }
}

Originalschema öffnen

Veröffentlichtes Eingabebeispiel

{
  "base": {
    "text": "§ 1 Gegenstand\nDer Auftragnehmer liefert Steuergeraete nach Anlage 1.\n\n§ 2 Menge\nGeliefert werden zehn Geraete.\n\n§ 3 Lieferort\nLieferort ist das Werk Ulm.\n\n§ 4 Laufzeit\nDer Vertrag laeuft zwoelf Monate.\n\n§ 5 Gerichtsstand\nGerichtsstand ist Berlin.\n\n§ 6 Zahlung\nDie Verguetung ist binnen 30 Tagen faellig."
  },
  "a": {
    "text": "§ 1 Gegenstand\nDer Auftragnehmer liefert Steuergeraete nach Anlage 1.\n\n§ 2 Menge\nGeliefert werden zwanzig Geraete.\n\n§ 3 Lieferort\nLieferort ist das Werk Ulm.\n\n§ 4 Laufzeit\nDer Vertrag laeuft zwoelf Monate.\n\n§ 5 Gerichtsstand\nGerichtsstand ist Berlin.\n\n§ 6 Zahlung\nDie Verguetung ist binnen 14 Tagen faellig."
  },
  "b": {
    "text": "§ 1 Gegenstand\nDer Auftragnehmer liefert Steuergeraete nach Anlage 1.\n\n§ 2 Menge\nGeliefert werden zehn Geraete.\n\n§ 3 Lieferort\nLieferort ist das Werk Ulm.\n\n§ 4 Laufzeit\nDer Vertrag laeuft vierundzwanzig Monate.\n\n§ 5 Gerichtsstand\nGerichtsstand ist Berlin.\n\n§ 6 Zahlung\nDie Verguetung ist binnen 60 Tagen faellig."
  },
  "label_a": "einkauf",
  "label_b": "recht"
}

Ergebnis & Dokumentation

Maschinenlesbare Dokumentation dieses Hubs

Quelle dieser Seite: der veröffentlichte HALOWERK-Katalog. Stand: 2026-11-01, 15:19 UTC.

Weitere Endpunkte dieses Hubs

Alle Endpunkte dieses Hubs →