# FastAPI ## Docs - [Introduction to FastAPI](https://mintlify.wiki/fastapi/fastapi/introduction.md): Learn about FastAPI, a modern, high-performance Python web framework for building APIs with automatic documentation and type safety - [Installation](https://mintlify.wiki/fastapi/fastapi/installation.md): Install FastAPI and its dependencies to start building high-performance APIs - [Quick start](https://mintlify.wiki/fastapi/fastapi/quickstart.md): Build your first FastAPI application in minutes with this step-by-step guide - [First steps](https://mintlify.wiki/fastapi/fastapi/tutorial/first-steps.md): Learn the fundamental concepts of FastAPI by building your first application from scratch - [Path Parameters](https://mintlify.wiki/fastapi/fastapi/tutorial/path-parameters.md): Learn how to declare path parameters in FastAPI with type validation, enums, and the Path() function - [Query Parameters](https://mintlify.wiki/fastapi/fastapi/tutorial/query-parameters.md): Learn how to work with query parameters in FastAPI including optional parameters, defaults, and validation with Query() - [Request Body](https://mintlify.wiki/fastapi/fastapi/tutorial/request-body.md): Learn how to handle JSON request bodies in FastAPI using Pydantic models for validation and serialization - [Request Forms](https://mintlify.wiki/fastapi/fastapi/tutorial/request-forms.md): Learn how to handle HTML form data in FastAPI using the Form() function - [Request Files](https://mintlify.wiki/fastapi/fastapi/tutorial/request-files.md): Learn how to handle file uploads in FastAPI using File() and UploadFile - [Response Model](https://mintlify.wiki/fastapi/fastapi/tutorial/response-model.md): Learn how to use response_model to define and validate API responses in FastAPI - [Extra Models](https://mintlify.wiki/fastapi/fastapi/tutorial/extra-models.md): Learn how to work with multiple Pydantic models including inheritance, unions, and model composition in FastAPI - [Response Status Code](https://mintlify.wiki/fastapi/fastapi/tutorial/response-status-code.md): Learn how to set HTTP status codes in FastAPI using the status_code parameter and status module - [Extra Data Types](https://mintlify.wiki/fastapi/fastapi/tutorial/extra-data-types.md): Learn how to use specialized data types in FastAPI including UUID, datetime, timedelta, and more - [Cookie Parameters](https://mintlify.wiki/fastapi/fastapi/tutorial/cookie-params.md): Learn how to read and validate HTTP cookies in FastAPI using the Cookie() function - [Header Parameters](https://mintlify.wiki/fastapi/fastapi/tutorial/header-params.md): Learn how to read and validate HTTP headers in FastAPI using the Header() function - [Introduction to Dependencies](https://mintlify.wiki/fastapi/fastapi/tutorial/dependencies/dependencies-intro.md): Learn how to use FastAPI dependency injection system to share logic, reduce code duplication, and manage resources efficiently - [Classes as Dependencies](https://mintlify.wiki/fastapi/fastapi/tutorial/dependencies/classes-as-dependencies.md): Learn how to use Python classes as dependencies in FastAPI for stateful logic and reusable components - [Sub-Dependencies](https://mintlify.wiki/fastapi/fastapi/tutorial/dependencies/sub-dependencies.md): Learn how to create complex dependency graphs by composing dependencies that depend on other dependencies in FastAPI - [Dependencies in Path Operations](https://mintlify.wiki/fastapi/fastapi/tutorial/dependencies/dependencies-in-path.md): Learn how to use dependencies at the path operation decorator level for validation, side effects, and shared logic without using the return value - [Global Dependencies](https://mintlify.wiki/fastapi/fastapi/tutorial/dependencies/global-dependencies.md): Learn how to apply dependencies across your entire FastAPI application or router groups for consistent authentication, logging, and validation - [Security Introduction](https://mintlify.wiki/fastapi/fastapi/tutorial/security/security-intro.md): Learn about FastAPI's security utilities for OAuth2, API keys, and HTTP authentication - [First Steps with OAuth2](https://mintlify.wiki/fastapi/fastapi/tutorial/security/first-steps.md): Create your first OAuth2 authentication endpoint with password flow and bearer tokens - [Get Current User](https://mintlify.wiki/fastapi/fastapi/tutorial/security/get-current-user.md): Create a dependency for getting the current authenticated user from the token - [OAuth2 with JWT Tokens](https://mintlify.wiki/fastapi/fastapi/tutorial/security/oauth2-jwt.md): Implement secure authentication with JWT tokens and password hashing - [OAuth2 with Scopes](https://mintlify.wiki/fastapi/fastapi/tutorial/security/oauth2-scopes.md): Implement fine-grained permissions using OAuth2 scopes for role-based access control - [Bigger Applications - Multiple Files](https://mintlify.wiki/fastapi/fastapi/tutorial/bigger-applications.md): Structure your FastAPI application across multiple files using APIRouter for modular, scalable applications - [Background Tasks](https://mintlify.wiki/fastapi/fastapi/tutorial/background-tasks.md): Execute tasks after returning a response using FastAPI's BackgroundTasks - [Metadata and Docs URLs](https://mintlify.wiki/fastapi/fastapi/tutorial/metadata.md): Customize your API's OpenAPI metadata, documentation, and configure docs URLs - [Static Files](https://mintlify.wiki/fastapi/fastapi/tutorial/static-files.md): Serve static files like images, CSS, and JavaScript with FastAPI using StaticFiles - [Testing](https://mintlify.wiki/fastapi/fastapi/tutorial/testing.md): Test your FastAPI application using TestClient and pytest - [SQL Databases](https://mintlify.wiki/fastapi/fastapi/tutorial/sql-databases.md): Integrate SQL databases with FastAPI using SQLModel and dependency injection - [Async SQL Databases](https://mintlify.wiki/fastapi/fastapi/tutorial/async-sql-databases.md): Use async SQLAlchemy with FastAPI for high-performance database operations - [FastAPI Deployment Overview](https://mintlify.wiki/fastapi/fastapi/deployment/index.md): Learn about deploying FastAPI applications, key concepts, and deployment strategies for production environments. - [FastAPI in Containers - Docker](https://mintlify.wiki/fastapi/fastapi/deployment/docker.md): Build and deploy FastAPI applications using Docker containers with best practices and multi-stage builds. - [Server Workers - Uvicorn with Gunicorn](https://mintlify.wiki/fastapi/fastapi/deployment/server-workers.md): Configure multiple worker processes for FastAPI using Uvicorn and Gunicorn for production deployments. - [HTTPS and SSL/TLS Configuration](https://mintlify.wiki/fastapi/fastapi/deployment/https.md): Configure HTTPS, SSL/TLS certificates, and reverse proxies for secure FastAPI deployments. - [Deploy FastAPI on Cloud Platforms](https://mintlify.wiki/fastapi/fastapi/deployment/cloud.md): Deploy FastAPI applications to popular cloud platforms including AWS, Google Cloud, Azure, and PaaS providers. - [Path Operation Advanced Configuration](https://mintlify.wiki/fastapi/fastapi/advanced/path-operation-advanced.md): Learn about advanced path operation decorator parameters including operation_id, callbacks, OpenAPI extras, and more - [Additional Status Codes](https://mintlify.wiki/fastapi/fastapi/advanced/additional-status-codes.md): Learn how to return additional status codes and document multiple possible responses in FastAPI - [Return a Response Directly](https://mintlify.wiki/fastapi/fastapi/advanced/response-directly.md): Learn how to return Response objects directly from FastAPI path operations for full control over the HTTP response - [Custom Response Classes](https://mintlify.wiki/fastapi/fastapi/advanced/custom-response.md): Learn about FastAPI's built-in response classes and how to use HTMLResponse, PlainTextResponse, JSONResponse, and other custom responses - [Response Cookies](https://mintlify.wiki/fastapi/fastapi/advanced/response-cookies.md): Learn how to set, modify, and delete cookies in FastAPI responses - [Response Headers](https://mintlify.wiki/fastapi/fastapi/advanced/response-headers.md): Learn how to set custom headers in FastAPI responses for caching, security, and custom metadata - [Change Response Status Code](https://mintlify.wiki/fastapi/fastapi/advanced/response-change-status-code.md): Learn how to dynamically change HTTP status codes in FastAPI responses based on business logic - [Custom Middleware](https://mintlify.wiki/fastapi/fastapi/advanced/middleware.md): Create custom middleware to process requests and responses in FastAPI - [CORS (Cross-Origin Resource Sharing)](https://mintlify.wiki/fastapi/fastapi/advanced/cors.md): Configure CORS middleware to allow cross-origin requests in FastAPI - [Startup and Shutdown Events](https://mintlify.wiki/fastapi/fastapi/advanced/events.md): Handle application lifecycle events in FastAPI with startup, shutdown, and lifespan context managers - [Running Behind a Proxy](https://mintlify.wiki/fastapi/fastapi/advanced/behind-a-proxy.md): Configure FastAPI to work correctly behind reverse proxies and load balancers - [WebSockets](https://mintlify.wiki/fastapi/fastapi/advanced/websockets.md): Build real-time bidirectional communication with WebSocket endpoints in FastAPI - [Server-Sent Events (SSE)](https://mintlify.wiki/fastapi/fastapi/advanced/server-sent-events.md): Stream real-time updates to clients using Server-Sent Events in FastAPI - [Streaming Responses](https://mintlify.wiki/fastapi/fastapi/advanced/streaming.md): Stream large responses and files efficiently using StreamingResponse in FastAPI - [Advanced Dependency Patterns](https://mintlify.wiki/fastapi/fastapi/advanced/advanced-dependencies.md): Master advanced dependency injection patterns including async dependencies, dependency caching, generator dependencies, and scoped dependencies in FastAPI. - [Dependency Overrides](https://mintlify.wiki/fastapi/fastapi/advanced/dependency-overrides.md): Learn how to override dependencies in FastAPI for testing, using app.dependency_overrides to replace production dependencies with test doubles. - [Sub-Applications](https://mintlify.wiki/fastapi/fastapi/advanced/sub-applications.md): Mount independent FastAPI applications with their own OpenAPI schemas, routes, and middleware for modular API design. - [Using Dataclasses](https://mintlify.wiki/fastapi/fastapi/advanced/dataclasses.md): Learn how to use Python dataclasses with FastAPI for data validation and serialization - [Custom Request and Route Classes](https://mintlify.wiki/fastapi/fastapi/advanced/custom-request-and-route.md): Learn how to create custom Request and APIRoute classes to extend FastAPI's request handling behavior - [Settings and Environment Variables](https://mintlify.wiki/fastapi/fastapi/advanced/settings.md): Learn how to manage application settings and environment variables using Pydantic Settings in FastAPI - [Extending OpenAPI](https://mintlify.wiki/fastapi/fastapi/advanced/extending-openapi.md): Learn how to customize and extend the generated OpenAPI schema in FastAPI by overriding the default openapi() method - [OpenAPI Callbacks](https://mintlify.wiki/fastapi/fastapi/advanced/openapi-callbacks.md): Learn how to document API callbacks in FastAPI, where your API calls external APIs provided by users - [OpenAPI Webhooks](https://mintlify.wiki/fastapi/fastapi/advanced/openapi-webhooks.md): Document webhook events that your FastAPI application sends to user-defined endpoints using OpenAPI 3.1.0 webhooks - [Conditional OpenAPI](https://mintlify.wiki/fastapi/fastapi/advanced/conditional-openapi.md): Control OpenAPI schema generation and documentation availability based on environment variables and application settings - [HTML Templates with Jinja2](https://mintlify.wiki/fastapi/fastapi/advanced/templates.md): Learn how to render HTML templates using Jinja2 with FastAPI for building dynamic web pages - [GraphQL Integration](https://mintlify.wiki/fastapi/fastapi/advanced/graphql.md): Integrate GraphQL with FastAPI using Strawberry, Graphene, or other GraphQL libraries - [FastAPI](https://mintlify.wiki/fastapi/fastapi/api/fastapi.md): Main FastAPI application class for building high-performance APIs - [APIRouter](https://mintlify.wiki/fastapi/fastapi/api/apirouter.md): Router class for organizing FastAPI path operations into modular components - [Request](https://mintlify.wiki/fastapi/fastapi/api/request.md): Request object for accessing HTTP request data in FastAPI - [Response](https://mintlify.wiki/fastapi/fastapi/api/response.md): Response classes for returning different types of HTTP responses in FastAPI - [WebSocket](https://mintlify.wiki/fastapi/fastapi/api/websocket.md): WebSocket class for handling real-time bidirectional communication in FastAPI - [Path](https://mintlify.wiki/fastapi/fastapi/api/path.md): API reference for the FastAPI Path parameter function - [Query](https://mintlify.wiki/fastapi/fastapi/api/query.md): API reference for the FastAPI Query parameter function - [Body](https://mintlify.wiki/fastapi/fastapi/api/body.md): API reference for the FastAPI Body parameter function - [Header](https://mintlify.wiki/fastapi/fastapi/api/header.md): API reference for the FastAPI Header parameter function - [Cookie](https://mintlify.wiki/fastapi/fastapi/api/cookie.md): API reference for the FastAPI Cookie parameter function - [Form](https://mintlify.wiki/fastapi/fastapi/api/form.md): API reference for the FastAPI Form parameter function - [File](https://mintlify.wiki/fastapi/fastapi/api/file.md): API reference for the FastAPI File parameter function and file uploads - [Depends](https://mintlify.wiki/fastapi/fastapi/api/depends.md): Declare dependencies in FastAPI path operations for dependency injection - [Security](https://mintlify.wiki/fastapi/fastapi/api/security.md): Declare security dependencies with OAuth2 scopes in FastAPI - [OAuth2](https://mintlify.wiki/fastapi/fastapi/api/security/oauth2.md): OAuth2 authentication classes for password and authorization code flows - [HTTP Authentication](https://mintlify.wiki/fastapi/fastapi/api/security/http.md): HTTP Basic, Bearer, and Digest authentication classes - [API Key Authentication](https://mintlify.wiki/fastapi/fastapi/api/security/api-key.md): API key authentication using query parameters, headers, or cookies - [OpenID Connect](https://mintlify.wiki/fastapi/fastapi/api/security/openid-connect.md): OpenID Connect authentication for FastAPI - [JSONResponse](https://mintlify.wiki/fastapi/fastapi/api/responses/json-response.md): Response class for returning JSON-encoded data with application/json media type - [HTMLResponse](https://mintlify.wiki/fastapi/fastapi/api/responses/html-response.md): Response class for returning HTML content with text/html media type - [PlainTextResponse](https://mintlify.wiki/fastapi/fastapi/api/responses/plain-text-response.md): Return plain text content with the PlainTextResponse class - [StreamingResponse](https://mintlify.wiki/fastapi/fastapi/api/responses/streaming-response.md): Response class for streaming data using generator functions - [FileResponse](https://mintlify.wiki/fastapi/fastapi/api/responses/file-response.md): Response class optimized for serving static files with proper headers and caching - [RedirectResponse](https://mintlify.wiki/fastapi/fastapi/api/responses/redirect-response.md): Response class for HTTP redirects with support for various redirect status codes - [EventSourceResponse](https://mintlify.wiki/fastapi/fastapi/api/responses/event-source-response.md): Streaming response class for Server-Sent Events (SSE) with text/event-stream media type - [CORSMiddleware](https://mintlify.wiki/fastapi/fastapi/api/middleware/cors.md): Configure Cross-Origin Resource Sharing (CORS) for your FastAPI application - [GZipMiddleware](https://mintlify.wiki/fastapi/fastapi/api/middleware/gzip.md): Enable GZip compression for response data in your FastAPI application - [TrustedHostMiddleware](https://mintlify.wiki/fastapi/fastapi/api/middleware/trusted-host.md): Enforce allowed Host headers to prevent Host header attacks in FastAPI - [HTTPSRedirectMiddleware](https://mintlify.wiki/fastapi/fastapi/api/middleware/httpsredirect.md): Automatically redirect HTTP requests to HTTPS in your FastAPI application - [BackgroundTasks](https://mintlify.wiki/fastapi/fastapi/api/background-tasks.md): A collection of background tasks to be executed after sending a response to the client. - [UploadFile](https://mintlify.wiki/fastapi/fastapi/api/upload-file.md): A file uploaded in a request with async-compatible methods for reading and writing. - [HTTPException](https://mintlify.wiki/fastapi/fastapi/api/http-exception.md): An HTTP exception to raise in your code to return errors to the client. - [TestClient](https://mintlify.wiki/fastapi/fastapi/api/test-client.md): A test client for making requests to FastAPI applications in tests. - [status](https://mintlify.wiki/fastapi/fastapi/api/status.md): HTTP status code constants for use in FastAPI applications. - [jsonable_encoder](https://mintlify.wiki/fastapi/fastapi/api/encoders.md): Convert any object to a JSON-compatible format for serialization.