[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[[["\u003cp\u003eThis feature enables managing group memberships with expiration dates, allowing for time-limited access to resources or temporary inclusion in communication groups.\u003c/p\u003e\n"],["\u003cp\u003eMembership expiration is applicable to users, groups, and service accounts with a \u003ccode\u003eMEMBER\u003c/code\u003e role, and when applied to a group, it becomes the default for all child members unless they have individual expirations.\u003c/p\u003e\n"],["\u003cp\u003eUpdating a membership's expiration requires calling \u003ccode\u003egroups.memberships.modifyMembershipRoles()\u003c/code\u003e and specifying the \u003ccode\u003eMEMBER\u003c/code\u003e role and its new expiration date.\u003c/p\u003e\n"],["\u003cp\u003eRetrieving a membership expiration is done by calling \u003ccode\u003egroups.memberships.get()\u003c/code\u003e with the parent group ID and the membership ID.\u003c/p\u003e\n"],["\u003cp\u003eGroup owners are automatically notified via email 72 hours before a membership expires, or immediately if the expiration is sooner than 72 hours.\u003c/p\u003e\n"]]],[],null,["# Managing membership expirations\n===============================\n\nThis page explains how to update and retrieve expiration settings for group\nmemberships, and the expiration notifications group owners receive.\n| **Note:** This feature is only available to Google Workspace Enterprise Standard, Enterprise Plus, and Enterprise for Education, and Cloud Identity Premium accounts.\n\nMembership expiration allows group owners, group managers, Google Workspace\nSuper Admins, or Workspace Delegated Admins with group admin privileges to\nmanage groups and groups-based access to resources. Access can be limited based\non membership staleness or temporary need without manually removing members.\nThe Groups API enables membership expiration for the following use cases:\n\n- Time-limited access to resources (for example, to allow someone to help troubleshoot a problem in production)\n- Temporary membership in a communications group (for example, to briefly include a person into a team group on a long-term project)\n\nExpirations can be applied to all types of group members (including users,\ngroups, and service accounts) if they have a `MEMBER` role. When you set an\nexpiration for a member that is a group, that expiration becomes the default\nexpiration for all child members of that group unless the child member has a\ndirect membership in the parent group with an individual expiration already\napplied. The expiration also applies to all new members of the child group\ngoing forward.\n\nBefore you begin\n----------------\n\nSet up authentication and install the client libraries. See\n[Setting up the Cloud Identity Groups API](/identity/docs/how-to/setup) to\nlearn how.\n\nAdding a membership with expiration\n-----------------------------------\n\nSee\n[Managing Google Group memberships for Google Groups](/identity/docs/how-to/memberships-google-groups)\nor\n[Managing identity-mapped group memberships](/identity/docs/how-to/memberships-identity-groups)\nto learn how.\n\nUpdating the expiration of a membership\n---------------------------------------\n\nTo update the expiration of a membership, call\n[`groups.memberships.modifyMembershipRoles()`](/identity/docs/reference/rest/v1/groups.memberships/modifyMembershipRoles)\nwith the ID of the parent group, the ID of the membership, and an\n[`UpdateMembershipRolesParams`](/identity/docs/reference/rest/v1beta1/groups.memberships/modifyMembershipRoles#updatemembershiprolesparams)\nresource. Because members can have more than one [`MembershipRole`](/identity/docs/reference/rest/v1beta1/groups.memberships#MembershipRole)\nin a group, you must specify which role will have the expiration. Currently\nonly the `MEMBER` role may have an expiration applied to it.\n| **Note:** To get the ID of the membership, call [groups.memberships.lookup()](/identity/docs/reference/rest/v1beta1/groups.memberships/lookup) with the ID of the parent group and the `memberKey` of the member.\n\n**Sample request body** \n\n {\n \"updateRolesParams\": [\n {\n \"fieldMask\": \"expiry_detail.expire_time\",\n \"membershipRole\": {\n \"expiryDetail\": {\n \"expireTime\": \"2021-10-02T15:01:23Z\"\n },\n \"name\": \"MEMBER\"\n }\n }\n ]\n }\n\nRetrieving a membership expiration\n----------------------------------\n\nTo retrieve the membership expiration of a membership, call\n[`groups.memberships.get()`](/identity/docs/reference/rest/v1/groups.memberships/get)\nwith the ID of the parent group and the ID of the membership.\n| **Note:** To get the ID of the membership, call [`groups.memberships.lookup()`](/identity/docs/reference/rest/v1beta1/groups.memberships/lookup) with the ID of the parent group and the `memberKey` of the member.\n\nEmail notifications\n-------------------\n\nEmail notifications are automatically sent to all group owners when memberships\nare about to expire. Notifications are sent 72 hours before expiration or\nimmediately if the membership will expire before 72 hours when it is set.\nThe notifications are sent in each group owner's preferred language, as defined\nby the domain administrator in the Google Admin console or by the group owner\nindividually."]]