문서 비교
문서 비교
POST /api/v1/embed/compare는 Word의 '검토 > 비교 > 문서 비교'처럼 두 .docx 버전을 비교해, 모든 차이를 변경 내용 추적(삽입과 삭제, 작성자는 options.author)으로 기록한 수정본과 JSON 요약을 반환합니다. Word나 임베드 편집기에서 열어 변경마다 적용하거나 거부할 수 있습니다. output_format "json"이면 요약만 반환합니다.
curl https://mroffice.ai/api/v1/embed/compare \
-H "Authorization: Bearer $MROFFICE_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"original": { "url": "https://files.example.com/signed/msa-v1.docx" },
"revised": { "url": "https://files.example.com/signed/msa-v2.docx" },
"options": { "author": "Legal review" }
}'- 두 문서에 이미 있는 변경 내용 추적은 먼저 적용된 것으로 처리합니다(Word도 같은 것을 묻습니다).
- 단락과 표는 텍스트로 맞춥니다. 원본에만 있는 단락은 삭제, 수정본에만 있는 단락은 삽입, 제자리에서 바뀐 단락은 단어 단위로 비교합니다(options.granularity "character"면 문자 단위).
- 바뀌지 않은 단어와 삽입된 단어는 수정본의 서식, 삭제된 단어는 원본의 서식을 유지합니다. 삭제된 그림은 이미지와 함께 옮겨집니다.
- 표는 행과 셀 단위로 비교하며, 한 버전에만 있는 행은 삽입되거나 삭제된 행입니다.
- 비교하지 않는 것: 서식만의 변경, 이동(삭제와 삽입으로 표시), 머리글, 바닥글, 각주, 메모.
| 옵션 | 의미 |
|---|---|
original, revised | { url | upload_id | data_base64, name? }, 둘 다 .docx. |
options.author | 변경 작성자(기본 MR Office). |
options.date | 날짜, ISO 8601(기본은 지금). |
options.granularity | word(기본, Word와 같음) 또는 character. |
output_format | docx(기본) 또는 json. |
result.comparison은 삽입과 삭제 수(와 단어 수)를 세고 각 변경을 위치와 함께 나열합니다. 작업에는 처음 200개, json 출력에는 전부(최대 1,000개)가 들어갑니다.
"result": {
"filename": "msa-v2-comparison.docx",
"comparison": {
"identical": false,
"insertions": 4, "deletions": 3, "words_inserted": 11, "words_deleted": 7,
"author": "Legal review", "date": "2026-11-21T09:00:00Z", "granularity": "word",
"changes": [
{ "type": "replace", "location": "paragraph 3", "original_text": "30 days", "text": "45 days" },
{ "type": "delete", "location": "paragraph 9", "original_text": "This clause survives termination." },
{ "type": "insert", "location": "paragraph 12 (table row)", "text": "Support\tIncluded" }
],
"changes_truncated": false
}
}