FastAPI 0.140.13 Fixes SSE and JSONL Status Code Bug, Enhances Docs

FastAPI · 28 Jul 2026 · 2 min read

#fastapi

FastAPI version 0.140.13 has been released, addressing a critical bug in Server-Sent Events (SSE) and JSONL streaming endpoints where the status_code parameter was being ignored. This fix, contributed by @SAURABHSALVE in PR #15937, ensures that custom status codes set during streaming responses are now properly respected, bringing streaming endpoints in line with regular endpoint behavior.

  • 🐛 Bug Fix: status_code is no longer ignored for SSE and JSONL streaming responses (PR #15937). Previously, any custom status code passed to a streaming endpoint was silently dropped, which could lead to incorrect HTTP response codes in production.
  • 📝 Docs Fix: Corrected the docstring rendering of the \n\n terminator in format_sse_event (PR #15613 by @AshNicolus). This improves the developer experience when using the SSE helper functions, as the documentation now accurately reflects the expected formatting.
  • 📝 New API Reference: Added a dedicated API reference page for fastapi.sse (PR #15930). Developers can now easily find all SSE-related functions, classes, and parameters in one centralized location, streamlining the learning curve for real-time APIs.

For developers building real-time applications with FastAPI—such as live feeds, event streams, or log streaming—this release is crucial. The bug fix removes a subtle source of HTTP response errors, and the documentation improvements make it easier to implement SSE correctly. The new API reference page also reduces the need to jump between source code and docs. Upgrade with pip install fastapi --upgrade to benefit from these changes.

Source: https://github.com/fastapi/fastapi/releases/tag/0.140.13

Related

auto-curated · source linked above ← all news