You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rohit Verma 49ea118240 docs: update docs/de/docs/advanced/additional-responses.md via AI documentation agent 5 months ago
.github 👷 Do not run codspeed with coverage as it's not tracked (#14966) 5 months ago
docs docs: update docs/de/docs/advanced/additional-responses.md via AI documentation agent 5 months ago
docs_src Serialize JSON response with Pydantic (in Rust), when there's a Pydantic return type or response model (#14962) 5 months ago
fastapi 🔖 Release version 0.131.0 5 months ago
fastapi-slim ♻️ Update build setup for `fastapi-slim`, deprecate it, and make it only depend on `fastapi` (#14894) 5 months ago
scripts 🐛 Fix JSON Schema for files, use `contentMediaType` instead of `format: binary` (#14953) 5 months ago
tests 🗑️ Deprecate `ORJSONResponse` and `UJSONResponse` (#14964) 5 months ago
.gitignore ⬆️ Migrate to uv (#14676) 6 months ago
.pre-commit-config.yaml 👷 Run mypy by pre-commit (#14806) 5 months ago
.python-version ⬆️ Migrate to uv (#14676) 6 months ago
CITATION.cff 🚚 Rename GitHub links from tiangolo/fastapi to fastapi/fastapi (#11913) 2 years ago
CONTRIBUTING.md 📝 Create CONTRIBUTING.md (#255) 7 years ago
LICENSE 📄 Add license file, update version 8 years ago
README.md docs: update README.md via AI documentation agent 5 months ago
SECURITY.md 📝 Fix Twitter to be X (Twitter) everywhere in documentation (#13809) 11 months ago
pyproject.toml 👷 Do not include benchmark tests in coverage to speed up coverage processing (#14965) 5 months ago
uv.lock 🗑️ Deprecate `ORJSONResponse` and `UJSONResponse` (#14964) 5 months ago

README.md

FastAPI

FastAPI framework, high performance, easy to learn, fast to code, ready for production

Test Coverage Package version Supported Python versions


Documentation: https://fastapi.tiangolo.com

Source Code: https://github.com/fastapi/fastapi


Overview

FastAPI is a modern, fast (high‑performance) web framework for building APIs with Python 3.8+ based on standard Python type hints. It combines the speed of Node.js and Go with the developer friendliness of Python, delivering:

  • Performance – on par with the fastest Python frameworks because it is built on Starlette for the web parts and Pydantic for the data parts.
  • Fast to code – increase development speed by 200 %–300 % thanks to automatic request validation, serialization, interactive API docs, and editor autocompletion.
  • Reduced bugs – data validation and type checking catch many errors at runtime, lowering the chance of human‑introduced bugs.
  • Intuitive – editors provide instant completion and type checking for request bodies, query parameters, headers, and more.
  • Production ready – OpenAPI, JSON‑Schema, automatic interactive documentation (Swagger UI & ReDoc), dependency injection, security utilities, and extensive testing support.

Installation

FastAPI is released on PyPI and can be installed with pip. It has no external runtime dependencies besides uvicorn (or another ASGI server) for development and production.

pip install "fastapi[all]"   # includes optional dependencies such as python‑multipart, email‑validator, jinja2
# Or, if you only need the core framework:
pip install fastapi

Note: FastAPI requires Python 3.8 or newer.

Quick start

Below is a minimal example that demonstrates the core concepts:

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()

class Item(BaseModel):
    name: str
    description: str | None = None
    price: float
    tax: float | None = None

@app.get("/items/{item_id}")
async def read_item(item_id: int, q: str | None = None):
    return {"item_id": item_id, "q": q}

@app.post("/items/")
async def create_item(item: Item):
    return {"item_id": 1, **item.dict()}

Run the application with uvicorn:

uvicorn myapp:app --reload   # where `myapp.py` contains the code above

Open your browser at http://127.0.0.1:8000/docs to see the automatically generated Swagger UI, or at http://127.0.0.1:8000/redoc for ReDoc.

For a more detailed tutorial, see the official documentation: https://fastapi.tiangolo.com/tutorial/.

Documentation

The full documentation lives at https://fastapi.tiangolo.com. It covers:

  • Tutorial – step‑by‑step guide for beginners.
  • Advanced user guide – dependency injection, background tasks, websockets, security, testing, etc.
  • Reference – exhaustive API reference for fastapi, starlette, and pydantic integration.
  • API OpenAPI schema – automatically generated and customizable.

Contributing

Contributions are welcome! Please read our CONTRIBUTING guide before submitting a pull request. All contributors are expected to follow the code of conduct and ensure that new code is covered by tests and adheres to the project's style guidelines.

License

FastAPI is licensed under the MIT License. See the LICENSE file for the full text.


FastAPI – The modern, fast (high‑performance) web framework for building APIs with Python.