# Sync Medicare customers and policies (/docs/api-reference/sync/sync-medicare-customers-and-policies)



{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}

Create or update Medicare customers and their policies in one request.

<Callout type="info">
  **Customer matching**: `mbiNumber` first, then a fallback on `firstName` + `lastName` + `dateOfBirth` + `phoneNumber`. When a customer is matched via the fallback, their `mbiNumber` is backfilled from the request.

  **Policy matching**: `sunFireEnrollmentCode` first, then the `planCode` + `effectiveDate` composite.

  **Custom fields**: Put customer values in `records[].customFields` and policy values in `records[].policies[].customFields`. Each entry uses a configured `fieldKey` and `value`. Find keys in [Customer Custom Fields](https://app.carecycle.ai/settings/crm-settings/custom-fields/customer) and [Policy Custom Fields](https://app.carecycle.ai/settings/crm-settings/custom-fields/policy). Policy values are attached to the policy created or matched by the containing policy object.

  **Medicare plan codes**: For `MA` and `MAPD`, `planCode` must be a CMS contract-style code starting with `H` or `R`. For `PDP`, it must start with `S`, `H`, `R`, `E`, or `X`. The three-digit segment is optional: send contract+plan only (`H3146-036`) and careCycle infers the segment from CMS reference data, defaulting to `-000` for non-segmented plans; a record is rejected only when the plan genuinely has multiple segments (include the segment to disambiguate). Dashes are optional in requests (`H1234001000` and `H1234-001-000` are accepted); careCycle stores the canonical dashed form. `MS` plan codes are carrier-specific and are not required to follow the CMS contract format.

  When a new policy is created, the customer's existing policies of the **same** `policyType` with an `effectiveDate` more than one year old are terminated.

  `policyType` must be one of `MA`, `MAPD`, `MS`, or `PDP`.

  **Response**: For each successfully synced record, `results` contains the full customer record (same shape as the `customer.created`/`customer.updated` webhook) along with the policies this request changed: those created or updated from the request, plus any older policies auto-terminated as a side effect. The customer's untouched existing policies are not returned. Each returned policy carries a `previousStatus` field (its status before this request, or `null` if newly created); compare it with the policy's `status` to detect a flip; e.g. an auto-terminated policy comes back with `previousStatus: "Active"` and `status: "Terminated"`.
</Callout>

<APIPage document="&#x22;../../apps/api/openapi/specs/openapi-public.yaml&#x22;" operations="[{&#x22;path&#x22;:&#x22;/v2/sync/medicare&#x22;,&#x22;method&#x22;:&#x22;post&#x22;}]" />
