Skip to content

Authentik Module API Explanation

The Authentik module monitors active identity users and failed login attempts during the last 24 hours.


API Execution Logic

The module locates the service entry matching the identifier authentik. It resolves the API base URL from apiUrl or url, then reads the bearer token from the AUTHENTIK_API_KEY environment variable.

Request Execution

The backend executes two Authentik API requests:

  1. Active Users: /api/v3/core/users/?is_active=true&page_size=1
  2. Failed Logins: /api/v3/events/events/?action=login_failed&ordering=-created&page_size=100

Both requests use Authorization: Bearer [TOKEN] and a 5-second timeout.

Data Parsing

  • Users: The active user count is read from pagination.count.
  • Failed Logins: Returned events are filtered to only include records created within the last 24 hours.

Metric Calculation

  • Primary Metric: Active user count.
  • Secondary Metric: Failed login attempts in the last 24 hours.

Caching Strategy

The Authentik metrics are cached in memory for 60 seconds with a stale window of 300 seconds.