FastAPI 0.165.0
Let's not get carried away. FastAPI 0.165.0, released November 18, 2026, adds exactly one feature: configurable form parsing limits, from PR #16784. That is a good change for anyone accepting multipart uploads from the open internet. It is also the kind of change that quietly breaks an endpoint when the inheritance rules are not what you assumed.
What Actually Ships
A new form_limits argument is accepted by FastAPI(), APIRouter, the route decorators, and include_router(). It takes three keys:
max_fields: maximum number of text fields. Default 1,000, which is far more than most forms need.max_files: maximum number of files in a multipart form. Default 1,000.max_part_size: maximum size in bytes of each text field. Default 1 MiB, and for URL-encoded forms Starlette counts the encoded name and value together.
FastAPI forwards these settings to Starlette when it parses a request for a Form, File, or UploadFile parameter, including parameters inside dependencies. Exceeding a parser limit returns HTTP 400. The separate max_body_size setting still bounds the whole request, including uploaded file contents, and returns HTTP 413.
The Inheritance Trap
Each setting inherits independently. Leave a key out and it comes from the enclosing router, the router's include_router() default, or the app. Set only max_part_size on a route and max_fields still comes from above. That is convenient until two layers disagree and nobody can tell which default wins by reading a single file.
Mounted apps inherit the parent app's limit the same way. So do routers included with a default passed to include_router(), unless they declare their own. Worth writing down in a comment, because the resolution order is invisible at the call site of the endpoint.
Where It Bites: Middleware
This is the failure mode I would expect in production. If middleware reads the body before FastAPI selects a path operation, the app's limit applies to that read. A logging or signature-checking middleware calling await request.body() will reject a 2 MiB upload with the app's small limit, long before the request reaches a router configured for 100 MiB. The fix is to raise the app limit to cover the largest upload and enforce tighter limits on the individual operations.
The same applies to mounted apps: the mounted app's limit also applies to bytes the middleware already read.
Two More Details
If you parse a form manually with request.form(), pass your limits to the first call. Starlette caches the parsed form on the request, so a later call with different limits will not take effect.
And a limit on the body is not a limit on work. UploadFile can spill from memory to disk as it grows, and its contents still count toward max_body_size. If a path operation starts processing while the client is still streaming, total size is not known yet, so finish reading before you publish or move the file.
Upgrade or Wait?
Upgrade if you accept uploads and have no size ceiling, because "unlimited" is the default when no limit is configured anywhere. The bump is small and the behavior only changes for apps that opt in, with one exception: anyone who already relies on Starlette's parser defaults should check whether 1,000 fields and 1 MiB parts are acceptable before turning it on.
One footnote for AI-assisted setups: the release notes now point at an official FastAPI skill, installed with uvx library-skills, that teaches coding agents the patterns for your installed version. It is a separate concern from the limits feature, but it is the only other thing in the release.