Skip to content

Using Inspectr with FastAPI

FastAPI is a high-performance Python web framework, ideal for building modern APIs. Inspectr lets you debug traffic, inspect payloads, and securely expose your FastAPI endpoints with minimal configuration.

This guide walks you through using Inspectr with a FastAPI project.


  • Python 3.8+
  • FastAPI and Uvicorn installed:
Terminal window
pip install fastapi uvicorn

Here’s a simple FastAPI app (main.py):

from fastapi import FastAPI
app = FastAPI()
@app.get("/hello")
def read_root():
return {"message": "Hello from FastAPI!"}

Start the server:

Terminal window
uvicorn main:app --port 5001

Terminal window
inspectr --listen=:8080 --backend=http://localhost:5001

Make a request via Inspectr:

Terminal window
curl http://localhost:8080/hello
  • The request is forwarded to FastAPI
  • The response is captured in Inspectr
  • You can view it in the App UI: http://localhost:4004

Terminal window
inspectr \
--listen=:8080 \
--backend=http://localhost:5001 \
--expose \
--channel=fastapi-demo \
--channel-code=fastapi123

Your public endpoint:

https://fastapi-demo.in-spectr.dev

Inspectr + FastAPI gives you:

  • Simple request logging and inspection
  • Public webhook endpoint for testing
  • Real-time debugging and replay