> ## 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.

# GroupMembership

> GroupMembership is the Schema for the groupmemberships API.

<Note>
  API resource reference for **GroupMembership**, part of the [IAM service](/api/iam/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   | `iam.miloapis.com` |
| Version | `v1alpha1`         |
| Kind    | `GroupMembership`  |
| Scope   | Project            |

## Overview

A `GroupMembership` connects a single user to a single group. Use it to add a user as a member of a group so that any roles bound to that group apply to the user. Each membership represents one user-in-group relationship, so you create one `GroupMembership` per user you want to add to a group.

## Spec fields

| Field                     | Type   | Required | Description                                               |
| ------------------------- | ------ | -------- | --------------------------------------------------------- |
| `spec.groupRef`           | Object | Yes      | Reference to the group the user is being added to.        |
| `spec.groupRef.name`      | string | Yes      | Name of the group being referenced.                       |
| `spec.groupRef.namespace` | string | Yes      | Namespace of the referenced group.                        |
| `spec.userRef`            | Object | Yes      | Reference to the user that becomes a member of the group. |
| `spec.userRef.name`       | string | Yes      | Name of the user being referenced.                        |

## Status fields (read-only)

| Field               | Type      | Description                                                      |
| ------------------- | --------- | ---------------------------------------------------------------- |
| `status.conditions` | \[]Object | Latest available observations of the membership's current state. |

## Usage

```yaml theme={null}
apiVersion: iam.miloapis.com/v1alpha1
kind: GroupMembership
metadata:
  name: alice-in-platform-admins
spec:
  groupRef:
    name: platform-admins
    namespace: my-project
  userRef:
    name: alice
```

```bash theme={null}
datumctl apply -f groupmembership.yaml --project my-project
datumctl get groupmemberships.iam.miloapis.com --project my-project
datumctl describe groupmemberships.iam.miloapis.com alice-in-platform-admins --project my-project
```

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