> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cairhealth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks: Claim Scrubber

## Overview

Cair Health provides a webhook system that allows you to receive real-time notifications when a claim is processed by the Cair Scrubbing AI. This enables you to integrate your systems with Cair Health and
synchronize your information with Cair. When a claim is finished scrubbing, whether through automated scrub or a scrub triggered manually, the webhook will automatically post the results to your endpoint.

## Setup

To enable webhook delivery for patient chart analysis:

1. Navigate to your [Developer Settings](https://forecaster.cairhealth.com/developer-settings)
2. Go to the Webhooks section
3. Create a new webhook with the following information:
   * **URL**: The endpoint where you want to receive webhook payloads
   * **Event Type**: Select `CLAIMS_AI_OPTIMIZER`
   * **Description**: A description for your reference
   * **Credentials**: Your preferred credentials set

## Event Types

You can subscribe to the following event type for patient chart analysis:

| Event Type            | Description                         |
| --------------------- | ----------------------------------- |
| `CLAIMS_AI_OPTIMIZER` | Receive scrub results when complete |

## Authentication

For security, webhooks can be authenticated using API keys. When setting up your webhook, you can configure:

* **Authentication Type**: Currently supports `API_SECRET`, `HMAC-256`
* **Header Name**: The HTTP header that will contain your secret (e.g., `X-API-KEY`)
* **Secret**: The secret value that will be sent with each webhook request

## Payload Format

The webhook payload contains the complete analysis results in JSON format. Below is an example the structure of the response:

```
{
  "output": {
    "claim_id": "58ba229f-b35c-4e46-9af5-e54df39b6e48",
    "optimizer_run_id": "ba757342-2a29-4972-ab3a-341a04a4bd9b",
    "ai_generated_claim_extended": "Deprecated",
    "ai_generated_encounter_description": "**Claim Summary**\n\n**Complete Encounter Description:**\nThe provided FHIR Claim resource details a professional service encounter for a patient diagnosed with Obesity, class 1 (E66.811) and Other specified anxiety disorders (F41.8). A CPT code 99214 with modifier RT was performed on November 17, 2025, with a charge of $150.00. The claim indicates that the provider accepts assignment. No further clinical narrative or treatment details are explicitly stated in the provided notes.\n\n**Patient Information:**\n* Name: Jane Doe\n* DOB: 10-10-1970\n* Gender: male\n* Address: 891 Cedar Street, Minneapolis, MN 55401\n* Patient ID/Account Number: OV7444602\n\n**Insurance Information:**\n* Primary Insurance Provider: Aetna\n* Payer ID/EDI Number: 60054\n* Insurance Plan: Not specified in notes.\n* Subscriber Name: Jane Doe\n* Subscriber ID: OV7444602\n* Group Number: OV7444602\n* Relationship to Subscriber: Self\n* Claim Filing Indicator Code: CI (Commercial Insurance Co.)\n\n**Billing Provider Information:**\n* Name: Chicago Healthcare Alliance\n* NPI: 2538929880\n* Tax ID: 52-6769967\n* Address: 221 North LaSalle Street, Chicago, IL 60601\n* Contact: Not specified in notes.\n* Taxonomy Code: 282N00000X\n\n**Rendering Provider Information:**\n* Name: Ethan Wilson\n* NPI: 1995116984\n* Taxonomy Code: 208D00000X\n\n**Submitter Information:**\n* Name: Not specified in notes.\n* ID: Not specified in notes.\n* Contact: Not specified in notes.\n\n**Service Information:**\n* Date of Service: 11-17-2025\n* Place of Service: Not specified in notes.\n* Procedures:\n    * 99214 - Office or other outpatient visit for the evaluation and management of an established patient, which requires at least 2 of these 3 key components: A detailed history; A detailed examination; Medical decision making of moderate complexity. Counseling and/or coordination of care with other physicians, other qualified health care professionals, or agencies are provided consistent with the nature of the problem(s) and the patient's and/or family's needs. Typically, 25 minutes are spent face-to-face with the patient and/or family.\n    * Modifier: RT (Right side)\n* Diagnoses:\n    * E66.811 - Obesity, class 1\n    * F41.8 - Other specified anxiety disorders\n* Charges: $150.00\n* Service Units: 1\n* Diagnosis Pointers: 1, 2 (Both diagnoses apply to the procedure)\n\n**Claim Details:**\n* Assignment of Benefits: Not specified in notes.\n* Accept Assignment: Yes\n* Release of Information: Not specified in notes.\n* Provider Signature on File: Not specified in notes.\n* Prior Authorization Numbers: Not specified in notes.\n* Referral Number: Not specified in notes.\n* Special Billing Notes: Not specified in notes.\n* Related to: Not specified in notes.\n\n**Missing Information:**\n* Insurance Plan\n* Billing Provider Contact\n* Submitter Name\n* Submitter ID\n* Submitter Contact\n* Place of Service\n* Assignment of Benefits\n* Release of Information\n* Provider Signature on File\n* Prior Authorization Numbers\n* Referral Number\n* Special Billing Notes\n* Related to (Employment, Auto Accident, Other Accident)",
    "ai_generated_x12_837": "{\n  \"resourceType\": \"Claim\",\n  \"id\": \"58ba229f-b35c-4e46-9af5-e54df39b6e48\",\n  \"status\": \"active\",\n  \"type\": {\n    \"coding\": [\n      {\n        \"code\": \"professional\",\n        \"system\": \"http://terminology.hl7.org/CodeSystem/claim-type\"\n      }\n    ]\n  },\n  \"patient\": {\n    \"type\": \"Patient\",\n    \"reference\": \"Patient/79c87bbd-9de4-41bb-a25f-0f78bfb41c4c\"\n  },\n  \"use\": \"claim\",\n  \"created\": \"2025-11-21\",\n  \"insurer\": {\n    \"type\": \"Organization\",\n    \"reference\": \"Organization/c9060e87-15c0-4b82-8a7d-f0faee2d456d\"\n  },\n  \"provider\": {\n    \"type\": \"Organization\",\n    \"reference\": \"Organization/7e294528-4edb-40df-ad50-9da07d05d195\"\n  },\n  \"priority\": {\n    \"coding\": [\n      {\n        \"code\": \"normal\",\n        \"system\": \"http://terminology.hl7.org/CodeSystem/processpriority\",\n        \"display\": \"Normal\"\n      }\n    ]\n  },\n  \"supportingInfo\": [\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"code\": \"Y\",\n            \"system\": \"https://bluebutton.cms.gov/assets/ig/CodeSystem-asgmntcd\",\n            \"display\": \"Yes\"\n          }\n        ]\n      },\n      \"category\": {\n        \"coding\": [\n          {\n            \"code\": \"acceptassignment\",\n            \"system\": \"http://terminology.hl7.org/CodeSystem/claiminformationcategory\",\n            \"display\": \"Accept Assignment\"\n          }\n        ]\n      },\n      \"sequence\": 1\n    },\n    {\n      \"code\": {\n        \"coding\": [\n          {\n            \"code\": \"CI\",\n            \"system\": \"https://x12.org/codes/claim-filing-indicator-code\",\n            \"display\": \"Commercial Insurance Co.\"\n          }\n        ]\n      },\n      \"category\": {\n        \"coding\": [\n          {\n            \"code\": \"claim-filing-indicator\",\n            \"system\": \"https://fhir.cairhealth.com/fhir/CodeSystem/claim-additional-information-category\",\n            \"display\": \"Claim Filing Indicator Code\"\n          }\n        ]\n      },\n      \"sequence\": 2\n    }\n  ],\n  \"careTeam\": [\n    {\n      \"sequence\": 1,\n      \"provider\": {\n        \"type\": \"Organization\",\n        \"reference\": \"Organization/7e294528-4edb-40df-ad50-9da07d05d195\"\n      },\n      \"role\": {\n        \"coding\": [\n          {\n            \"code\": \"primary\",\n            \"system\": \"http://terminology.hl7.org/CodeSystem/claimcareteamrole\",\n            \"display\": \"Billing Provider\"\n          }\n        ]\n      },\n      \"responsible\": true,\n      \"qualification\": {\n        \"coding\": [\n          {\n            \"code\": \"282N00000X\",\n            \"system\": \"http://nucc.org/provider-taxonomy\",\n            \"display\": \"General Acute Care Hospital\"\n          }\n        ]\n      }\n    },\n    {\n      \"sequence\": 2,\n      \"provider\": {\n        \"type\": \"Practitioner\",\n        \"reference\": \"Practitioner/95a40f30-9bf2-4030-ad46-b655a654d33a\"\n      },\n      \"role\": {\n        \"coding\": [\n          {\n            \"code\": \"rendering\",\n            \"system\": \"http://terminology.hl7.org/CodeSystem/claimcareteamrole\",\n            \"display\": \"Rendering Provider\"\n          }\n        ]\n      },\n      \"responsible\": false,\n      \"qualification\": {\n        \"coding\": [\n          {\n            \"code\": \"208D00000X\",\n            \"system\": \"http://nucc.org/provider-taxonomy\",\n            \"display\": \"General Practice Physician\"\n          }\n        ]\n      }\n    }\n  ],\n  \"diagnosis\": [\n    {\n      \"sequence\": 1,\n      \"diagnosisCodeableConcept\": {\n        \"coding\": [\n          {\n            \"code\": \"E66.811\",\n            \"system\": \"http://hl7.org/fhir/sid/icd-10-cm\",\n            \"display\": \"Obesity, class 1\"\n          }\n        ]\n      },\n      \"type\": [\n        {\n          \"coding\": [\n            {\n              \"code\": \"principal\",\n              \"system\": \"http://terminology.hl7.org/CodeSystem/ex-diagnosistype\"\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"sequence\": 2,\n      \"diagnosisCodeableConcept\": {\n        \"coding\": [\n          {\n            \"code\": \"F41.8\",\n            \"system\": \"http://hl7.org/fhir/sid/icd-10-cm\",\n            \"display\": \"Other specified anxiety disorders\"\n          }\n        ]\n      },\n      \"type\": [\n        {\n          \"coding\": [\n            {\n              \"code\": \"secondary\",\n              \"system\": \"http://terminology.hl7.org/CodeSystem/ex-diagnosistype\"\n            }\n          ]\n        }\n      ]\n    }\n  ],\n  \"insurance\": [\n    {\n      \"coverage\": {\n        \"type\": \"Coverage\",\n        \"reference\": \"Coverage/c81bb743-734c-4663-81b5-34329058cfb7\"\n      },\n      \"focal\": true,\n      \"sequence\": 1\n    }\n  ],\n  \"item\": [\n    {\n      \"sequence\": 1,\n      \"careTeamSequence\": [\n        2\n      ],\n      \"diagnosisSequence\": [\n        1,\n        2\n      ],\n      \"productOrService\": {\n        \"coding\": [\n          {\n            \"code\": \"99214\",\n            \"system\": \"http://www.ama-assn.org/go/cpt\"\n          }\n        ]\n      },\n      \"modifier\": [\n        {\n          \"coding\": [\n            {\n              \"code\": \"RT\",\n              \"system\": \"https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets\",\n              \"display\": \"Right side\"\n            }\n          ]\n        }\n      ],\n      \"servicedDate\": \"2025-11-17\",\n      \"locationCodeableConcept\": {\n        \"coding\": [\n          {\n            \"system\": \"https://bluebutton.cms.gov/resources/variables/line_place_of_srvc_cd/",\n            \"code\": \"11\",\n            \"display\": \"Office\"\n          }\n        ]\n      },\n      \"quantity\": {\n        \"value\": 1\n      },\n      \"unitPrice\": {\n        \"value\": 150.0,\n        \"currency\": \"USD\"\n      },\n      \"net\": {\n        \"value\": 150.0,\n        \"currency\": \"USD\"\n      }\n    },\n    {\n      \"sequence\": 2,\n      \"careTeamSequence\": [\n        2\n      ],\n      \"diagnosisSequence\": [\n        1\n      ],\n      \"productOrService\": {\n        \"coding\": [\n          {\n            \"code\": \"3008F\",\n            \"system\": \"http://www.ama-assn.org/go/cpt\"\n          }\n        ]\n      },\n      \"servicedDate\": \"2025-11-17\",\n      \"locationCodeableConcept\": {\n        \"coding\": [\n          {\n            \"system\": \"https://bluebutton.cms.gov/resources/variables/line_place_of_srvc_cd/",\n            \"code\": \"11\",\n            \"display\": \"Office\"\n          }\n        ]\n      },\n      \"quantity\": {\n        \"value\": 1\n      },\n      \"unitPrice\": {\n        \"value\": 75.0,\n        \"currency\": \"USD\"\n      },\n      \"net\": {\n        \"value\": 75.0,\n        \"currency\": \"USD\"\n      }\n    }\n  ],\n  \"total\": {\n    \"value\": 225.0,\n    \"currency\": \"USD\"\n  },\n  \"identifier\": [\n    {\n      \"value\": \"52343746129383\",\n      \"system\": \"https://fhir.cairhealth.com/fhir/identifier/claim-id\",\n      \"assigner\": {\n        \"type\": \"Organization\",\n        \"reference\": \"Organization/7e294528-4edb-40df-ad50-9da07d05d195\"\n      }\n    }\n  ],\n  \"extension\": [\n    {\n      \"url\": \"https://fhir.cairhealth.com/StructureDefinition/claim-patient-paid\",\n      \"valueMoney\": {\n        \"value\": 0,\n        \"currency\": \"USD\"\n      }\n    }\n  ],\n  \"meta\": {\n    \"extension\": [\n      {\n        \"url\": \"https://aidbox.app/tenant-organization-id\",\n        \"valueReference\": {\n          \"reference\": \"Organization/cair-health\"\n        }\n      },\n      {\n        \"url\": \"https://aidbox.app/ex/createdAt\",\n        \"valueInstant\": \"2025-12-19T15:43:39.855972Z\"\n      }\n    ],\n    \"lastUpdated\": \"2025-12-19T15:43:39.855972Z\",\n    \"versionId\": \"16515281\"\n  }\n}",
    "relevant_rules_report": "{\n  \"rules_flagged\": [],\n  \"rules_applied\": [\n    {\n      \"id\": \"35924ec9-d150-4955-852f-4773b92243ad\",\n      \"text\": \"If the patient is diagnosed with Obesity (any diagnosis code with (EXX), add service line item 3008F with 1 unit and a cost of 75.00\",\n      \"tags\": \"\"\n    },\n    {\n      \"id\": \"c0327e2a-4cbc-43c9-9571-9de5fb3419d7\",\n      \"text\": \"All Aetna claims should be billed with place of service code 11\",\n      \"tags\": null\n    }\n  ]\n}",
    "edits": [
      {
        "difference": "The patient, coverage, insurer, provider, and care team elements in the generated claim are represented as references, while the uploaded claim included full resource objects for these elements.",
        "rationale": "The system instructions explicitly require that these elements be represented as references only, omitting the full resource details, to ensure compliance with FHIR schema for references."
      },
      {
        "difference": "The second diagnosis's sequence was changed from 1 to 2.",
        "rationale": "Diagnosis sequence numbers must be unique for each diagnosis entry."
      },
      {
        "difference": "The type of the second diagnosis (F41.8) was changed from 'principal' to 'secondary'.",
        "rationale": "Typically, a claim should only have one principal diagnosis. The second diagnosis was reclassified as secondary."
      },
      {
        "difference": "A second service line item was added to the claim.",
        "rationale": "The rule \"If the patient is diagnosed with Obesity (any diagnosis code with (EXX), add service line item 3008F with 1 unit and a cost of 75.00\" and the enforcement criteria explicitly required the inclusion of procedure code 3008F for the patient's obesity diagnosis."
      }
    ],
    "additional_info": {
      "organization_id": "ca12ca12-f9e0-4467-b55f-78874bd1468e",
      "user_id": "ca12ca12-f9e0-4467-b55f-78874bd1468e",
      "custom_guidelines": "",
      "eligibility_check_info": ""
    }
  }
}
```

`ai_generated_x12_837` will be a stringified-JSON of the FHIR Claim resource representing the encounter. `edits` will contain AI-generated modifications from the original claim including rationales.
