Skip to main content

POST /api/diff

Compare two messages and return field-level differences. Public — no authentication required.

Request Body

FieldTypeDefaultDescription
leftMessagestringRequiredBaseline message
rightMessagestringRequiredComparison message
standardstringAuto-detecthl7, fhir, ncpdp
ignoredFieldsstring[][]Fields to exclude (e.g., ["PID.3", "MSH.10"])

Example

curl
curl -X POST https://api.pidgeon.health/api/diff \
  -H "Content-Type: application/json" \
  -d '{
    "leftMessage": "MSH|^~\\&|SENDER|FAC|RECV|DEST|20260222||ADT^A01|12345|P|2.3\rPID|1||MRN001^^^MRN||DOE^JOHN||19800101|M",
    "rightMessage": "MSH|^~\\&|SENDER|FAC|RECV|DEST|20260222||ADT^A01|12345|P|2.3\rPID|1||MRN001^^^MRN||DOE^JANE||19800101|F",
    "standard": "hl7",
    "ignoredFields": ["MSH.10"]
  }'

Response

{
  "success": true,
  "data": {
    "differences": [
      {
        "field": "PID.5.1",
        "leftValue": "JOHN",
        "rightValue": "JANE",
        "changeType": "modified"
      },
      {
        "field": "PID.8",
        "leftValue": "M",
        "rightValue": "F",
        "changeType": "modified"
      }
    ],
    "totalDifferences": 2,
    "ignoredFields": ["MSH.10"]
  },
  "error": null
}