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

# Sync Events

Sync events fire when Cobalt detects changes that occurred directly in your EHR system. These keep you informed about activities your staff performed in the EHR itself — appointments scheduled, patient information updated, and statuses changed.

<Note>
  `appointment.created` and `appointment.updated` also fire as [Operation
  Events](/docs/webhooks/operation-events) when triggered by an RPA action
  Cobalt performed. The event types are the same; the trigger differs.
</Note>

## Payload Envelope

Every sync event uses this envelope:

```json theme={null}
{
  "id": "508c368e7de13b40f9397eec966d0329",
  "access_token_reference_id": "your-reference-id",
  "object": "event",
  "created": "2025-07-28T08:50:42.491-07:00",
  "type": "appointment.updated",
  "data": {
    // Event-specific payload
  }
}
```

| Field                       | Type   | Description                                    |
| --------------------------- | ------ | ---------------------------------------------- |
| `id`                        | string | Unique identifier for this event               |
| `access_token_reference_id` | string | Your reference ID associated with this webhook |
| `object`                    | string | Always `"event"`                               |
| `created`                   | string | ISO 8601 timestamp when the event was created  |
| `type`                      | string | The event type                                 |
| `data`                      | object | Event-specific data payload                    |

## Appointment Events

<AccordionGroup>
  <Accordion title="appointment.created" icon="calendar-plus">
    Triggered when EHR staff create an appointment in your EHR (detected by Cobalt's sync).

    **Payload Example:**

    ```json theme={null}
    {
      "id": "759df7ac-2688-44a9-926c-58d36376b412",
      "access_token_reference_id": "clinic_1",
      "object": "event",
      "created": "2025-07-28T16:05:48.929Z",
      "type": "appointment.created",
      "data": {
        "appointment_id": "c5c0e613fc7d68a1c01ef4160483a0b6",
        "mrn": "44235",
        "date_time": "2025-07-28T16:00:00.000Z",
        "timezone": "America/New_York",
        "provider_id": "defe69ae-f363-4797-87bd-1c70acb52b21",
        "provider_name": "Dr. Jose Gonzalez",
        "secondary_provider_id": null
      }
    }
    ```

    **Data Fields:**

    | Field                   | Type           | Description                                    |
    | ----------------------- | -------------- | ---------------------------------------------- |
    | `appointment_id`        | string         | Cobalt's unique identifier for the appointment |
    | `mrn`                   | string         | Patient's Medical Record Number                |
    | `date_time`             | string         | Appointment date and time (ISO 8601)           |
    | `timezone`              | string         | Timezone for the appointment                   |
    | `provider_id`           | string         | Primary provider's ID                          |
    | `provider_name`         | string         | Primary provider's name                        |
    | `secondary_provider_id` | string \| null | Secondary provider's ID (if applicable)        |
  </Accordion>

  <Accordion title="appointment.updated" icon="calendar-pen">
    Triggered when EHR staff update an appointment in your EHR (detected by Cobalt's sync).

    **Payload Example:**

    ```json theme={null}
    {
      "id": "508c368e7de13b40f9397eec966d0329",
      "access_token_reference_id": "clinic_1",
      "object": "event",
      "created": "2025-07-28T08:50:42.491-07:00",
      "type": "appointment.updated",
      "data": {
        "id": "0551c88b2249945151f967525ee3f7b4",
        "ehr_appointment_id": "482129",
        "patient_mrn": "804",
        "patient_name": "John Doe",
        "datetime": "2025-07-28T16:00:00.000Z",
        "duration": 20,
        "location": "2",
        "status": "2",
        "provider_name": "Dr. Michael Denenberg",
        "appointment_type": "FOLLOW-UP",
        "appointment_mode": "office",
        "updated_fields": {
          "status": "2"
        }
      }
    }
    ```

    **Data Fields:**

    | Field                | Type   | Description                                    |
    | -------------------- | ------ | ---------------------------------------------- |
    | `id`                 | string | Cobalt's unique identifier for the appointment |
    | `ehr_appointment_id` | string | The EHR's native appointment ID                |
    | `patient_mrn`        | string | Patient's Medical Record Number                |
    | `patient_name`       | string | Patient's full name                            |
    | `datetime`           | string | Appointment date and time (ISO 8601)           |
    | `duration`           | number | Appointment duration in minutes                |
    | `location`           | string | Appointment location/room                      |
    | `status`             | string | Appointment status code                        |
    | `provider_name`      | string | Provider's name                                |
    | `appointment_type`   | string | Type of appointment                            |
    | `appointment_mode`   | string | Mode (e.g., "office", "telehealth")            |
    | `updated_fields`     | object | Fields that changed in this update             |
  </Accordion>

  <Accordion title="appointment.status_updated" icon="calendar-check">
    Triggered when an appointment's status changes in your EHR system.

    **Payload Example:**

    ```json theme={null}
    {
      "id": "508c368e7de13b40f9397eec966d0330",
      "access_token_reference_id": "clinic_1",
      "object": "event",
      "created": "2025-07-28T09:15:22.491-07:00",
      "type": "appointment.status_updated",
      "data": {
        "id": "0551c88b2249945151f967525ee3f7b4",
        "ehr_appointment_id": "482129",
        "patient_mrn": "804",
        "patient_name": "John Doe",
        "datetime": "2025-07-28T16:00:00.000Z",
        "status": "checked-in",
        "previous_status": "scheduled",
        "provider_name": "Dr. Michael Denenberg"
      }
    }
    ```

    **Data Fields:**

    | Field                | Type   | Description                                    |
    | -------------------- | ------ | ---------------------------------------------- |
    | `id`                 | string | Cobalt's unique identifier for the appointment |
    | `ehr_appointment_id` | string | The EHR's native appointment ID                |
    | `patient_mrn`        | string | Patient's Medical Record Number                |
    | `patient_name`       | string | Patient's full name                            |
    | `datetime`           | string | Appointment date and time (ISO 8601)           |
    | `status`             | string | New appointment status                         |
    | `previous_status`    | string | Previous appointment status                    |
    | `provider_name`      | string | Provider's name                                |
  </Accordion>
</AccordionGroup>

## Patient Events

<AccordionGroup>
  <Accordion title="patient.updated" icon="user-pen">
    Triggered when patient information is updated in your EHR system.

    **Payload Example:**

    ```json theme={null}
    {
      "id": "508c368e7de13b40f9397eec966d0331",
      "access_token_reference_id": "clinic_1",
      "object": "event",
      "created": "2025-07-28T10:20:15.491-07:00",
      "type": "patient.updated",
      "data": {
        "mrn": "MRN123456",
        "patient_name": "Jane Smith",
        "updated_fields": {
          "phone": "555-9999",
          "email": "jane.newemail@example.com"
        }
      }
    }
    ```

    **Data Fields:**

    | Field            | Type   | Description                        |
    | ---------------- | ------ | ---------------------------------- |
    | `mrn`            | string | Patient's Medical Record Number    |
    | `patient_name`   | string | Patient's full name                |
    | `updated_fields` | object | Fields that changed in this update |
  </Accordion>
</AccordionGroup>

## Claim Events

<AccordionGroup>
  <Accordion title="claim.created" icon="file-invoice-dollar">
    Triggered when a new claim is detected in your EHR (detected by Cobalt's sync).

    **Payload Example:**

    ```json theme={null}
    {
      "id": "759df7ac268844a9926c58d36376b412",
      "access_token_reference_id": "clinic_1",
      "object": "event",
      "created": "2026-07-13T04:12:08.921Z",
      "type": "claim.created",
      "data": {
        "id": "0551c88b2249945151f967525ee3f7b4",
        "emr_claim_id": "73001",
        "emr_appointment_id": "264453",
        "emr_patient_id": "32191",
        "patient_name": "Jane Smith",
        "provider_name": "Dr. Michael Denenberg",
        "service_date": "2026-04-13",
        "claim_date": "2026-04-14",
        "claim_status": "PEN",
        "claim_status_description": "Pending",
        "claim_type": "0",
        "void_flag": false,
        "total_charge": "1233.87",
        "total_payment": "0.00",
        "net_payment": "0.00",
        "balance": "1233.87",
        "net_adjustment": "0.00",
        "patient_responsibility": "0.00",
        "icd_codes": [
          {
            "code": "Z01.411",
            "primary": "1",
            "description": "Encounter for gynecological examination with abnormal findings",
            "icd_version": "10"
          }
        ]
      }
    }
    ```

    **Data Fields:**

    | Field                      | Type           | Description                                             |
    | -------------------------- | -------------- | ------------------------------------------------------- |
    | `id`                       | string         | Cobalt's unique identifier for the claim                |
    | `emr_claim_id`             | string         | The EHR's native claim ID                               |
    | `emr_appointment_id`       | string         | The EHR's appointment/encounter ID the claim belongs to |
    | `emr_patient_id`           | string         | The EHR's patient ID                                    |
    | `patient_name`             | string         | Patient's full name                                     |
    | `emr_provider_id`          | string         | The EHR's provider ID                                   |
    | `provider_name`            | string \| null | Rendering provider's name                               |
    | `service_date`             | string         | Date of service (YYYY-MM-DD)                            |
    | `claim_date`               | string         | Claim date (YYYY-MM-DD)                                 |
    | `claim_status`             | string         | EHR claim status code (e.g. `PEN`)                      |
    | `claim_status_description` | string         | Human-readable claim status                             |
    | `claim_type`               | string         | EHR claim type code                                     |
    | `void_flag`                | boolean        | Whether the claim is voided                             |
    | `total_charge`             | string         | Total billed amount                                     |
    | `total_payment`            | string         | Total payment received                                  |
    | `net_payment`              | string         | Net payment                                             |
    | `balance`                  | string         | Outstanding balance                                     |
    | `net_adjustment`           | string         | Net adjustment                                          |
    | `patient_responsibility`   | string         | Patient responsibility amount                           |
    | `icd_codes`                | array          | ICD-10 diagnosis codes on the claim                     |
  </Accordion>

  <Accordion title="claim.updated" icon="file-pen">
    Triggered when a synced claim changes in your EHR. Only fires when a header field actually changed (for example a status, payment, or balance update), so unchanged claims re-seen during a sync do not emit an event.

    **Payload Example:**

    ```json theme={null}
    {
      "id": "759df7ac268844a9926c58d36376b413",
      "access_token_reference_id": "clinic_1",
      "object": "event",
      "created": "2026-07-13T05:41:22.104Z",
      "type": "claim.updated",
      "data": {
        "id": "0551c88b2249945151f967525ee3f7b4",
        "emr_claim_id": "73001",
        "emr_appointment_id": "264453",
        "emr_patient_id": "32191",
        "patient_name": "Jane Smith",
        "service_date": "2026-04-13",
        "claim_status": "PAID",
        "claim_status_description": "Paid",
        "total_charge": "1233.87",
        "total_payment": "1050.00",
        "balance": "0.00",
        "updated_fields": {
          "claim_status": "PAID",
          "total_payment": "1050.00",
          "balance": "0.00"
        }
      }
    }
    ```

    **Data Fields:**

    The full claim object (same fields as `claim.created`) plus:

    | Field            | Type   | Description                                           |
    | ---------------- | ------ | ----------------------------------------------------- |
    | `updated_fields` | object | Map of the fields that changed, with their new values |
  </Accordion>
</AccordionGroup>
