Unable to list subaccounts

Hi
I am unable to list down my subaccounts from the master account, getting the error

Error

Failed to retrieve users: 400
{‘code’: 4711, ‘message’: ‘Invalid access token, does not contain scopes:[user:read:master, user:master, user:write:master].’}

My script
import requests

Base64 encoded ‘client_id:client_secret’

authorization_token = ‘QTM3Z’
account_id = ‘R2lU4KQ’

Token URL

token_url = ‘https://zoom.us/oauth/token

Token headers

token_headers = {
‘Authorization’: f’Basic {authorization_token}’
}

Token parameters

token_params = {
‘grant_type’: ‘account_credentials’,
‘account_id’: account_id
}

Request to get the access token

token_response = requests.post(token_url, headers=token_headers, params=token_params)

if token_response.status_code == 200:
access_token = token_response.json().get(‘access_token’)

# Zoom API endpoint
url = f'https://api.zoom.us/v2/accounts/{account_id}/users'

# Headers for the API request
headers = {
    'Authorization': f'Bearer {access_token}'
}

# Make the GET request to list users
response = requests.get(url, headers=headers)

# Check if the request was successful
if response.status_code == 200:
    users = response.json()
    print("List of users in the subaccount:")
    for user in users['users']:
        print(f"ID: {user['id']}, Email: {user['email']}, Name: {user['first_name']} {user['last_name']}")
else:
    print(f"Failed to retrieve users: {response.status_code}")
    print(response.json())

else:
print(f"Failed to obtain access token: {token_response.status_code}")
print(token_response.json())

Hi @em-pgdl-8, it looks like your account does not have any sub accounts, so the role permission needed to view these scopes is not available to you when you create this server to server app.

Are you trying to list the users on your account? Or the separate Zoom accounts your account manages.

  • Oh, sorry, I want to list all the users and meetings ( past, future, ongoing) they set.

  • Is there any direct option to fetch all my account’s past, ongoing, and scheduled meetings?