Error monitoring for FastAPI.
With sentry-sdk, your FastAPI app reports exceptions and 5xx responses with stack trace and local variables to Fehlo. Setup is one call before FastAPI().
As of 24 October 2026, sentry-sdk 2.73.0, FastAPI 0.79 or later. We tested the Python SDK with Fehlo on 19 October 2026.
1. Install the package
pip install sentry-sdkThe FastAPI and Starlette integration switches itself on when FastAPI is installed.
2. Start the SDK and test it
Call sentry_sdk.init before you create the app:
import sentry_sdk
from fastapi import FastAPI
sentry_sdk.init(
dsn="https://<key>@app.fehlo.de/<project-id>",
environment="production",
release="my-api@1.0.0",
)
app = FastAPI()
@app.get("/sentry-debug")
async def trigger_error():
division_by_zero = 1 / 0Start the app with uvicorn main:app and open /sentry-debug. The ZeroDivisionError appears in Fehlo with stack trace, local variables and the route.
3. Which responses are reported
The SDK always reports exceptions without a status code, plus responses with status 500 to 599. To see 403 as well, set failed_request_status_codes on both integrations:
from sentry_sdk.integrations.fastapi import FastApiIntegration
from sentry_sdk.integrations.starlette import StarletteIntegration
sentry_sdk.init(
dsn="...",
integrations=[
StarletteIntegration(failed_request_status_codes={403, *range(500, 600)}),
FastApiIntegration(failed_request_status_codes={403, *range(500, 600)}),
],
)Requests with OPTIONS and HEAD are left out.
Privacy
Without further options the Python SDK sends no IP addresses, cookies or user data. Don't set data_collection: once it is set, its more permissive defaults apply, and the SDK sends IP addresses, cookies and bodies. Local variables are included; Fehlo filters passwords, tokens and email addresses on the server.
Measure performance
traces_sample_rate=0.2,Each measured request is a transaction and counts against your plan's transaction allowance, not against your events.
Questions
Nothing arrives. What should I check?
First the DSN: it has to point at app.fehlo.de. Second, whether your server or browser can reach https://app.fehlo.de (firewall, proxy, ad blocker). Third, whether this month's quota is used up; you get an email when it is. Fourth, whether sampleRate or beforeSend drops events. If only performance data is missing, this month's transactions may be used up.