November 5, 2026
📝 More flexible request parameters in FastAPI, and FastAPI Cloud GA
More flexible request parameter models, and FastAPI Cloud ready for production.
Hello! 👋
I’ve been working on several FastAPI releases to make request parameter models more flexible. There’s also news from FastAPI Cloud!
Time to get your coffee and start reading ☕️
📝 More flexible request parameters with Pydantic models
FastAPI lets you group related form fields, query parameters, headers, and cookies in Pydantic models. Here’s an example with form data:
from typing import Annotated
from fastapi import FastAPI, Form
from pydantic import BaseModel
app = FastAPI()
class Profile(BaseModel):
name: str
age: int
class Preferences(BaseModel):
theme: str
language: str
Now you can combine them in the same path operation:
@app.post("/profiles/")
async def create_profile(
profile: Annotated[Profile, Form()],
preferences: Annotated[Preferences, Form()],
):
return {"profile": profile, "preferences": preferences}
The client sends name, age, theme, and language as regular form fields. FastAPI validates them with the models. 🤓
To make the preferences group optional, change that parameter to:
preferences: Annotated[Preferences | None, Form()] = None
If both theme and language are omitted, preferences will be None. If either is sent, both are required.
Combining models and making groups optional also work for query parameters, headers, and cookies, using Query(), Header(), and Cookie().
For form data, you can also use a union to accept different models, for example, a person’s profile or company details:
class Company(BaseModel):
company_name: str
industry: str
@app.post("/contacts/")
async def create_contact(contact: Annotated[Profile | Company, Form()]):
return contact
Send name and age for a profile, or company_name and industry for a company.
Use FastAPI 0.162.0 or later. Check the form-model tutorial for complete examples and the release notes for upgrade details.
☁️ FastAPI Cloud is now generally available
FastAPI Cloud is ready for your production apps! 🎉
During the public beta, thousands of developers deployed thousands of apps. Their feedback helped the team improve the platform’s reliability ahead of general availability.
Read the GA announcement, or deploy your next FastAPI app.
Let me know what you’re building with FastAPI. You can reply right here.
Talk soon! 👋
