> ## Documentation Index
> Fetch the complete documentation index at: https://datum-4926dda5-docs-api-reference-demo.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ContactGroupMembership

> ContactGroupMembership is the Schema for the contactgroupmemberships API. It represents a membership of a Contact in a ContactGroup.

<Note>
  API resource reference for **ContactGroupMembership**, part of the [Notification service](/api/notification/overview). To create or change one, see [Changing resources](/datumctl/resources/changing); to inspect, see [Reading resources](/datumctl/resources/reading).
</Note>

<Warning>
  This resource is part of the `v1alpha1` API and is subject to change. Fields and behavior may change in future releases.
</Warning>

## Identity

|         |                             |
| ------- | --------------------------- |
| Group   | `notification.miloapis.com` |
| Version | `v1alpha1`                  |
| Kind    | `ContactGroupMembership`    |
| Scope   | Project                     |

## Overview

A `ContactGroupMembership` links a `Contact` to a `ContactGroup`, adding that contact as a member of the group. Use it when you want a contact to receive notifications sent to a group: create one membership per contact-to-group pairing. The membership references both the target `ContactGroup` and the `Contact` being added, and the controller tracks the sync of that membership to the underlying notification provider.

## Spec fields

| Field                            | Type   | Required | Description                                                    |
| -------------------------------- | ------ | -------- | -------------------------------------------------------------- |
| `spec.contactGroupRef`           | Object | Yes      | Reference to the ContactGroup that the Contact is a member of. |
| `spec.contactGroupRef.name`      | string | Yes      | Name of the ContactGroup being referenced.                     |
| `spec.contactGroupRef.namespace` | string | Yes      | Namespace of the ContactGroup being referenced.                |
| `spec.contactRef`                | Object | Yes      | Reference to the Contact that is a member of the ContactGroup. |
| `spec.contactRef.name`           | string | Yes      | Name of the Contact being referenced.                          |
| `spec.contactRef.namespace`      | string | Yes      | Namespace of the Contact being referenced.                     |

## Status fields (read-only)

| Field               | Type      | Description                                                                                                                                                                 |
| ------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `status.conditions` | \[]Object | Latest observations of the membership's state. The standard `Ready` condition tracks membership creation and sync to the contact group membership provider.                 |
| `status.providers`  | \[]Object | Per-provider status for this membership, enabling multiple provider backends to be tracked simultaneously.                                                                  |
| `status.providerID` | string    | Identifier returned by the underlying contact provider (e.g. Resend) when the membership is created in the associated audience. Deprecated: use `status.providers` instead. |
| `status.username`   | string    | Username of the user that owns the membership, populated by the controller from the referenced Contact's subject.                                                           |

## Usage

```yaml theme={null}
apiVersion: notification.miloapis.com/v1alpha1
kind: ContactGroupMembership
metadata:
  name: alice-oncall
spec:
  contactGroupRef:
    name: oncall
    namespace: my-project
  contactRef:
    name: alice
    namespace: my-project
```

```bash theme={null}
datumctl apply -f contactgroupmembership.yaml --project my-project
datumctl get contactgroupmemberships --project my-project
datumctl describe contactgroupmemberships alice-oncall --project my-project
```

<Tip>
  Run `datumctl explain contactgroupmemberships --recursive` to see the full, live field tree for this resource.
</Tip>
