### Install Auth0 Python SDK Source: https://context7.com/auth0/auth0-python/llms.txt Install the SDK using pip. Include the `aiohttp` extra for asynchronous operations. ```bash pip install auth0-python # Optional: aiohttp transport for async operations pip install auth0-python[aiohttp] ``` -------------------------------- ### Install Auth0 Python Library Source: https://github.com/auth0/auth0-python/blob/master/README.md Use pip to install the auth0-python library. Requires Python 3.9 or higher. ```sh pip install auth0-python ``` -------------------------------- ### Get Directory Provisioning Configuration Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve the directory provisioning configuration for a specific connection. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.connections.directory_provisioning.get( id="id", ) ``` -------------------------------- ### Get Prompt Rendering Settings Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves the current rendering settings for a specific prompt and screen. ```APIDOC ## Get Prompt Rendering Settings ### Description Gets the render settings for a specified prompt and screen. ### Method GET (inferred from SDK usage) ### Endpoint (Not explicitly defined, inferred from SDK) ### Parameters #### Query Parameters - **prompt** (PromptGroupNameEnum) - Required - Name of the prompt. - **screen** (ScreenGroupNameEnum) - Required - Name of the screen. - **request_options** (RequestOptions) - Optional - Request-specific configuration. ### Request Example ```python client.prompts.rendering.get( prompt="login", screen="login", ) ``` ### Response #### Success Response (200) - **content** (GetAculResponseContent) - The rendering settings. ### Response Example (Response example not explicitly defined in the source) ``` -------------------------------- ### List and Create Connections with Python SDK Source: https://context7.com/auth0/auth0-python/llms.txt Shows how to list specific types of identity provider connections (e.g., Google OAuth2) and create new database connections with custom options. ```python from auth0.management import Auth0 from auth0.management.types import ConnectionStrategyEnum client = Auth0( base_url="https://your-tenant.auth0.com/api/v2", token="MANAGEMENT_API_TOKEN", ) # List only Google OAuth2 connections for conn in client.connections.list( strategy=ConnectionStrategyEnum.GOOGLE_OAUTH2, fields="id,name,enabled_clients", include_fields=True, ): print(conn.id, conn.name) # Create a new database connection new_conn = client.connections.create( name="my-db-connection", strategy="auth0", options={"requires_username": False, "passwordPolicy": "good"}, ) print(new_conn.id) ``` -------------------------------- ### Get User MFA Enrollment - Python Source: https://github.com/auth0/auth0-python/blob/master/reference.md Fetches the first confirmed multi-factor authentication enrollment for a specified user. This is useful for verifying MFA setup status. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.users.enrollments.get( id="id", ) ``` -------------------------------- ### Create and Deploy Actions with Python SDK Source: https://context7.com/auth0/auth0-python/llms.txt Demonstrates creating a serverless Action for the 'post-login' trigger with custom JavaScript code and then deploying it. It shows how to set custom claims in the access token. ```python from auth0.management import Auth0, ActionTrigger client = Auth0( base_url="https://your-tenant.auth0.com/api/v2", token="MANAGEMENT_API_TOKEN", ) # Create a post-login action action = client.actions.create( name="enrich-token-claims", supported_triggers=[ActionTrigger(id="post-login", version="v3")], code=""" exports.onExecutePostLogin = async (event, api) => { api.accessToken.setCustomClaim('https://myapp.com/roles', event.authorization?.roles ?? []); }; """, runtime="node18", ) print(f"Action ID: {action.id}, status: {action.status}") # Deploy the action deployed = client.actions.deploy(action_id=action.id) print(f"Deployed version: {deployed.id}") ``` -------------------------------- ### Get Selected Push Notification Provider Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve the currently configured push notification provider for your tenant. This is useful for auditing or understanding the current MFA setup. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.guardian.factors.push_notification.get_selected_provider() ``` -------------------------------- ### Get SNS Provider Configuration Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve configuration details for an AWS SNS push notification provider enabled for MFA. Review the Auth0 documentation for detailed setup. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.guardian.factors.push_notification.get_sns_provider() ``` -------------------------------- ### Initialize ManagementClient with Token (v4 vs v5) Source: https://github.com/auth0/auth0-python/blob/master/v5_MIGRATION_GUIDE.md Compares v4 Auth0 client initialization with v5 ManagementClient for token-based authentication. v5 uses a dedicated ManagementClient. ```python # v4 from auth0.management import Auth0 domain = 'your-tenant.auth0.com' token = 'MGMT_API_TOKEN' auth0 = Auth0(domain, token) # Access users user = auth0.users.get('user_id') ``` ```python # v5 from auth0.management import ManagementClient client = ManagementClient( domain="your-tenant.auth0.com", token="MGMT_API_TOKEN", ) # Access users user = client.users.get("user_id") ``` -------------------------------- ### Get Guardian Phone Factor Message Types Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve the list of phone-type MFA factors (SMS and voice) currently enabled for your tenant. This is useful for understanding your current MFA setup. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.guardian.factors.phone.get_message_types() ``` -------------------------------- ### Initialize ManagementClient with Client Credentials (v5) Source: https://github.com/auth0/auth0-python/blob/master/v5_MIGRATION_GUIDE.md Demonstrates v5 ManagementClient initialization using client ID and secret for automatic token management. The SDK handles fetching, caching, and refreshing tokens. ```python # v5 with client credentials from auth0.management import ManagementClient client = ManagementClient( domain="your-tenant.auth0.com", client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) # Token is automatically fetched and cached # No need to manually obtain or refresh tokens user = client.users.get("user_id") ``` -------------------------------- ### Get Connection Clients Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves enabled clients for a specific connection. Requires the connection ID. Optional parameters include 'take' for the number of results and 'from' to specify the starting point for selection. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.connections.clients.get( id="id", take=1, from_="from", ) ``` -------------------------------- ### List Directory Provisioning Configurations Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve a list of directory provisioning configurations for a tenant. Supports pagination using 'from' and 'take' parameters. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.connections.directory_provisioning.list( from_="from", take=1, ) ``` -------------------------------- ### Get Supplemental Signals Source: https://github.com/auth0/auth0-python/blob/master/reference.md Get the supplemental signals configuration for a tenant. ```APIDOC ## client.supplemental_signals.get() ### Description Get the supplemental signals configuration for a tenant. ### Method ```python client.supplemental_signals.get() ``` ### Parameters #### Request Body This method does not accept a request body. ### Response #### Success Response (200) - **configuration** (GetSupplementalSignalsResponseContent) - The supplemental signals configuration. ``` -------------------------------- ### client.prompts.get_settings Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve details of the Universal Login configuration of your tenant. ```APIDOC ## client.prompts.get_settings ### Description Retrieve details of the Universal Login configuration of your tenant. This includes the Identifier First Authentication and WebAuthn with Device Biometrics for MFA features. ### Method Not specified (likely SDK method) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python client.prompts.get_settings() ``` ### Response #### Success Response (200) Details of the Universal Login configuration. #### Response Example None specified ``` -------------------------------- ### Create and List Roles with Python SDK Source: https://context7.com/auth0/auth0-python/llms.txt Shows how to create new RBAC roles with names and descriptions, and how to list existing roles, optionally filtering by name. ```python from auth0.management import Auth0 client = Auth0( base_url="https://your-tenant.auth0.com/api/v2", token="MANAGEMENT_API_TOKEN", ) # Create a role role = client.roles.create( name="content-editor", description="Can create and edit articles", ) print(f"Role ID: {role.id}") # List all roles with name filter for r in client.roles.list(name_filter="content"): print(r.id, r.name, r.description) ``` -------------------------------- ### Database Signup using `Database.signup` Source: https://context7.com/auth0/auth0-python/llms.txt Creates a new user in an Auth0 database connection directly. No Management API token is required. Ensure the `connection` name is correct. ```python from auth0.authentication import Database db = Database( domain="your-tenant.auth0.com", client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) user = db.signup( email="newuser@example.com", password="SecurePassword123!", connection="Username-Password-Authentication", given_name="Jane", family_name="Doe", user_metadata={"plan": "free", "referral_code": "FRIEND10"}, ) # Returns: {"_id": "...", "email": "newuser@example.com", "email_verified": false, ...} print(user["_id"]) ``` -------------------------------- ### Get SCIM Configuration Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves a SCIM configuration by its connectionId. ```APIDOC ## get ### Description Retrieves a scim configuration by its connectionId. ### Method client.connections.scim_configuration.get ### Parameters #### Path Parameters - **id** (str) - Required - The id of the connection to retrieve its SCIM configuration. #### Query Parameters None #### Request Body None ### Request Example ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.connections.scim_configuration.get( id="id", ) ``` ### Response #### Success Response (200) - **connection_id** (str) - The ID of the connection. - **enabled** (bool) - Whether SCIM provisioning is enabled for the connection. - **strategy** (str) - The provisioning strategy. - **tenant_id** (str) - The ID of the tenant. #### Response Example ```json { "connection_id": "string", "enabled": true, "strategy": "string", "tenant_id": "string" } ``` ``` -------------------------------- ### List Prompt Rendering Configurations Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves render setting configurations for all screens. ```APIDOC ## List Prompt Rendering Configurations ### Description Get render setting configurations for all screens. ### Method client.prompts.rendering.list ### Query Parameters - **fields** (typing.Optional[str]) - Optional - Comma-separated list of fields to include or exclude (based on value provided for include_fields) in the result. Leave empty to retrieve all fields. - **include_fields** (typing.Optional[bool]) - Optional - Whether specified fields are to be included (default: true) or excluded (false). - **page** (typing.Optional[int]) - Optional - Page index of the results to return. First page is 0. - **per_page** (typing.Optional[int]) - Optional - Number of results per page. Maximum value is 100, default value is 50. - **include_totals** (typing.Optional[bool]) - Optional - Return results inside an object that contains the total configuration count (true) or as a direct array of results (false, default). - **prompt** (typing.Optional[str]) - Optional - Name of the prompt to filter by. - **screen** (typing.Optional[str]) - Optional - Name of the screen to filter by. - **rendering_mode** (typing.Optional[AculRenderingModeEnum]) - Optional - Rendering mode to filter by. - **request_options** (typing.Optional[RequestOptions]) - Optional - Request-specific configuration. ``` -------------------------------- ### Get CAPTCHA Configuration Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves the CAPTCHA configuration for your client. ```APIDOC ## Get CAPTCHA Configuration ### Description Get the CAPTCHA configuration for your client. ### Method GET ### Endpoint /attack-protection/captcha ### Parameters #### Query Parameters - **request_options** (RequestOptions) - Optional - Request-specific configuration. ### Response #### Success Response (200) - **active_provider_id** (AttackProtectionCaptchaProviderId) - The ID of the currently active CAPTCHA provider. - **arkose** (AttackProtectionUpdateCaptchaArkose) - Arkose Labs configuration. - **auth_challenge** (AttackProtectionCaptchaAuthChallengeRequest) - Auth challenge configuration. - **hcaptcha** (AttackProtectionUpdateCaptchaHcaptcha) - hCaptcha configuration. - **friendly_captcha** (AttackProtectionUpdateCaptchaFriendlyCaptcha) - Friendly Captcha configuration. - **recaptcha_enterprise** (AttackProtectionUpdateCaptchaRecaptchaEnterprise) - reCAPTCHA Enterprise configuration. - **recaptcha_v_2** (AttackProtectionUpdateCaptchaRecaptchaV2) - reCAPTCHA v2 configuration. - **simple_captcha** (AttackProtectionCaptchaSimpleCaptchaResponseContent) - Simple Captcha configuration. ### Response Example ```json { "active_provider_id": "hcaptcha", "hcaptcha": { "site_key": "your_hcaptcha_site_key" } } ``` ``` -------------------------------- ### Get Refresh Token Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve refresh token information. ```APIDOC ## RefreshTokens get ### Description Retrieve refresh token information. ### Method GET ### Endpoint `/refresh-tokens/{id}` ### Parameters #### Path Parameters - **id** (str) - Required - The ID of the refresh token to retrieve. ### Response #### Success Response (200) - **credential_id** (str) - The ID of the credential. - **client_id** (str) - The ID of the client associated with the token. - **device_name** (str) - The name of the device. - **created_at** (str) - The date and time the token was created. - **last_ip** (str) - The last IP address used to issue the token. - **user_agent** (str) - The user agent string. - **expires_at** (str) - The date and time the token expires. - **audience** (str) - The audience of the token. ``` -------------------------------- ### Manage Organizations with Python SDK Source: https://context7.com/auth0/auth0-python/llms.txt Demonstrates creating new B2B organizations with branding and metadata, and paginating through existing organizations using checkpoint pagination for large result sets. ```python from auth0.management import Auth0 client = Auth0( base_url="https://your-tenant.auth0.com/api/v2", token="MANAGEMENT_API_TOKEN", ) # Create an organization org = client.organizations.create( name="acme-corp", display_name="Acme Corporation", branding={"logo_url": "https://acme.example.com/logo.png", "colors": {"primary": "#3A3A3A", "page_background": "#FFFFFF"}}, metadata={"tier": "enterprise"}, ) print(f"Org ID: {org.id}") # Paginate all organizations (checkpoint pagination for >1000) for organization in client.organizations.list(take=100): print(organization.id, organization.display_name) ``` -------------------------------- ### Get Group Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves a specific group by its unique identifier. ```APIDOC ## client.groups.get ### Description Retrieve a group by its ID. ### Method ```python client.groups.get( id: str, request_options: typing.Optional[RequestOptions] = None ) -> GetGroupResponseContent ``` ### Parameters #### Path Parameters - **id** (str) - Required - Unique identifier for the group (service-generated). #### Query Parameters - **request_options** (typing.Optional[RequestOptions]) - Optional - Request-specific configuration. ``` -------------------------------- ### client.connections.directory_provisioning.create Source: https://github.com/auth0/auth0-python/blob/master/reference.md Creates a directory provisioning configuration for a specified connection. ```APIDOC ## client.connections.directory_provisioning.create ### Description Create a directory provisioning configuration for a connection. ### Method POST (inferred from SDK method) ### Endpoint /connections/{id}/directory-provisioning (inferred from SDK structure) ### Parameters #### Path Parameters - **id** (str) - Required - The id of the connection to create its directory provisioning configuration #### Request Body - **request** (CreateDirectoryProvisioningRequestContent) - Optional - The request body for creating the directory provisioning configuration. - **request_options** (RequestOptions) - Optional - Request-specific configuration. ### Request Example ```python from auth0.management import Auth0, CreateDirectoryProvisioningRequestContent from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.connections.directory_provisioning.create( id="id", request=CreateDirectoryProvisioningRequestContent(), ) ``` ### Response #### Success Response (200) - **content** (CreateDirectoryProvisioningResponseContent) - The response content for the created directory provisioning configuration. ``` -------------------------------- ### Initialize ManagementClient Source: https://github.com/auth0/auth0-python/blob/master/README.md Initialize the ManagementClient with your Auth0 domain and either an existing token or client credentials for automatic token management. ```python from auth0.management import ManagementClient # With an existing token client = ManagementClient( domain="your-tenant.auth0.com", token="YOUR_TOKEN", ) # Or with client credentials (automatic token acquisition and refresh) client = ManagementClient( domain="your-tenant.auth0.com", client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", ) ``` -------------------------------- ### Get Action Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve a specific action by its unique identifier. ```APIDOC ## get ### Description Retrieve an action by its ID. ### Method client.actions.get ### Parameters #### Path Parameters - **id** (str) - The ID of the action to retrieve. #### Query Parameters - **request_options** (typing.Optional[RequestOptions]) - Request-specific configuration. ### Request Example ```python client.actions.get( id="id", ) ``` ### Response #### Success Response (GetActionResponseContent) - **id** (str) - The ID of the action. - **name** (str) - The name of the action. - **supported_triggers** (list) - The list of triggers the action supports. - **created_at** (str) - The timestamp when the action was created. - **updated_at** (str) - The timestamp when the action was last updated. ``` -------------------------------- ### Flows Executions Get Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves a specific flow execution by its ID. ```APIDOC ## client.flows.executions.get ### Description Retrieves a specific flow execution by its ID. ### Method GET (inferred from usage pattern) ### Endpoint /flow-executions/{execution_id} (inferred from usage pattern) ### Parameters #### Path Parameters - **flow_id** (str) - Required - Flow id - **execution_id** (str) - Required - Flow execution id #### Query Parameters - **hydrate** (typing.Optional[typing.Union[typing.Optional[GetFlowExecutionRequestParametersHydrateEnum], typing.Sequence[typing.Optional[GetFlowExecutionRequestParametersHydrateEnum]]]]) - Optional - Hydration param ### Request Example ```python client.flows.executions.get( flow_id="flow_id", execution_id="execution_id", hydrate=[ "debug" ], ) ``` ### Response #### Success Response (200) - **GetFlowExecutionResponseContent** - Type not explicitly documented. ``` -------------------------------- ### Initialize Async Client Source: https://github.com/auth0/auth0-python/blob/master/README.md Instantiate the asynchronous Auth0 client for non-blocking API calls. Ensure to use `httpx.AsyncClient()` if passing a custom httpx client. ```python import asyncio from auth0.management import ActionTrigger, AsyncAuth0 client = AsyncAuth0( base_url="https://YOUR_TENANT.auth0.com/api/v2", token="YOUR_TOKEN", ) async def main() -> None: await client.actions.create( name="name", supported_triggers=[ ActionTrigger( id="id", ) ], ) asyncio.run(main()) ``` -------------------------------- ### Get Branding Theme Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves a specific branding theme by its ID. ```APIDOC ## Get Branding Theme ### Description Retrieves a specific branding theme by its ID. ### Method ```python client.branding.themes.get(theme_id: str, request_options: typing.Optional[RequestOptions] = None) ``` ### Parameters #### Path Parameters - **theme_id** (str) - Required - The ID of the theme. - **request_options** (typing.Optional[RequestOptions]) - Optional - Request-specific configuration. ### Request Example ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.branding.themes.get( theme_id="themeId", ) ``` ``` -------------------------------- ### Get Role Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves details about a specific user role by its ID. ```APIDOC ## client.roles.get ### Description Retrieve details about a specific user role specified by ID. ### Method client.roles.get ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **id** (str) - Required - ID of the role to retrieve. - **request_options** (Optional[RequestOptions]) - Optional - Request-specific configuration. ### Request Example ```python client.roles.get( id="id", ) ``` ### Response #### Success Response (200) Details about the specified role. #### Response Example None provided in source. ``` -------------------------------- ### Create Directory Provisioning Configuration Source: https://github.com/auth0/auth0-python/blob/master/reference.md Use this method to create a directory provisioning configuration for a given connection. Ensure you have the connection ID and a valid request payload. ```python from auth0.management import Auth0, CreateDirectoryProvisioningRequestContent from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.connections.directory_provisioning.create( id="id", request=CreateDirectoryProvisioningRequestContent(), ) ``` -------------------------------- ### Get Branding Configuration Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve the branding configuration for your Auth0 tenant. ```python client.branding.get() ``` -------------------------------- ### Create New Resource Server Source: https://github.com/auth0/auth0-python/blob/master/reference.md Create a new API associated with your tenant. Ensure you have read the Auth0 documentation on API registration before use. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.resource_servers.create( identifier="identifier", ) ``` -------------------------------- ### Get Organization Connection Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves details of a specific connection associated with an organization. ```APIDOC ## Get Organization Connection ### Description Retrieves details of a specific connection associated with an organization. ### Method client.organizations.connections.get ### Parameters #### Path Parameters - **id** (str) - Required - Organization identifier. - **connection_id** (str) - Required - Connection identifier. #### Query Parameters - **request_options** (RequestOptions) - Optional - Request-specific configuration. ### Request Example ```python client.organizations.connections.get( id="org_id", connection_id="conn_id" ) ``` ### Response #### Success Response (200) Details of the organization connection. ``` -------------------------------- ### List SCIM Configurations Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve a list of SCIM configurations for a tenant. Supports pagination with 'from' and 'take' parameters. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.connections.scim_configuration.list( from_="from", take=1, ) ``` -------------------------------- ### Get Phone Template Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves a specific phone notification template by its ID. ```APIDOC ## Get Phone Template ### Description Retrieves a specific phone notification template by its ID. ### Method GET ### Endpoint `/api/v2/branding/phone/templates/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the template to retrieve. #### Query Parameters - **request_options** (RequestOptions) - Optional - Request-specific configuration. ### Response #### Success Response (200) - **template** (object) - The phone template object. ### Response Example ```json { "template": { "template": "Your code is {{code}}", "enabled": true } } ``` ``` -------------------------------- ### Configure RestClientOptions (v4 vs v5) Source: https://github.com/auth0/auth0-python/blob/master/v5_MIGRATION_GUIDE.md Shows how to configure client options like telemetry, timeout, and retries. v4 uses RestClientOptions, while v5 integrates these directly into ManagementClient parameters. ```python # v4 from auth0.management import Auth0 from auth0.rest import RestClientOptions options = RestClientOptions( telemetry=True, timeout=5.0, retries=3 ) auth0 = Auth0(domain, token, rest_options=options) ``` ```python # v5 from auth0.management import ManagementClient client = ManagementClient( domain="your-tenant.auth0.com", token="MGMT_API_TOKEN", timeout=60.0, # Timeout in seconds headers={"X-Custom-Header": "value"}, # Custom headers ) ``` -------------------------------- ### Get Active Users Count Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves the count of active users in the tenant. ```APIDOC ## client.stats.get_active_users_count() ### Description Retrieves the count of active users in the tenant. ### Method ```python client.stats.get_active_users_count() ``` ### Parameters #### Request Body This method does not accept a request body. ### Response #### Success Response (200) - **count** (int) - The number of active users. ``` -------------------------------- ### Retrieve Branding Settings - Python Source: https://github.com/auth0/auth0-python/blob/master/reference.md Use this to fetch current branding configurations. Requires an authenticated Auth0 client. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.branding.get() ``` -------------------------------- ### List Prompt Rendering Settings Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves render setting configurations for all screens. Supports filtering by fields, pagination, prompt name, screen name, and rendering mode. Use `include_totals=True` to get the total count of configurations. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.prompts.rendering.list( fields="fields", include_fields=True, page=1, per_page=1, include_totals=True, prompt="prompt", screen="screen", rendering_mode="advanced", ) ``` -------------------------------- ### Get Self Service Profile Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves a specific self-service profile by its ID. ```APIDOC ## GET /api/v2/self-service-profiles/{id} ### Description Retrieves a self-service profile by Id. ### Method GET ### Endpoint /api/v2/self-service-profiles/{id} ### Parameters #### Path Parameters - **id** (str) - Required - The id of the self-service profile to retrieve ### Response #### Success Response (200) - **id** (str) - The ID of the self-service profile. - **name** (str) - The name of the self-service profile. - **description** (str) - The description of the self-service profile. - **branding** (SelfServiceProfileBrandingProperties) - Branding properties for the self-service profile. - **allowed_strategies** (List[SelfServiceProfileAllowedStrategyEnum]) - List of allowed IdP strategies. - **user_attributes** (List[SelfServiceProfileUserAttribute]) - List of user attributes to be mapped. - **user_attribute_profile_id** (str) - The ID of the associated user attribute profile. ### Response Example ```json { "id": "id", "name": "name", "description": "description", "branding": {}, "allowed_strategies": [ "oidc" ], "user_attributes": [ { "key": "key", "value": "value" } ], "user_attribute_profile_id": "user_attribute_profile_id" } ``` ``` -------------------------------- ### Manual Pagination Pattern (v4) Source: https://github.com/auth0/auth0-python/blob/master/v5_MIGRATION_GUIDE.md Demonstrates the manual pagination approach used in v4, involving looping through pages and checking against total counts to retrieve all items. ```python # v4: Manual pagination all_users = [] page = 0 while True: result = auth0.users.list(page=page, per_page=50, include_totals=True) all_users.extend(result['users']) if len(all_users) >= result['total']: break page += 1 # Process all users for user in all_users: print(user['email']) ``` -------------------------------- ### Get Organization by Name Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve details about a single Organization specified by its name. ```APIDOC ## get_by_name ### Description Retrieve details about a single Organization specified by name. ### Method GET ### Endpoint /api/v2/organizations?name={name} ### Parameters #### Query Parameters - **name** (string) - Required - The name of the organization to retrieve. - **request_options** (RequestOptions) - Optional - Request-specific configuration. ### Request Example ```python client.organizations.get_by_name( name="organization_name", ) ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the organization. - **name** (string) - The name of the organization. - **display_name** (string) - The friendly name of the organization. - **branding** (object) - Branding settings for the organization. - **metadata** (object) - Custom metadata for the organization. - **enabled_connections** (array) - Connections enabled for this organization. - **token_quota** (object) - Token quota configuration for the organization. - **created_at** (string) - The timestamp when the organization was created. - **updated_at** (string) - The timestamp when the organization was last updated. #### Response Example { "id": "org_abcdef1234567890", "name": "organization_name", "display_name": "Organization Name", "branding": { "logo_url": "https://example.com/logo.png" }, "metadata": { "custom_field": "custom_value" }, "enabled_connections": [ { "id": "conn_abcdef1234567890", "name": "My Connection" } ], "token_quota": { "id_token_lifetime": 3600 }, "created_at": "2023-01-01T10:00:00Z", "updated_at": "2023-01-01T10:00:00Z" } ``` -------------------------------- ### Get Log Stream Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve a log stream configuration and its current status. ```APIDOC ## GET /api/v2/log-streams/{id} ### Description Retrieve a log stream configuration and status. ### Method GET ### Endpoint /api/v2/log-streams/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The id of the log stream to get #### Request Example ```python client.log_streams.get(id="id") ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the log stream. - **name** (string) - The name of the log stream. - **type** (string) - The type of the log stream (e.g., "eventbridge", "http", "datadog", "mixpanel", "segment", "splunk", "sumo"). - **status** (string) - The current status of the log stream. Possible values are `active`, `paused`, or `suspended`. - **sink** (object) - Configuration details specific to the log stream type. - For EventBridge: `awsAccountId`, `awsRegion`, `awsPartnerEventSource` - For HTTP: `httpContentFormat`, `httpContentType`, `httpEndpoint`, `httpAuthorization` - For Datadog: `datadogRegion`, `datadogApiKey` - For Mixpanel: `mixpanelRegion`, `mixpanelProjectId`, `mixpanelServiceAccountUsername`, `mixpanelServiceAccountPassword` - For Segment: `segmentWriteKey` - For Splunk: `splunkDomain`, `splunkToken`, `splunkPort`, `splunkSecure` - For Sumo Logic: `sumoSourceAddress` #### Response Example ```json { "id": "string", "name": "string", "type": "eventbridge", "status": "active", "sink": { "awsAccountId": "string", "awsRegion": "string", "awsPartnerEventSource": "string" } } ``` ``` -------------------------------- ### List Directory Provisioning Configurations Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve a list of directory provisioning configurations for a tenant. Supports pagination. ```APIDOC ## List Directory Provisioning Configurations ### Description Retrieve a list of directory provisioning configurations of a tenant. ### Method GET ### Endpoint `/api/v2/connections/directory-provisioning` ### Parameters #### Query Parameters - **from** (Optional[str]) - Optional - Optional Id from which to start selection. - **take** (Optional[int]) - Optional - Number of results per page. Defaults to 50. ### Request Example ```python client.connections.directory_provisioning.list( from_="from", take=1, ) ``` ### Response #### Success Response (200) - **ListDirectoryProvisioningsResponseContent** - A list of directory provisioning configurations. ``` -------------------------------- ### Bulk Update Prompt Rendering Configurations Source: https://github.com/auth0/auth0-python/blob/master/reference.md Use this to update multiple prompt rendering configurations at once. Ensure you have the necessary token and environment configured. ```python from auth0.management import Auth0, AculConfigsItem from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.prompts.rendering.bulk_update( configs=[ AculConfigsItem( prompt="login", screen="login", ) ], ) ``` -------------------------------- ### Get Event Stream Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves a specific event stream by its unique identifier. ```APIDOC ## GET /event-streams/{id} ### Description Retrieves a specific event stream by its unique identifier. ### Method GET ### Endpoint `/event-streams/{id}` ### Parameters #### Path Parameters - **id** (str) - Required - Unique identifier for the event stream. #### Query Parameters - **request_options** (typing.Optional[RequestOptions]) - Optional - Request-specific configuration. ### Request Example ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.event_streams.get( id="id", ) ``` ### Response #### Success Response (200) - **id** (str) - The unique identifier for the event stream. - **type** (str) - The type of the event stream. - **created_at** (str) - The timestamp when the event stream was created. - **updated_at** (str) - The timestamp when the event stream was last updated. - **status** (str) - The current status of the event stream. - **name** (str) - The name of the event stream. - **subscriptions** (list) - A list of event types subscribed to. - **sink_id** (str) - The identifier of the sink associated with the event stream. - **sink_type** (str) - The type of the sink. - **sink_configuration** (dict) - The configuration details of the sink. ``` -------------------------------- ### Create Branding Theme Source: https://github.com/auth0/auth0-python/blob/master/reference.md Use this to create a new branding theme. Requires extensive configuration for borders, colors, fonts, page background, and widget appearance. Ensure all necessary theme components are provided. ```python from auth0.management import Auth0, BrandingThemeBorders, BrandingThemeColors, BrandingThemeFonts, BrandingThemeFontBodyText, BrandingThemeFontButtonsText, BrandingThemeFontInputLabels, BrandingThemeFontLinks, BrandingThemeFontSubtitle, BrandingThemeFontTitle, BrandingThemePageBackground, BrandingThemeWidget from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.branding.themes.create( borders=BrandingThemeBorders( button_border_radius=1.1, button_border_weight=1.1, buttons_style="pill", input_border_radius=1.1, input_border_weight=1.1, inputs_style="pill", show_widget_shadow=True, widget_border_weight=1.1, widget_corner_radius=1.1, ), colors=BrandingThemeColors( body_text="body_text", error="error", header="header", icons="icons", input_background="input_background", input_border="input_border", input_filled_text="input_filled_text", input_labels_placeholders="input_labels_placeholders", links_focused_components="links_focused_components", primary_button="primary_button", primary_button_label="primary_button_label", secondary_button_border="secondary_button_border", secondary_button_label="secondary_button_label", success="success", widget_background="widget_background", widget_border="widget_border", ), fonts=BrandingThemeFonts( body_text=BrandingThemeFontBodyText( bold=True, size=1.1, ), buttons_text=BrandingThemeFontButtonsText( bold=True, size=1.1, ), font_url="font_url", input_labels=BrandingThemeFontInputLabels( bold=True, size=1.1, ), links=BrandingThemeFontLinks( bold=True, size=1.1, ), links_style="normal", reference_text_size=1.1, subtitle=BrandingThemeFontSubtitle( bold=True, size=1.1, ), title=BrandingThemeFontTitle( bold=True, size=1.1, ), ), page_background=BrandingThemePageBackground( background_color="background_color", background_image_url="background_image_url", page_layout="center", ), widget=BrandingThemeWidget( header_text_alignment="center", logo_height=1.1, logo_position="center", logo_url="logo_url", social_buttons_layout="bottom", ), ) ``` -------------------------------- ### Get Branding Settings Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves the current branding settings for your Auth0 tenant. ```APIDOC ## GET /branding ### Description Retrieve branding settings. ### Method GET ### Endpoint /api/v2/branding ### Parameters #### Query Parameters - **request_options** (typing.Optional[RequestOptions]) - Request-specific configuration. ### Response #### Success Response (200) - **colors** (typing.Optional[UpdateBrandingColors]) - Description - **favicon_url** (typing.Optional[str]) - URL for the favicon. Must use HTTPS. - **logo_url** (typing.Optional[str]) - URL for the logo. Must use HTTPS. - **font** (typing.Optional[UpdateBrandingFont]) - Description ### Request Example ```python client.branding.get() ``` ### Response Example ```json { "colors": { "primary": "#000000", "page_background": "#FFFFFF" }, "favicon_url": "https://example.com/favicon.ico", "logo_url": "https://example.com/logo.png", "font": { "url": "https://example.com/font.ttf" } } ``` ``` -------------------------------- ### Get Verifiable Credential Template Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves a specific verifiable credential template by its ID. ```APIDOC ## get verifiable credential template ### Description Get a verifiable credential template. ### Method client.verifiable_credentials.verification.templates.get ### Parameters #### Path Parameters - **id** (str) - Required - ID of the template to retrieve. #### Optional Parameters - **request_options** (Optional[RequestOptions]) - Request-specific configuration. ``` -------------------------------- ### Get, Update, and Delete Users with Python SDK Source: https://context7.com/auth0/auth0-python/llms.txt Demonstrates basic user operations: retrieving a user by ID, updating user details including application metadata, and deleting a user. ```python user = client.users.get(id=user_id) print(user.email, user.email_verified) ``` ```python updated = client.users.update( id=user_id, given_name="Jane", family_name="Smith", app_metadata={"plan": "pro"}, blocked=False, ) print(updated.name) ``` ```python client.users.delete(id=user_id) print("User deleted") ``` -------------------------------- ### Get Signing Key Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves details of the application signing key with the given ID. ```APIDOC ## Get Signing Key ### Description Retrieves details of the application signing key with the given ID. ### Method GET ### Endpoint /keys/signing/{kid} ### Parameters #### Path Parameters - **kid** (str) - Required - Key id of the key to retrieve #### Query Parameters - **request_options** (typing.Optional[RequestOptions]) - Optional - Request-specific configuration. ### Response #### Success Response (200) - **kid** (str) - The ID of the signing key. - **alg** (str) - The algorithm used for the key. - **use** (str) - The intended use of the key (e.g., 'sig' for signature). - **kty** (str) - The type of key material (e.g., 'RSA'). - **x5c** (list) - The X.509 certificate chain. ### Response Example { "kid": "", "alg": "RS256", "use": "sig", "kty": "RSA", "x5c": [ "" ] } ``` -------------------------------- ### Create SCIM Configuration Source: https://github.com/auth0/auth0-python/blob/master/reference.md Use this to create a SCIM configuration for a specific connection. Ensure you have the connection ID and a valid token. ```python from auth0.management import Auth0, CreateScimConfigurationRequestContent from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.connections.scim_configuration.create( id="id", request=CreateScimConfigurationRequestContent(), ) ``` -------------------------------- ### List Event Streams using Auth0 Python SDK Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve a list of event streams. This example demonstrates basic usage with 'from' and 'take' parameters. Ensure your token has the required permissions. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.event_streams.list( from_="from", take=1, ) ``` -------------------------------- ### Get Job Errors Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves detailed error information for a specific failed job. ```APIDOC ## Get Job Errors ### Description Retrieve error details of a failed job. ### Method GET ### Endpoint `/jobs/errors` ### Parameters #### Query Parameters - **id** (str) - Required - The ID of the job for which to retrieve errors. ### Response #### Success Response (200) - **ErrorsGetResponse** - The response containing error details for the specified job. ``` -------------------------------- ### Create Client Grant - Python Source: https://github.com/auth0/auth0-python/blob/master/reference.md Create a client grant for machine-to-machine authentication flows. Requires specifying the audience. ```python from auth0.management import Auth0 from auth0.management.environment import Auth0Environment client = Auth0( token="", environment=Auth0Environment.DEFAULT, ) client.client_grants.create( audience="audience", ) ``` -------------------------------- ### Get SCIM Tokens Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieves all SCIM tokens associated with a specific connection ID. ```APIDOC ## GET /api/v2/connections/{id}/scim-configuration/tokens ### Description Retrieves all scim tokens by its connection `id`. ### Method GET ### Endpoint `/api/v2/connections/{id}/scim-configuration/tokens` ### Parameters #### Path Parameters - **id** (str) - Required - The id of the connection to retrieve its SCIM configuration ### Response #### Success Response (200 OK) - **tokens** (array) - A list of SCIM tokens. - **token** (str) - The SCIM token. - **scopes** (array) - The scopes associated with the token. - **token_lifetime** (int) - The lifetime of the token in seconds. #### Error Response - **400 Bad Request**: If the connection ID is invalid. - **403 Forbidden**: If the token does not have the necessary permissions. ``` -------------------------------- ### Get Directory Provisioning Configuration Source: https://github.com/auth0/auth0-python/blob/master/reference.md Retrieve the directory provisioning configuration for a specific connection. ```APIDOC ## Get Directory Provisioning Configuration ### Description Retrieve the directory provisioning configuration of a connection. ### Method GET ### Endpoint `/api/v2/connections/directory-provisioning/{id}` ### Parameters #### Path Parameters - **id** (str) - Required - The ID of the connection to retrieve the directory provisioning configuration for. ### Request Example ```python client.connections.directory_provisioning.get( id="id", ) ``` ### Response #### Success Response (200) - **GetDirectoryProvisioningResponseContent** - The directory provisioning configuration of a connection. ```