Skip to main content
The Memberships API allows you to manage user memberships across Cloudflare accounts, including accepting or rejecting invitations and viewing membership details.

List memberships

List all memberships of accounts the user can access.
for await (const membership of client.memberships.list()) {
  console.log(membership.account?.name, membership.status);
}
account
object
Filter by account
name
string
Filter by account name
status
string
Filter by membership statusOptions: accepted | pending | rejected
order
string
Field to order memberships byOptions: id | account.name | status
direction
string
Direction to order membershipsOptions: asc | desc
page
number
Page number for pagination
per_page
number
Number of items per page
id
string
Membership identifier tag
account
object
Account details
status
string
Status of this membership: accepted, pending, or rejected
roles
string[]
List of role names the membership has for this account
permissions
object
All access permissions for the user at the account
api_access_enabled
boolean | null
Enterprise only. Indicates whether API access is enabled for this user on the account

Get membership

Retrieve details about a specific membership.
const membership = await client.memberships.get(
  '4536bcfad5faccb111b47003c79917fa'
);
id
string
Membership identifier tag
account
object
Account information
status
string
Membership status: accepted, pending, or rejected
roles
string[]
Role names assigned to this membership
permissions
object
Access permissions for the user
policies
object[]
Access policies for the membership
api_access_enabled
boolean | null
Whether API access is enabled (Enterprise only)

Update membership

Accept or reject an account invitation.
const membership = await client.memberships.update(
  '4536bcfad5faccb111b47003c79917fa',
  { status: 'accepted' }
);
status
string
required
Whether to accept or reject the invitationOptions: accepted | rejected
id
string
Membership identifier tag
status
string
Updated membership status
account
object
Account details
roles
string[]
Assigned roles
permissions
object
User permissions
policies
object[]
Access policies applied to the membership

Delete membership

Remove the associated member from an account.
const result = await client.memberships.delete(
  '4536bcfad5faccb111b47003c79917fa'
);
id
string
ID of the deleted membership

Build docs developers (and LLMs) love