Skip to content
masterclass Buddy

FastAPI · Class

PlainTextResponse

PlainTextResponse returns text or bytes as a plain-text HTTP response. You can use it directly or set it as a route's response class.

Last updated

Syntax

PlainTextResponse(content=None, status_code=200, headers=None, media_type=None, background=None)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Response
  • HTMLResponse
  • JSONResponse
  • RedirectResponse
  • StreamingResponse
  • FileResponse

Source: Custom Response - HTML, Stream, File, others - FastAPI. Checked 2026-11-03.