fastapi-pagination
FastAPI pagination
Decision gist · record as of 2026-08-14
Yes. Active maintenance, low install friction, permissive MIT license, and no known vulnerabilities make this a safe choice. The library solves a common FastAPI problem with minimal dependencies and integrates cleanly with popular databases. Install if you need pagination in FastAPI endpoints.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or higher.
- When working with databases, use database-specific paginate functions (e.g., from fastapi_pagination.ext.sqlalchemy) to avoid loading all data into memory.
- Low friction install with three lightweight runtime dependencies (fastapi, pydantic, typing-extensions).
License · maintenance · safety
MIT (permissive) — MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely provided you include the license notice.
last release 2026-07-28 (17 days) · last repo commit 2026-08-14 · 1,677 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,932,953 downloads/mo, #2,445 on PyPI
Alternatives
Verify before relying
pip install fastapi-pagination
from fastapi import FastAPI
from fastapi_pagination import Page, add_pagination, paginate
from pydantic import BaseModel
app = FastAPI()
add_pagination(app)
class Item(BaseModel):
name: str
items = [Item(name="a"), Item(name="b")]
@app.get("/items")
async def get_items() -> Page[Item]:
return paginate(items)- Which specific SQL and NoSQL frameworks are supported beyond SQLAlchemy, Tortoise ORM, and PyMongo mentioned in the description.
- Performance characteristics and memory overhead when paginating large result sets with the default paginate function.
What it is and what it does
fastapi-pagination is a utility library that integrates pagination into FastAPI applications by providing a Page return type and paginate function to handle subset selection and response formatting. It abstracts away the common logic needed to implement pagination across endpoints, supporting both page-based and cursor-based strategies.
The library works with FastAPI's dependency injection and async/await patterns, and includes integrations for popular database libraries like SQLAlchemy to avoid loading entire result sets into memory. You define your endpoint's return type as Page[YourModel], call paginate on your data or query, and the library handles generating the paginated response with metadata. It requires Python 3.10 or higher and depends on fastapi, pydantic, and typing-extensions.
Use it for
- Build REST APIs that return large datasets in manageable chunks without loading all records into memory.
- Add cursor-based pagination to endpoints querying SQLAlchemy ORM models or other SQL databases.
- Implement page-based pagination for in-memory lists or NoSQL database queries with automatic response formatting.
- Generate OpenAPI documentation automatically for paginated endpoints without manual schema definition.
- Support async database queries with pagination across Tortoise ORM or PyMongo without blocking.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Active maintenance, low install friction, permissive MIT license, and no known vulnerabilities make this a safe choice. The library solves a common FastAPI problem with minimal dependencies and integrates cleanly with popular databases. Install if you need pagination in FastAPI endpoints.
Install
fastapi-pagination on PyPI
Before you install
Low friction install with three lightweight runtime dependencies (fastapi, pydantic, typing-extensions). Active maintenance with recent releases; last commit 2026-08-14 and 1677 repository stars indicate ongoing support.
Requires Python 3.10 or higher. When working with databases, use database-specific paginate functions (e.g., from fastapi_pagination.ext.sqlalchemy) to avoid loading all data into memory.
License in practice
MIT license permits commercial and private use with minimal restrictions; you may use, modify, and distribute this package freely provided you include the license notice.
Quickstart
pip install fastapi-pagination
from fastapi import FastAPI
from fastapi_pagination import Page, add_pagination, paginate
from pydantic import BaseModel
app = FastAPI()
add_pagination(app)
class Item(BaseModel):
name: str
items = [Item(name="a"), Item(name="b")]
@app.get("/items")
async def get_items() -> Page[Item]:
return paginate(items)
Verify before relying
- Which specific SQL and NoSQL frameworks are supported beyond SQLAlchemy, Tortoise ORM, and PyMongo mentioned in the description.
- Performance characteristics and memory overhead when paginating large result sets with the default paginate function.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesfastapipydantictyping-extensions |
| Maintenance | Actively maintained 17 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,932,953 / month, #2,445 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14 |
Evidence: fastapi_pagination-0.15.16-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “fastapi pagination library”
- fastapi-paginationAdds pagination support to FastAPI applications with utilities for…
- fastapi-filterAdds declarative filtering, sorting, and pagination to FastAPI…
- fastcrudFastCRUD provides async CRUD operations and automatic endpoint…
Give your agent the search over MCP, or paste the wish link into any chat.
More Dynamic Content packages
MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.
Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.
Soupsieve is a CSS selector library designed to work with Beautiful Soup 4 to select, match, and filter HTML and XML elements using modern CSS selectors from CSS level 1 through CSS level 4 specifications.
Install it if you use Beautiful Soup for HTML or XML parsing and want modern CSS selector support.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
Flask is a lightweight WSGI web application framework for building web applications in Python, from simple single-page sites to complex multi-route applications.
Mako compiles Python-embedded templates into Python modules for fast rendering, supporting layout inheritance, custom functions, and direct Python expressions within template syntax.
See also django-cursor-pagination · FastAPI-SQLAlchemy · fastcrud · flask-paginate · fastapi-filter · paginate · fastapi-restful · fastapi-utils · fastapi-events · tableau-api-lib