# User Groups ## List User Groups `iam.user_groups.list(UserGroupListParams**kwargs) -> SyncV4PagePaginationArray[UserGroupListResponse]` **get** `/accounts/{account_id}/iam/user_groups` List all the user groups for an account. ### Parameters - `account_id: str` Account identifier tag. - `id: Optional[str]` ID of the user group to be fetched. - `direction: Optional[str]` The sort order of returned user groups by name. Default sort order is ascending. To switch to descending, set this parameter to "desc" - `fuzzy_name: Optional[str]` A string used for searching for user groups containing that substring. - `name: Optional[str]` Name of the user group to be fetched. - `page: Optional[float]` Page number of paginated results. - `per_page: Optional[float]` Maximum number of results per page. ### Returns - `class UserGroupListResponse: …` A group of policies resources. - `id: str` User Group identifier tag. - `created_on: datetime` Timestamp for the creation of the user group - `modified_on: datetime` Last time the user group was modified. - `name: str` Name of the user group. - `policies: Optional[List[Policy]]` Policies attached to the User group - `id: Optional[str]` Policy identifier. - `access: Optional[Literal["allow", "deny"]]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Optional[List[PolicyPermissionGroup]]` A set of permission groups that are specified to the policy. - `id: str` Identifier of the permission group. - `meta: Optional[PolicyPermissionGroupMeta]` Attributes associated to the permission group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the permission group. - `resource_groups: Optional[List[PolicyResourceGroup]]` A list of resource groups that the policy applies to. - `id: str` Identifier of the resource group. - `scope: List[PolicyResourceGroupScope]` The scope associated to the resource group - `key: str` This is a combination of pre-defined resource name and identifier (like Account ID etc.) - `objects: List[PolicyResourceGroupScopeObject]` A list of scope objects for additional context. - `key: str` This is a combination of pre-defined resource name and identifier (like Zone ID etc.) - `meta: Optional[PolicyResourceGroupMeta]` Attributes associated to the resource group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the resource group. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.iam.user_groups.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2024-03-01T12:21:02.0000Z", "modified_on": "2024-03-01T12:21:02.0000Z", "name": "My New User Group", "policies": [ { "id": "f267e341f3dd4697bd3b9f71dd96247f", "access": "allow", "permission_groups": [ { "id": "c8fed203ed3043cba015a93ad1616f1f", "meta": { "key": "key", "value": "value" }, "name": "Zone Read" }, { "id": "82e64a83756745bbbb1c9c2701bf816b", "meta": { "key": "key", "value": "value" }, "name": "Magic Network Monitoring" } ], "resource_groups": [ { "id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1", "scope": [ { "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", "objects": [ { "key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5" } ] } ], "meta": { "key": "key", "value": "value" }, "name": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4" } ] } ] } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## User Group Details `iam.user_groups.get(struser_group_id, UserGroupGetParams**kwargs) -> UserGroupGetResponse` **get** `/accounts/{account_id}/iam/user_groups/{user_group_id}` Get information about a specific user group in an account. ### Parameters - `account_id: str` Account identifier tag. - `user_group_id: str` User Group identifier tag. ### Returns - `class UserGroupGetResponse: …` A group of policies resources. - `id: str` User Group identifier tag. - `created_on: datetime` Timestamp for the creation of the user group - `modified_on: datetime` Last time the user group was modified. - `name: str` Name of the user group. - `policies: Optional[List[Policy]]` Policies attached to the User group - `id: Optional[str]` Policy identifier. - `access: Optional[Literal["allow", "deny"]]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Optional[List[PolicyPermissionGroup]]` A set of permission groups that are specified to the policy. - `id: str` Identifier of the permission group. - `meta: Optional[PolicyPermissionGroupMeta]` Attributes associated to the permission group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the permission group. - `resource_groups: Optional[List[PolicyResourceGroup]]` A list of resource groups that the policy applies to. - `id: str` Identifier of the resource group. - `scope: List[PolicyResourceGroupScope]` The scope associated to the resource group - `key: str` This is a combination of pre-defined resource name and identifier (like Account ID etc.) - `objects: List[PolicyResourceGroupScopeObject]` A list of scope objects for additional context. - `key: str` This is a combination of pre-defined resource name and identifier (like Zone ID etc.) - `meta: Optional[PolicyResourceGroupMeta]` Attributes associated to the resource group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the resource group. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) user_group = client.iam.user_groups.get( user_group_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(user_group.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2024-03-01T12:21:02.0000Z", "modified_on": "2024-03-01T12:21:02.0000Z", "name": "My New User Group", "policies": [ { "id": "f267e341f3dd4697bd3b9f71dd96247f", "access": "allow", "permission_groups": [ { "id": "c8fed203ed3043cba015a93ad1616f1f", "meta": { "key": "key", "value": "value" }, "name": "Zone Read" }, { "id": "82e64a83756745bbbb1c9c2701bf816b", "meta": { "key": "key", "value": "value" }, "name": "Magic Network Monitoring" } ], "resource_groups": [ { "id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1", "scope": [ { "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", "objects": [ { "key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5" } ] } ], "meta": { "key": "key", "value": "value" }, "name": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4" } ] } ] } } ``` ## Create User Group `iam.user_groups.create(UserGroupCreateParams**kwargs) -> UserGroupCreateResponse` **post** `/accounts/{account_id}/iam/user_groups` Create a new user group under the specified account. ### Parameters - `account_id: str` Account identifier tag. - `name: str` Name of the User group. - `policies: Iterable[Policy]` Policies attached to the User group - `access: Literal["allow", "deny"]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Iterable[PolicyPermissionGroup]` A set of permission groups that are specified to the policy. - `id: str` Permission Group identifier tag. - `resource_groups: Iterable[PolicyResourceGroup]` A set of resource groups that are specified to the policy. - `id: str` Resource Group identifier tag. ### Returns - `class UserGroupCreateResponse: …` A group of policies resources. - `id: str` User Group identifier tag. - `created_on: datetime` Timestamp for the creation of the user group - `modified_on: datetime` Last time the user group was modified. - `name: str` Name of the user group. - `policies: Optional[List[Policy]]` Policies attached to the User group - `id: Optional[str]` Policy identifier. - `access: Optional[Literal["allow", "deny"]]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Optional[List[PolicyPermissionGroup]]` A set of permission groups that are specified to the policy. - `id: str` Identifier of the permission group. - `meta: Optional[PolicyPermissionGroupMeta]` Attributes associated to the permission group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the permission group. - `resource_groups: Optional[List[PolicyResourceGroup]]` A list of resource groups that the policy applies to. - `id: str` Identifier of the resource group. - `scope: List[PolicyResourceGroupScope]` The scope associated to the resource group - `key: str` This is a combination of pre-defined resource name and identifier (like Account ID etc.) - `objects: List[PolicyResourceGroupScopeObject]` A list of scope objects for additional context. - `key: str` This is a combination of pre-defined resource name and identifier (like Zone ID etc.) - `meta: Optional[PolicyResourceGroupMeta]` Attributes associated to the resource group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the resource group. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) user_group = client.iam.user_groups.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", name="My New User Group", policies=[{ "access": "allow", "permission_groups": [{ "id": "c8fed203ed3043cba015a93ad1616f1f" }, { "id": "82e64a83756745bbbb1c9c2701bf816b" }], "resource_groups": [{ "id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1" }], }], ) print(user_group.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2024-03-01T12:21:02.0000Z", "modified_on": "2024-03-01T12:21:02.0000Z", "name": "My New User Group", "policies": [ { "id": "f267e341f3dd4697bd3b9f71dd96247f", "access": "allow", "permission_groups": [ { "id": "c8fed203ed3043cba015a93ad1616f1f", "meta": { "key": "key", "value": "value" }, "name": "Zone Read" }, { "id": "82e64a83756745bbbb1c9c2701bf816b", "meta": { "key": "key", "value": "value" }, "name": "Magic Network Monitoring" } ], "resource_groups": [ { "id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1", "scope": [ { "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", "objects": [ { "key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5" } ] } ], "meta": { "key": "key", "value": "value" }, "name": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4" } ] } ] } } ``` ## Update User Group `iam.user_groups.update(struser_group_id, UserGroupUpdateParams**kwargs) -> UserGroupUpdateResponse` **put** `/accounts/{account_id}/iam/user_groups/{user_group_id}` Modify an existing user group. ### Parameters - `account_id: str` Account identifier tag. - `user_group_id: str` User Group identifier tag. - `name: Optional[str]` Name of the User group. - `policies: Optional[Iterable[Policy]]` Policies attached to the User group - `id: str` Policy identifier. - `access: Literal["allow", "deny"]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Iterable[PolicyPermissionGroup]` A set of permission groups that are specified to the policy. - `id: str` Permission Group identifier tag. - `resource_groups: Iterable[PolicyResourceGroup]` A set of resource groups that are specified to the policy. - `id: str` Resource Group identifier tag. ### Returns - `class UserGroupUpdateResponse: …` A group of policies resources. - `id: str` User Group identifier tag. - `created_on: datetime` Timestamp for the creation of the user group - `modified_on: datetime` Last time the user group was modified. - `name: str` Name of the user group. - `policies: Optional[List[Policy]]` Policies attached to the User group - `id: Optional[str]` Policy identifier. - `access: Optional[Literal["allow", "deny"]]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Optional[List[PolicyPermissionGroup]]` A set of permission groups that are specified to the policy. - `id: str` Identifier of the permission group. - `meta: Optional[PolicyPermissionGroupMeta]` Attributes associated to the permission group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the permission group. - `resource_groups: Optional[List[PolicyResourceGroup]]` A list of resource groups that the policy applies to. - `id: str` Identifier of the resource group. - `scope: List[PolicyResourceGroupScope]` The scope associated to the resource group - `key: str` This is a combination of pre-defined resource name and identifier (like Account ID etc.) - `objects: List[PolicyResourceGroupScopeObject]` A list of scope objects for additional context. - `key: str` This is a combination of pre-defined resource name and identifier (like Zone ID etc.) - `meta: Optional[PolicyResourceGroupMeta]` Attributes associated to the resource group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the resource group. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) user_group = client.iam.user_groups.update( user_group_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(user_group.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created_on": "2024-03-01T12:21:02.0000Z", "modified_on": "2024-03-01T12:21:02.0000Z", "name": "My New User Group", "policies": [ { "id": "f267e341f3dd4697bd3b9f71dd96247f", "access": "allow", "permission_groups": [ { "id": "c8fed203ed3043cba015a93ad1616f1f", "meta": { "key": "key", "value": "value" }, "name": "Zone Read" }, { "id": "82e64a83756745bbbb1c9c2701bf816b", "meta": { "key": "key", "value": "value" }, "name": "Magic Network Monitoring" } ], "resource_groups": [ { "id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1", "scope": [ { "key": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4", "objects": [ { "key": "com.cloudflare.api.account.zone.23f8d65290b24279ba6f44721b3eaad5" } ] } ], "meta": { "key": "key", "value": "value" }, "name": "com.cloudflare.api.account.eb78d65290b24279ba6f44721b3ea3c4" } ] } ] } } ``` ## Remove User Group `iam.user_groups.delete(struser_group_id, UserGroupDeleteParams**kwargs) -> UserGroupDeleteResponse` **delete** `/accounts/{account_id}/iam/user_groups/{user_group_id}` Remove a user group from an account. ### Parameters - `account_id: str` Account identifier tag. - `user_group_id: str` User Group identifier tag. ### Returns - `class UserGroupDeleteResponse: …` - `id: str` Identifier ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) user_group = client.iam.user_groups.delete( user_group_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(user_group.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353" } } ``` ## Domain Types ### User Group List Response - `class UserGroupListResponse: …` A group of policies resources. - `id: str` User Group identifier tag. - `created_on: datetime` Timestamp for the creation of the user group - `modified_on: datetime` Last time the user group was modified. - `name: str` Name of the user group. - `policies: Optional[List[Policy]]` Policies attached to the User group - `id: Optional[str]` Policy identifier. - `access: Optional[Literal["allow", "deny"]]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Optional[List[PolicyPermissionGroup]]` A set of permission groups that are specified to the policy. - `id: str` Identifier of the permission group. - `meta: Optional[PolicyPermissionGroupMeta]` Attributes associated to the permission group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the permission group. - `resource_groups: Optional[List[PolicyResourceGroup]]` A list of resource groups that the policy applies to. - `id: str` Identifier of the resource group. - `scope: List[PolicyResourceGroupScope]` The scope associated to the resource group - `key: str` This is a combination of pre-defined resource name and identifier (like Account ID etc.) - `objects: List[PolicyResourceGroupScopeObject]` A list of scope objects for additional context. - `key: str` This is a combination of pre-defined resource name and identifier (like Zone ID etc.) - `meta: Optional[PolicyResourceGroupMeta]` Attributes associated to the resource group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the resource group. ### User Group Get Response - `class UserGroupGetResponse: …` A group of policies resources. - `id: str` User Group identifier tag. - `created_on: datetime` Timestamp for the creation of the user group - `modified_on: datetime` Last time the user group was modified. - `name: str` Name of the user group. - `policies: Optional[List[Policy]]` Policies attached to the User group - `id: Optional[str]` Policy identifier. - `access: Optional[Literal["allow", "deny"]]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Optional[List[PolicyPermissionGroup]]` A set of permission groups that are specified to the policy. - `id: str` Identifier of the permission group. - `meta: Optional[PolicyPermissionGroupMeta]` Attributes associated to the permission group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the permission group. - `resource_groups: Optional[List[PolicyResourceGroup]]` A list of resource groups that the policy applies to. - `id: str` Identifier of the resource group. - `scope: List[PolicyResourceGroupScope]` The scope associated to the resource group - `key: str` This is a combination of pre-defined resource name and identifier (like Account ID etc.) - `objects: List[PolicyResourceGroupScopeObject]` A list of scope objects for additional context. - `key: str` This is a combination of pre-defined resource name and identifier (like Zone ID etc.) - `meta: Optional[PolicyResourceGroupMeta]` Attributes associated to the resource group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the resource group. ### User Group Create Response - `class UserGroupCreateResponse: …` A group of policies resources. - `id: str` User Group identifier tag. - `created_on: datetime` Timestamp for the creation of the user group - `modified_on: datetime` Last time the user group was modified. - `name: str` Name of the user group. - `policies: Optional[List[Policy]]` Policies attached to the User group - `id: Optional[str]` Policy identifier. - `access: Optional[Literal["allow", "deny"]]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Optional[List[PolicyPermissionGroup]]` A set of permission groups that are specified to the policy. - `id: str` Identifier of the permission group. - `meta: Optional[PolicyPermissionGroupMeta]` Attributes associated to the permission group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the permission group. - `resource_groups: Optional[List[PolicyResourceGroup]]` A list of resource groups that the policy applies to. - `id: str` Identifier of the resource group. - `scope: List[PolicyResourceGroupScope]` The scope associated to the resource group - `key: str` This is a combination of pre-defined resource name and identifier (like Account ID etc.) - `objects: List[PolicyResourceGroupScopeObject]` A list of scope objects for additional context. - `key: str` This is a combination of pre-defined resource name and identifier (like Zone ID etc.) - `meta: Optional[PolicyResourceGroupMeta]` Attributes associated to the resource group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the resource group. ### User Group Update Response - `class UserGroupUpdateResponse: …` A group of policies resources. - `id: str` User Group identifier tag. - `created_on: datetime` Timestamp for the creation of the user group - `modified_on: datetime` Last time the user group was modified. - `name: str` Name of the user group. - `policies: Optional[List[Policy]]` Policies attached to the User group - `id: Optional[str]` Policy identifier. - `access: Optional[Literal["allow", "deny"]]` Allow or deny operations against the resources. - `"allow"` - `"deny"` - `permission_groups: Optional[List[PolicyPermissionGroup]]` A set of permission groups that are specified to the policy. - `id: str` Identifier of the permission group. - `meta: Optional[PolicyPermissionGroupMeta]` Attributes associated to the permission group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the permission group. - `resource_groups: Optional[List[PolicyResourceGroup]]` A list of resource groups that the policy applies to. - `id: str` Identifier of the resource group. - `scope: List[PolicyResourceGroupScope]` The scope associated to the resource group - `key: str` This is a combination of pre-defined resource name and identifier (like Account ID etc.) - `objects: List[PolicyResourceGroupScopeObject]` A list of scope objects for additional context. - `key: str` This is a combination of pre-defined resource name and identifier (like Zone ID etc.) - `meta: Optional[PolicyResourceGroupMeta]` Attributes associated to the resource group. - `key: Optional[str]` - `value: Optional[str]` - `name: Optional[str]` Name of the resource group. ### User Group Delete Response - `class UserGroupDeleteResponse: …` - `id: str` Identifier # Members ## List User Group Members `iam.user_groups.members.list(struser_group_id, MemberListParams**kwargs) -> SyncV4PagePaginationArray[MemberListResponse]` **get** `/accounts/{account_id}/iam/user_groups/{user_group_id}/members` List all the members attached to a user group. ### Parameters - `account_id: str` Account identifier tag. - `user_group_id: str` User Group identifier tag. - `page: Optional[float]` Page number of paginated results. - `per_page: Optional[float]` Maximum number of results per page. ### Returns - `class MemberListResponse: …` Member attached to a User Group. - `id: str` Account member identifier. - `email: Optional[str]` The contact email address of the user. - `status: Optional[Literal["accepted", "pending"]]` The member's status in the account. - `"accepted"` - `"pending"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.iam.user_groups.members.list( user_group_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "4f5f0c14a2a41d5063dd301b2f829f04", "email": "user@example.com", "status": "accepted" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Add User Group Members `iam.user_groups.members.create(struser_group_id, MemberCreateParams**kwargs) -> MemberCreateResponse` **post** `/accounts/{account_id}/iam/user_groups/{user_group_id}/members` Add members to a User Group. ### Parameters - `account_id: str` Account identifier tag. - `user_group_id: str` User Group identifier tag. - `body: Iterable[Body]` - `id: str` The identifier of an existing account Member. ### Returns - `class MemberCreateResponse: …` Member attached to a User Group. - `id: str` Account member identifier. - `email: Optional[str]` The contact email address of the user. - `status: Optional[Literal["accepted", "pending"]]` The member's status in the account. - `"accepted"` - `"pending"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) member = client.iam.user_groups.members.create( user_group_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{ "id": "023e105f4ecef8ad9ca31a8372d0c353" }], ) print(member.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "4f5f0c14a2a41d5063dd301b2f829f04", "email": "user@example.com", "status": "accepted" } } ``` ## Update User Group Members `iam.user_groups.members.update(struser_group_id, MemberUpdateParams**kwargs) -> SyncSinglePage[MemberUpdateResponse]` **put** `/accounts/{account_id}/iam/user_groups/{user_group_id}/members` Replace the set of members attached to a User Group. ### Parameters - `account_id: str` Account identifier tag. - `user_group_id: str` User Group identifier tag. - `body: Iterable[Body]` Set/Replace members to a user group. - `id: str` The identifier of an existing account Member. ### Returns - `class MemberUpdateResponse: …` Member attached to a User Group. - `id: str` Account member identifier. - `email: Optional[str]` The contact email address of the user. - `status: Optional[Literal["accepted", "pending"]]` The member's status in the account. - `"accepted"` - `"pending"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.iam.user_groups.members.update( user_group_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", body=[{ "id": "023e105f4ecef8ad9ca31a8372d0c353" }], ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "4f5f0c14a2a41d5063dd301b2f829f04", "email": "user@example.com", "status": "accepted" } ] } ``` ## Remove User Group Member `iam.user_groups.members.delete(strmember_id, MemberDeleteParams**kwargs) -> MemberDeleteResponse` **delete** `/accounts/{account_id}/iam/user_groups/{user_group_id}/members/{member_id}` Remove a member from User Group ### Parameters - `account_id: str` Account identifier tag. - `user_group_id: str` User Group identifier tag. - `member_id: str` The identifier of an existing account Member. ### Returns - `class MemberDeleteResponse: …` Member attached to a User Group. - `id: str` Account member identifier. - `email: Optional[str]` The contact email address of the user. - `status: Optional[Literal["accepted", "pending"]]` The member's status in the account. - `"accepted"` - `"pending"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) member = client.iam.user_groups.members.delete( member_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", user_group_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(member.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "4f5f0c14a2a41d5063dd301b2f829f04", "email": "user@example.com", "status": "accepted" } } ``` ## Domain Types ### Member List Response - `class MemberListResponse: …` Member attached to a User Group. - `id: str` Account member identifier. - `email: Optional[str]` The contact email address of the user. - `status: Optional[Literal["accepted", "pending"]]` The member's status in the account. - `"accepted"` - `"pending"` ### Member Create Response - `class MemberCreateResponse: …` Member attached to a User Group. - `id: str` Account member identifier. - `email: Optional[str]` The contact email address of the user. - `status: Optional[Literal["accepted", "pending"]]` The member's status in the account. - `"accepted"` - `"pending"` ### Member Update Response - `class MemberUpdateResponse: …` Member attached to a User Group. - `id: str` Account member identifier. - `email: Optional[str]` The contact email address of the user. - `status: Optional[Literal["accepted", "pending"]]` The member's status in the account. - `"accepted"` - `"pending"` ### Member Delete Response - `class MemberDeleteResponse: …` Member attached to a User Group. - `id: str` Account member identifier. - `email: Optional[str]` The contact email address of the user. - `status: Optional[Literal["accepted", "pending"]]` The member's status in the account. - `"accepted"` - `"pending"`