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

# Contact

> Event payload details and trigger documentation for Contact data from Spruce

<img src="https://mintcdn.com/morfhealth/EU2WCxuXGIUQcziR/images/spruce.svg?fit=max&auto=format&n=EU2WCxuXGIUQcziR&q=85&s=8a74ebc9757cf4bfebab7b5e33a27182" alt="images/spruce.svg" width="24" height="24" data-path="images/spruce.svg" />

# Events

## Triggering Webhook Types

The following event types are associated with the Contact event payload from Spruce.

* `Spruce Contact Created`
* `Spruce Contact Updated`
* `Spruce Contact Deleted`
* `Spruce Contact Merged`

<RequestExample>
  ```json Example theme={null}
  {
    "api_url": "https://api.sprucehealth.com/v1/contacts/contact_12345",
    "app_url": "https://app.sprucehealth.com/contacts/contact_12345",
    "can_delete": null,
    "can_edit": null,
    "category": "patient",
    "company_name": "ACME Healthcare",
    "created_at": "2023-11-13T17:42:17Z",
    "custom_contact_fields": [
      {
        "id": "entityCustomField_0E5QDGJC03000",
        "name": "Insurance Provider",
        "value": "Blue Cross Blue Shield"
      }
    ],
    "date_of_birth": "1990-01-15",
    "deleted_contact_ids": [
      "entity_0E5QDGJC03001"
    ],
    "display_name": "John Doe",
    "email_addresses": [
      {
        "id": "entityContact_26RRC7PQ6JG00",
        "label": "primary",
        "value": "john.doe@example.com"
      }
    ],
    "fax_numbers": [
      {
        "display_value": "(555) 123-4567",
        "id": "entityContact_26RRC7PQ6JG00",
        "label": "mobile",
        "value": null
      }
    ],
    "first_name": "John",
    "gender": "male",
    "gender_detail": null,
    "has_account": null,
    "has_pending_invite": null,
    "id": "entity_0E5QDGJC03000",
    "integration_links": [
      {
        "contact_id": "entity_0E5QDGJC03000",
        "external_id": "ext_12345",
        "integration_type": "epic",
        "url": "https://hint.com/patient/100031277"
      }
    ],
    "internal_member_ids": [],
    "last_name": "Doe",
    "middle_name": "Smith",
    "object": "contact",
    "organization_contact_fields": [
      {
        "id": "managedCustomField_0E5QDGJC03000",
        "name": "Patient ID",
        "value": "PT12345"
      }
    ],
    "phone_numbers": [
      {
        "display_value": "(555) 123-4567",
        "id": "entityContact_26RRC7PQ6JG00",
        "label": "mobile",
        "value": null
      }
    ],
    "pronouns": "he/him",
    "tags": [
      {
        "id": "tag_0E5QDGJC03000",
        "value": "high-priority"
      }
    ]
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Description theme={null}
  {
    "api_url": "API URL for this contact.",
    "app_url": "App URL for this contact.",
    "can_delete": "Whether this contact can be deleted.",
    "can_edit": "Whether this contact can be edited.",
    "category": "Contact category.",
    "company_name": "Company name associated with the contact.",
    "created_at": "Timestamp when the contact was created.",
    "custom_contact_fields": {
      "id": "Unique identifier for the custom field.",
      "name": "Name of the custom field.",
      "value": "Value of the custom field."
    },
    "date_of_birth": "Date of birth",
    "deleted_contact_ids": "Prior contact IDs merged into this Contact (note: they are deleted post-merge)",
    "display_name": "Display name for the contact.",
    "email_addresses": {
      "id": "Unique identifier for the email address.",
      "label": "Label for the email address.",
      "value": "Email address value."
    },
    "fax_numbers": {
      "display_value": "Formatted display value for the phone number.",
      "id": "Unique identifier for the phone number.",
      "label": "Label for the phone number.",
      "value": "Phone number value."
    },
    "first_name": "Given name (first name) of the contact.",
    "gender": "Gender of the contact.",
    "gender_detail": "Additional gender details.",
    "has_account": "Whether the contact has a Spruce account.",
    "has_pending_invite": "Whether the contact has a pending invitation to Spruce.",
    "id": "Unique identifier for the contact in the Spruce system.",
    "integration_links": {
      "contact_id": "Contact ID in Spruce.",
      "external_id": "External system identifier.",
      "integration_type": "Type of integration.",
      "url": "URL to the external system."
    },
    "internal_member_ids": "Internal member IDs associated with this contact.",
    "last_name": "Family name (last name) of the contact.",
    "middle_name": "Middle name of the contact.",
    "object": "Object type identifier.",
    "organization_contact_fields": {
      "id": "Unique identifier for the organization field.",
      "name": "Name of the organization field.",
      "value": "Value of the organization field."
    },
    "phone_numbers": {
      "display_value": "Formatted display value for the phone number.",
      "id": "Unique identifier for the phone number.",
      "label": "Label for the phone number.",
      "value": "Phone number value."
    },
    "pronouns": "Preferred pronouns of the contact.",
    "tags": {
      "id": "Unique identifier for the tag.",
      "value": "Tag value."
    }
  }
  ```
