diff --git a/authentik/api/pagination.py b/authentik/api/pagination.py index 4acd857ab6..dff0b52d8f 100644 --- a/authentik/api/pagination.py +++ b/authentik/api/pagination.py @@ -5,6 +5,7 @@ from rest_framework import pagination from rest_framework.response import Response from authentik.api.v3.schema.response import PAGINATION +from authentik.lib.config import CONFIG class Pagination(pagination.PageNumberPagination): @@ -12,6 +13,7 @@ class Pagination(pagination.PageNumberPagination): page_query_param = "page" page_size_query_param = "page_size" + max_page_size = CONFIG.get("pagination.max_page_size") def get_paginated_response(self, data): previous_page_number = 0 diff --git a/authentik/lib/default.yml b/authentik/lib/default.yml index 0c38adda44..40ea28890a 100644 --- a/authentik/lib/default.yml +++ b/authentik/lib/default.yml @@ -92,6 +92,9 @@ throttle: device: 20/hour default: 1000/second +pagination: + page_size: 100 + outposts: # Placeholders: # %(type)s: Outpost type; proxy, ldap, etc diff --git a/authentik/root/settings.py b/authentik/root/settings.py index deeaf59747..80f54eb1ba 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -205,7 +205,7 @@ SPECTACULAR_SETTINGS = { REST_FRAMEWORK = { "DEFAULT_PAGINATION_CLASS": "authentik.api.pagination.Pagination", - "PAGE_SIZE": 100, + "PAGE_SIZE": CONFIG.get("pagination.page_size", 100), "DEFAULT_FILTER_BACKENDS": [ "authentik.rbac.filters.ObjectFilter", "django_filters.rest_framework.DjangoFilterBackend", diff --git a/website/docs/install-config/configuration/configuration.mdx b/website/docs/install-config/configuration/configuration.mdx index 258f50d11e..746cb28e80 100644 --- a/website/docs/install-config/configuration/configuration.mdx +++ b/website/docs/install-config/configuration/configuration.mdx @@ -483,6 +483,16 @@ Configure how long unauthenticated sessions last for. Does not impact how long a Defaults to `days=1`. +### `AUTHENTIK_PAGINATION__PAGE_SIZE`:ak-version[2026.2] + +Configure the default number of items per page returned on paginated endpoints. + +Defaults to `100`. + +### `AUTHENTIK_PAGINATION__MAX_PAGE_SIZE`:ak-version[2026.2] + +Configure the maximum number of items per page returned on paginated endpoints. + ### `AUTHENTIK_WEB__WORKERS` Configure how many gunicorn worker processes should be started (see https://docs.gunicorn.org/en/stable/design.html).