Interactive API Docs and OpenAPI
One of the most powerful features of FastAPI is its automatic documentation generation.
If you have your development server running (uv run fastapi dev), open your browser and navigate to:
You'll see a fully interactive API documentation page provided by Swagger UI.
Try clicking on the GET /projects/{project_id} endpoint. Click the "Try it out" button, type 1 into the project_id field, and click "Execute". You just made a live API call right from your documentation!
You can also visit http://127.0.0.1:8000/redoc to see an alternative, beautifully formatted documentation layout provided by ReDoc.
What is OpenAPI?
How does FastAPI automatically generate these beautiful interfaces? It relies on a standard called OpenAPI.
The OpenAPI Specification (formerly known as Swagger) is a standard format for describing RESTful APIs. It's a language-agnostic standard, meaning tools written in any programming language can read an OpenAPI file and understand exactly how to interact with your API.
FastAPI is continuously reading the type hints and Pydantic models you write in Python, and translating them on the fly into an OpenAPI JSON schema.
You can view the raw JSON schema that FastAPI generates by navigating to:
http://127.0.0.1:8000/openapi.json
Because FastAPI perfectly implements the OpenAPI standard, you get immediate access to a massive ecosystem of tooling. You can take your openapi.json file and automatically generate frontend API clients in TypeScript, backend SDKs in Go, or load testing scripts, all without writing any manual configuration!