Overview
AWX API list endpoints return paginated responses to manage large datasets efficiently. The pagination implementation is defined inawx/api/pagination.py.
Default Pagination
By default, AWX uses page number pagination with the following characteristics:- Default page size: Based on DRF settings
- Maximum page size: Controlled by
MAX_PAGE_SIZEsetting - Page query parameter:
page - Page size query parameter:
page_size
Paginated Response Structure
Total number of items across all pages
URL to the next page (null if last page)
URL to the previous page (null if first page)
Array of resource objects for the current page
Query Parameters
Page Number
Navigate to a specific page:Page Size
Control the number of items per page:Page number to retrieve
Number of results per page (max: MAX_PAGE_SIZE setting)
Maximum Page Size
If you request apage_size larger than the configured MAX_PAGE_SIZE, it will be automatically capped:
Disabled Count Pagination
For large datasets, counting all results can be expensive. Usecount_disabled to skip counting:
Skip counting total results for performance
count_disabled=1, the response structure changes:
The
count field is omitted and a fixed value is used internally to determine paginationLimit Pagination
For event endpoints like job events, you can use limit-based pagination instead:Maximum number of results to return (used by UnifiedJobEventPagination)
Pagination Classes
AWX uses different pagination classes based on the endpoint:Pagination (Default)
Used by most list endpoints:- Page-based navigation
- Configurable page size
- Full result count
LimitPagination
Used for simple result limiting:- No page navigation
- Just limits result count
- Returns results array only
UnifiedJobEventPagination
Used for job event endpoints:- Supports both page and limit parameters
- Automatically switches based on query params
- Optimized for streaming events
Iterating Through Pages
Python Example
Bash Example
Combining with Filtering and Ordering
Pagination works seamlessly with filtering and ordering:Performance Considerations
Use Appropriate Page Sizes
Use Appropriate Page Sizes
Balance between number of requests and response size. Too small = many requests, too large = slow responses.
Use count_disabled for Large Datasets
Use count_disabled for Large Datasets
When iterating through all results, skip counting to improve performance:
Cache Results When Possible
Cache Results When Possible
If data doesn’t change frequently, cache paginated results to reduce API calls.
Use Limit for Event Streams
Use Limit for Event Streams
For job events and similar resources, use
limit instead of pagination:Error Handling
Invalid Page Number
Invalid Page Size
Excessive page sizes are automatically capped toMAX_PAGE_SIZE.
Examples
Get First Page with Custom Size
Get All Job Events with Limit
Paginate Without Count
Related Configuration
Pagination behavior is controlled by Django settings:MAX_PAGE_SIZE- Maximum allowed page sizePAGE_SIZE- Default page size (DRF setting)