authentik-client

2026.2.1 · active · verified Wed Apr 15

authentik is an open-source Identity Provider (IdP) for modern SSO, supporting SAML, OAuth2/OIDC, LDAP, RADIUS, and more. This Python package, currently version 2026.2.1, is an automatically generated API client designed to interact with the authentik API from Python. Releases generally occur every two months, shifting to a three-month cycle starting with version 2026.5.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the authentik client with an access token (preferably via environment variables) and fetch a list of users using the CoreApi. Replace `YOUR_AUTHENTIK_TOKEN` and `https://your.authentik.instance/api/v3` with your actual authentik instance details and a valid token.

import authentik_client
from authentik_client.rest import ApiException
import os

# Configure API key authorization: authentik
# For machine-to-machine authentication, typically an application-specific token is used.
# Set AUTHENTIK_HOST and AUTHENTIK_ACCESS_TOKEN environment variables.
configuration = authentik_client.Configuration(
    host=os.environ.get("AUTHENTIK_HOST", "https://your.authentik.instance/api/v3"),
    access_token=os.environ.get("AUTHENTIK_ACCESS_TOKEN", "YOUR_AUTHENTIK_TOKEN")
)

# Create an instance of the API class
with authentik_client.ApiClient(configuration) as api_client:
    # Create an instance of the Core API (or any other API you need)
    core_api = authentik_client.CoreApi(api_client)

    try:
        # Example: Get a list of users
        # For a full list of available APIs and models, refer to the client's documentation.
        users_page = core_api.core_users_list()
        print("Successfully fetched users:")
        for user in users_page.results:
            print(f"  - {user.username} ({user.email})")

    except ApiException as e:
        print(f"Exception when calling CoreApi->core_users_list: {e}")
    except KeyError as e:
        print(f"Environment variable not set: {e}. Please set AUTHENTIK_HOST and AUTHENTIK_ACCESS_TOKEN.")

view raw JSON →