Careeroza
Interactive Docs
Swagger UI and ReDoc
FastAPI generates an OpenAPI schema from your code and serves two documentation UIs for free:
| URL | What you get |
|---|---|
/docs | Swagger UI: try every endpoint from the browser |
/redoc | ReDoc: clean reference documentation |
/openapi.json | the raw schema (used by client generators and API gateways) |
The Schema Is Generated From Your Code
Example
Title, version, tags and summaries appear in the docs:
from fastapi import FastAPI
app = FastAPI(title="Course API", version="1.0.0")
@app.get("/courses", tags=["courses"], summary="List all courses")
def list_courses():
return ["HTML", "CSS", "SQL"]Requests and responses
GET /courses
→ 200 ["HTML", "CSS", "SQL"]
GET /openapi.json
→ 200 {"openapi": "3.1.0", "info": {"title": "Course API", "version": "1.0.0"}, "paths": {"/courses": {"get": {"tags": ["courses"], "summary": "List all courses", "operationId": "list_courses_courses_get", "responses": {"200": {"description": "Successful Response", "content": {"application/json": {"schema": {}}}}}}}}}Tip: Keep docstrings and summaries meaningful: they become your public API documentation.