Skip to content
masterclass Buddy

FastAPI · Class

StreamingResponse

Use StreamingResponse to send strings or bytes in chunks. Yield each chunk from an async or synchronous generator, and FastAPI sends it without JSON conversion.

Last updated

Since
FastAPI 0.134.0

Syntax

StreamingResponse(content, 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
  • Stream JSON Lines
  • Server-Sent Events (SSE)
  • Response
  • EventSourceResponse
  • ServerSentEvent

Source: Stream Data - FastAPI. Checked 2026-11-03.