Skip to content
Start here

Update User Group Members

client.iam.userGroups.members.update(stringuserGroupId, MemberUpdateParams { account_id, members } params, RequestOptionsoptions?): SinglePage<MemberUpdateResponse { id, email, status } >
PUT/accounts/{account_id}/iam/user_groups/{user_group_id}/members

Replace the set of members attached to a User Group.

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
SCIM ProvisioningAccount Settings Write
ParametersExpand Collapse
userGroupId: string

User Group identifier tag.

maxLength32
minLength32
params: MemberUpdateParams { account_id, members }
account_id: string

Path param: Account identifier tag.

maxLength32
minLength32
members: Array<Member>

Body param: Set/Replace members to a user group.

id: string

The identifier of an existing account Member.

maxLength32
minLength32
ReturnsExpand Collapse
MemberUpdateResponse { id, email, status }

Member attached to a User Group.

id: string

Account member identifier.

email?: string

The contact email address of the user.

maxLength90
status?: "accepted" | "pending"

The member’s status in the account.

One of the following:
"accepted"
"pending"

Update User Group Members

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted
  apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const memberUpdateResponse of client.iam.userGroups.members.update(
  '023e105f4ecef8ad9ca31a8372d0c353',
  {
    account_id: '023e105f4ecef8ad9ca31a8372d0c353',
    members: [{ id: '023e105f4ecef8ad9ca31a8372d0c353' }],
  },
)) {
  console.log(memberUpdateResponse.id);
}
{
  "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"
    }
  ]
}
Returns Examples
{
  "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"
    }
  ]
}