Listing OAuth clients and verifying scope assignments via Python SDK returns empty array

Problem

Need to pull every client tied to our org and check what scopes are actually attached. The docs say /api/v2//clients should return a list, but _api.get_oauth_clients() keeps returning an empty array. We’ve got at least twelve active clients in the UI. It’s not throwing any authentication errors either.

Code

from gen_cloud_py_sdk.genesis_cloud_python import Client

client = Client(region="us-east-1")
_api = client..Api()

clients = _api.get_oauth_clients()
print(f"Found {len(clients)} clients")

for page in range(1, 5):
 batch = _api.get_oauth_clients(page=page, page_size=50)
 print(batch)

Error/Output

The console just prints Found 0 clients and the loop spits out empty lists. No 401 or 403 errors appear. The bearer token works fine since the script hits the Analytics API right after this block.

Environment

  • Python 3.10.12
  • gen-cloud-py-sdk 7.4.1
  • Service account with admin: and read: scopes
  • US-East-1 production org
  • Tried running locally and via CI runner

Question

Is there a query parameter the SDK wrapper drops? It looks like includeDeleted=false might be getting stripped out. Or maybe the service account needs a different scope combo to read the client roster. I’ve tried swapping to :client:read but that breaks the analytics calls later. The raw curl command with the exact same token returns the full JSON array without issues. The Python client definitely sends something different in the request body or headers.

The Python SDK is probably caching an old token or hitting a scope mismatch. Try hitting the raw endpoint with requests to isolate the issue.

import requests
headers = {"Authorization": f"Bearer {access_token}"}
r = requests.get("https://api.mypurecloud.com/api/v2//clients", headers=headers)
print(r.status_code, r.json())