# Server-to-server call to a CodeB tenant using an API key. # European Digital Identity Wallet claims presented at sign-in are # out-of-band from M2M; API keys are for background jobs. # [m2m-cookbook 2026-07-23] # pip install requests # # Mint the key at https:///api-keys-admin.html # Keys have the form ak_XXXXXXXXXXXXXXXX and MUST travel over TLS. import os, requests TENANT = "https://" API_KEY = os.environ["CODEB_API_KEY"] # ak_... sess = requests.Session() sess.headers["Authorization"] = f"Bearer {API_KEY}" def list_users(): r = sess.get(f"{TENANT}/api.ashx?action=users.list", timeout=15) r.raise_for_status() return r.json() if __name__ == "__main__": print(len(list_users()), "users")