</ResponseExample>

### Payload Field Details

<ResponseField name="Contact" type="Event Payload">
  <Expandable title="fields" defaultOpen="true">
    <ResponseField name="id" type="string" required>
      `ID` Unique identifier for the contact in the Spruce system.

      ```json CEL theme={null}
      id
      ```

      ```json Example theme={null}
      "entity_0E5QDGJC03000"
      ```
    </ResponseField>

    <ResponseField name="api_url" type="string">
      API URL for this contact.

      ```json CEL theme={null}
      api_url
      ```

      ```json Example theme={null}
      "https://api.sprucehealth.com/v1/contacts/contact_12345"
      ```
    </ResponseField>

    <ResponseField name="app_url" type="string">
      App URL for this contact.

      ```json CEL theme={null}
      app_url
      ```

      ```json Example theme={null}
      "https://app.sprucehealth.com/contacts/contact_12345"
      ```
    </ResponseField>

    <ResponseField name="can_delete" type="bool" required>
      Whether this contact can be deleted.

      ```json CEL theme={null}
      can_delete
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="can_edit" type="bool" required>
      Whether this contact can be edited.

      ```json CEL theme={null}
      can_edit
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="category" type="spruce.v1.ContactCategory" required>
      Contact category.

      ```json CEL theme={null}
      category
      ```

      ```json Example theme={null}
      spruce.v1.ContactCategory.CONTACT_CATEGORY_PATIENT
      spruce.v1.ContactCategory.CONTACT_CATEGORY_PROFESSIONAL
      spruce.v1.ContactCategory.CONTACT_CATEGORY_CLINIC
      ```
    </ResponseField>

    <ResponseField name="company_name" type="string">
      `PII` Company name associated with the contact.

      ```json CEL theme={null}
      company_name
      ```

      ```json Example theme={null}
      "ACME Healthcare"
      ```
    </ResponseField>

    <ResponseField name="created_at" type="timing.v1.Timestamp" required>
      Timestamp when the contact was created.

      ```json CEL theme={null}
      created_at
      ```

      ```json Example theme={null}
      "2023-11-13T17:42:17Z"
      ```
    </ResponseField>

    <ResponseField name="custom_contact_fields" type="[]object" required>
      Custom contact fields defined by the organization.

      ```json CEL theme={null}
      custom_contact_fields
      ```

      ```json Example theme={null}
      [
      {
      "id": "entityCustomField_0E5QDGJC03000",
      "name": "Insurance Provider",
      "value": "Blue Cross Blue Shield"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="custom_contact_fields.map(x, x.id)" type="[]string" required>
      `ID` Mapped array of: Unique identifier for the custom field.

      ```json CEL theme={null}
      custom_contact_fields.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "entityCustomField_0E5QDGJC03000"
      ]
      ```
    </ResponseField>

    <ResponseField name="custom_contact_fields.map(x, x.name)" type="[]string" required>
      Mapped array of: Name of the custom field.

      ```json CEL theme={null}
      custom_contact_fields.map(x, x.name)
      ```

      ```json Example theme={null}
      [
      "Insurance Provider"
      ]
      ```
    </ResponseField>

    <ResponseField name="custom_contact_fields.map(x, x.value)" type="[]string" required>
      `PII` Mapped array of: Value of the custom field.

      ```json CEL theme={null}
      custom_contact_fields.map(x, x.value)
      ```

      ```json Example theme={null}
      [
      "Blue Cross Blue Shield"
      ]
      ```
    </ResponseField>

    <ResponseField name="date_of_birth" type="values.v1.Date">
      `HI` Date of birth

      ```json CEL theme={null}
      date_of_birth
      ```

      ```json Example theme={null}
      "1990-01-15"
      ```
    </ResponseField>

    <ResponseField name="display_name" type="string">
      `PII` Display name for the contact.

      ```json CEL theme={null}
      display_name
      ```

      ```json Example theme={null}
      "John Doe"
      ```
    </ResponseField>

    <ResponseField name="email_addresses" type="[]object" required>
      Email addresses associated with the contact.

      ```json CEL theme={null}
      email_addresses
      ```

      ```json Example theme={null}
      [
      {
      "id": "entityContact_26RRC7PQ6JG00",
      "label": "primary",
      "value": "john.doe@example.com"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="email_addresses.map(x, x.id)" type="[]string" required>
      `ID` Mapped array of: Unique identifier for the email address.

      ```json CEL theme={null}
      email_addresses.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "entityContact_26RRC7PQ6JG00"
      ]
      ```
    </ResponseField>

    <ResponseField name="email_addresses.map(x, x.label)" type="[]string" required>
      Mapped array of: Label for the email address.

      ```json CEL theme={null}
      email_addresses.map(x, x.label)
      ```

      ```json Example theme={null}
      [
      "primary"
      ]
      ```
    </ResponseField>

    <ResponseField name="email_addresses.map(x, x.value)" type="[]string" required>
      `PII` Mapped array of: Email address value.

      ```json CEL theme={null}
      email_addresses.map(x, x.value)
      ```

      ```json Example theme={null}
      [
      "john.doe@example.com"
      ]
      ```
    </ResponseField>

    <ResponseField name="last_name" type="string">
      `PII` Family name (last name) of the contact.

      ```json CEL theme={null}
      last_name
      ```

      ```json Example theme={null}
      "Doe"
      ```
    </ResponseField>

    <ResponseField name="fax_numbers" type="[]object" required>
      Fax numbers associated with the contact.

      ```json CEL theme={null}
      fax_numbers
      ```

      ```json Example theme={null}
      [
      {
      "display_value": "(555) 123-4567",
      "id": "entityContact_26RRC7PQ6JG00",
      "label": "mobile",
      "value": null
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="fax_numbers.map(x, x.id)" type="[]string" required>
      `ID` Mapped array of: Unique identifier for the phone number.

      ```json CEL theme={null}
      fax_numbers.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "entityContact_26RRC7PQ6JG00"
      ]
      ```
    </ResponseField>

    <ResponseField name="fax_numbers.map(x, x.label)" type="[]string" required>
      Mapped array of: Label for the phone number.

      ```json CEL theme={null}
      fax_numbers.map(x, x.label)
      ```

      ```json Example theme={null}
      [
      "mobile"
      ]
      ```
    </ResponseField>

    <ResponseField name="fax_numbers.map(x, x.value)" type="[]string" required>
      Mapped array of: Phone number value.

      ```json CEL theme={null}
      fax_numbers.map(x, x.value)
      ```

      ```json Example theme={null}
      [
      null
      ]
      ```
    </ResponseField>

    <ResponseField name="fax_numbers.map(x, x.display_value)" type="[]string" required>
      Mapped array of: Formatted display value for the phone number.

      ```json CEL theme={null}
      fax_numbers.map(x, x.display_value)
      ```

      ```json Example theme={null}
      [
      "(555) 123-4567"
      ]
      ```
    </ResponseField>

    <ResponseField name="gender" type="string">
      `HI` Gender of the contact.

      ```json CEL theme={null}
      gender
      ```

      ```json Example theme={null}
      "male"
      ```
    </ResponseField>

    <ResponseField name="gender_detail" type="string">
      `HI` Additional gender details.

      ```json CEL theme={null}
      gender_detail
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="first_name" type="string">
      `PII` Given name (first name) of the contact.

      ```json CEL theme={null}
      first_name
      ```

      ```json Example theme={null}
      "John"
      ```
    </ResponseField>

    <ResponseField name="has_account" type="bool" required>
      Whether the contact has a Spruce account.

      ```json CEL theme={null}
      has_account
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="has_pending_invite" type="bool" required>
      Whether the contact has a pending invitation to Spruce.

      ```json CEL theme={null}
      has_pending_invite
      ```

      ```json Example theme={null}
      null
      ```
    </ResponseField>

    <ResponseField name="integration_links" type="[]object" required>
      Links to third-party integrations.

      ```json CEL theme={null}
      integration_links
      ```

      ```json Example theme={null}
      [
      {
      "contact_id": "entity_0E5QDGJC03000",
      "external_id": "ext_12345",
      "integration_type": "epic",
      "url": "https://hint.com/patient/100031277"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="integration_links.map(x, x.contact_id)" type="[]string" required>
      `ID` Mapped array of: Contact ID in Spruce.

      ```json CEL theme={null}
      integration_links.map(x, x.contact_id)
      ```

      ```json Example theme={null}
      [
      "entity_0E5QDGJC03000"
      ]
      ```
    </ResponseField>

    <ResponseField name="integration_links.map(x, x.external_id)" type="[]string" required>
      `ID` Mapped array of: External system identifier.

      ```json CEL theme={null}
      integration_links.map(x, x.external_id)
      ```

      ```json Example theme={null}
      [
      "ext_12345"
      ]
      ```
    </ResponseField>

    <ResponseField name="integration_links.map(x, x.integration_type)" type="[]string" required>
      Mapped array of: Type of integration.

      ```json CEL theme={null}
      integration_links.map(x, x.integration_type)
      ```

      ```json Example theme={null}
      [
      "epic"
      ]
      ```
    </ResponseField>

    <ResponseField name="integration_links.map(x, x.url)" type="[]string" required>
      `ID` `PII` Mapped array of: URL to the external system.

      ```json CEL theme={null}
      integration_links.map(x, x.url)
      ```

      ```json Example theme={null}
      [
      "https://hint.com/patient/100031277"
      ]
      ```
    </ResponseField>

    <ResponseField name="internal_member_ids" type="[]string" required>
      `ID` Internal member IDs associated with this contact.

      ```json CEL theme={null}
      internal_member_ids
      ```

      ```json Example theme={null}
      []
      ```
    </ResponseField>

    <ResponseField name="middle_name" type="string">
      `PII` Middle name of the contact.

      ```json CEL theme={null}
      middle_name
      ```

      ```json Example theme={null}
      "Smith"
      ```
    </ResponseField>

    <ResponseField name="object" type="string" required>
      Object type identifier.

      ```json CEL theme={null}
      object
      ```

      ```json Example theme={null}
      "contact"
      ```
    </ResponseField>

    <ResponseField name="organization_contact_fields" type="[]object" required>
      Organization-specific contact fields.

      ```json CEL theme={null}
      organization_contact_fields
      ```

      ```json Example theme={null}
      [
      {
      "id": "managedCustomField_0E5QDGJC03000",
      "name": "Patient ID",
      "value": "PT12345"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="organization_contact_fields.map(x, x.id)" type="[]string" required>
      `ID` Mapped array of: Unique identifier for the organization field.

      ```json CEL theme={null}
      organization_contact_fields.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "managedCustomField_0E5QDGJC03000"
      ]
      ```
    </ResponseField>

    <ResponseField name="organization_contact_fields.map(x, x.name)" type="[]string" required>
      Mapped array of: Name of the organization field.

      ```json CEL theme={null}
      organization_contact_fields.map(x, x.name)
      ```

      ```json Example theme={null}
      [
      "Patient ID"
      ]
      ```
    </ResponseField>

    <ResponseField name="organization_contact_fields.map(x, x.value)" type="[]string" required>
      `ID` Mapped array of: Value of the organization field.

      ```json CEL theme={null}
      organization_contact_fields.map(x, x.value)
      ```

      ```json Example theme={null}
      [
      "PT12345"
      ]
      ```
    </ResponseField>

    <ResponseField name="phone_numbers" type="[]object" required>
      Phone numbers associated with the contact.

      ```json CEL theme={null}
      phone_numbers
      ```

      ```json Example theme={null}
      [
      {
      "display_value": "(555) 123-4567",
      "id": "entityContact_26RRC7PQ6JG00",
      "label": "mobile",
      "value": null
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="phone_numbers.map(x, x.id)" type="[]string" required>
      `ID` Mapped array of: Unique identifier for the phone number.

      ```json CEL theme={null}
      phone_numbers.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "entityContact_26RRC7PQ6JG00"
      ]
      ```
    </ResponseField>

    <ResponseField name="phone_numbers.map(x, x.label)" type="[]string" required>
      Mapped array of: Label for the phone number.

      ```json CEL theme={null}
      phone_numbers.map(x, x.label)
      ```

      ```json Example theme={null}
      [
      "mobile"
      ]
      ```
    </ResponseField>

    <ResponseField name="phone_numbers.map(x, x.value)" type="[]string" required>
      Mapped array of: Phone number value.

      ```json CEL theme={null}
      phone_numbers.map(x, x.value)
      ```

      ```json Example theme={null}
      [
      null
      ]
      ```
    </ResponseField>

    <ResponseField name="phone_numbers.map(x, x.display_value)" type="[]string" required>
      Mapped array of: Formatted display value for the phone number.

      ```json CEL theme={null}
      phone_numbers.map(x, x.display_value)
      ```

      ```json Example theme={null}
      [
      "(555) 123-4567"
      ]
      ```
    </ResponseField>

    <ResponseField name="pronouns" type="string">
      `PII` Preferred pronouns of the contact.

      ```json CEL theme={null}
      pronouns
      ```

      ```json Example theme={null}
      "he/him"
      ```
    </ResponseField>

    <ResponseField name="tags" type="[]object" required>
      Tags associated with the contact.

      ```json CEL theme={null}
      tags
      ```

      ```json Example theme={null}
      [
      {
      "id": "tag_0E5QDGJC03000",
      "value": "high-priority"
      }
      ]
      ```
    </ResponseField>

    <ResponseField name="tags.map(x, x.id)" type="[]string" required>
      `ID` Mapped array of: Unique identifier for the tag.

      ```json CEL theme={null}
      tags.map(x, x.id)
      ```

      ```json Example theme={null}
      [
      "tag_0E5QDGJC03000"
      ]
      ```
    </ResponseField>

    <ResponseField name="tags.map(x, x.value)" type="[]string" required>
      Mapped array of: Tag value.

      ```json CEL theme={null}
      tags.map(x, x.value)
      ```

      ```json Example theme={null}
      [
      "high-priority"
      ]
      ```
    </ResponseField>

    <ResponseField name="deleted_contact_ids" type="[]string" required>
      `PII` Prior contact IDs merged into this Contact (note: they are deleted post-merge)

      ```json CEL theme={null}
      deleted_contact_ids
      ```

      ```json Example theme={null}
      [
      "entity_0E5QDGJC03001"
      ]
      ```
    </ResponseField>
  </Expandable>
</ResponseField>
