FastAPI · Pipe
response_model
FastAPI response models define the output schema for an endpoint. They document, validate, serialize, and filter returned data, which helps prevent sensitive fields from reaching clients.
Last updated
Syntax
@app.get("/path", response_model=Model)
def handler() -> Model:
...In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
FastAPI.getFastAPI.postPydantic BaseModelresponse_model_includeresponse_model_excluderesponse_model_exclude_unsetresponse_model_exclude_defaultsresponse_model_exclude_none