Fastapi
> Official documentation: https://fastapi.tiangolo.com
Overview
This skill provides comprehensive documentation for fastapi.
Total references: 45 files (~390,244 tokens)
Topics covered:
fastapiresponsesJSONResponse, Combining information, 01241, Handling custom request body encodings, Hash and verify the passwords, fastapisecurityHTTPAuthorizationCredentials, Containers and Docker, fastapiopenapidocsget_swagger_ui_oauth2_redirect_html, Installwebsockets, OpenAPI operationId, Developing, Use thescopes...
Reference Files
Load only the reference files relevant to the user's question:
Advanced
- [Additional Responses in OpenAPI¶ and more](references/advanced-1.md) (~6,383 tokens)
- Topics: Additional Response withmodel, Additional media types for the main response, Combining information
- [Behind a Proxy¶ and more](references/advanced-2.md) (~6,728 tokens)
- Topics: Proxy Forwarded Headers, Proxy with a stripped path prefix, About proxies with a stripped path prefix
- [Lifespan Events¶ and more](references/advanced-3.md) (~7,972 tokens)
- Topics: Use Case, Lifespan, Alternative Events deprecated
- [OpenAPI Webhooks¶ and more](references/advanced-4.md) (~6,151 tokens)
- Topics: Webhooks steps, Documenting webhooks withFastAPIand OpenAPI, An app with webhooks
- [OAuth2 scopes¶](references/advanced-5.md) (~20,463 tokens)
- Topics: OAuth2 scopes and OpenAPI, Global view, OAuth2 Security scheme
- [Advanced Security¶ and more](references/advanced-6.md) (~6,375 tokens)
- Topics: Additional Features, Read the Tutorial first, Types and validation
- [WebSockets¶ and more](references/advanced-7.md) (~2,949 tokens)
- Topics: Installwebsockets, WebSockets client, Create awebsocket
Deployment
- [Deploy FastAPI on Cloud Providers¶ and more](references/deployment-1.md) (~4,134 tokens)
- Topics: FastAPI Cloud, Cloud Providers - Sponsors, Security - HTTPS
- [FastAPI in Containers and more](references/deployment-2.md) (~7,894 tokens)
- Topics: What is a Container, What is a Container Image, Container Images
- [Run a Server Manually¶ and more](references/deployment-3.md) (~2,267 tokens)
- Topics: Use thefastapi runCommand, ASGI Servers, Server Machine and Server Program
General
- [About¶ and more](references/general-1.md) (~4,427 tokens)
- Topics: Additional Features, Read the Tutorial first, Intro
- [Concurrency and async / await¶ and more](references/general-2.md) (~7,532 tokens)
- Topics: In a hurry, Technical Details, Asynchronous Code
- [Environment Variables¶ and more](references/general-3.md) (~5,878 tokens)
- Topics: Create and Use Env Vars, Read env vars in Python, Types and Validation
- [Help FastAPI and more](references/general-4.md) (~6,193 tokens)
- Topics: Subscribe to the newsletter, Follow FastAPI on X Twitter, StarFastAPIin GitHub
- [Repository Management Tasks¶ and more](references/general-5.md) (~6,446 tokens)
- Topics: Be Nice, Edit PR Titles, Add Labels to PRs
- [Release Notes¶](references/general-6.md) (~62,193 tokens)
- Topics: Latest Changes, 01280, 01271
- [Resources¶ and more](references/general-7.md) (~4,011 tokens)
- Topics: Run the code, Install FastAPI, Advanced User Guide
How To
- [Use Old 403 Authentication Error Status Codes¶ and more](references/how-to-1.md) (~7,629 tokens)
- Topics: About security APIs and docs, Conditional OpenAPI from settings and env vars, Disable Syntax Highlighting
- [Extending OpenAPI¶ and more](references/how-to-2.md) (~4,730 tokens)
- Topics: The normal process, Overriding the defaults, Filter Data - Security
Reference
- [APIRouterclass¶](references/reference-1.md) (~23,363 tokens)
- Topics: fastapiAPIRouter
- [Background Tasks and more](references/reference-2.md) (~3,490 tokens)
- Topics: fastapiBackgroundTasks, Depends, fastapiDepends
- [FastAPIclass¶](references/reference-3.md) (~27,736 tokens)
- Topics: fastapiFastAPI
- [HTTPConnectionclass¶ and more](references/reference-4.md) (~5,279 tokens)
- Topics: fastapirequestsHTTPConnection, fastapimiddlewarecorsCORSMiddleware, fastapimiddlewaregzipGZipMiddleware
- [Request Parameters¶](references/reference-5.md) (~9,443 tokens)
- Topics: fastapiQuery, fastapiPath, fastapiBody
- [Requestclass¶ and more](references/reference-6.md) (~3,294 tokens)
- Topics: fastapiRequest, fastapiResponse, FastAPI Responses
- [Security Tools¶](references/reference-7.md) (~8,629 tokens)
- Topics: API Key Security Schemes, fastapisecurityAPIKeyCookie, fastapisecurityAPIKeyHeader
- [Static Files and more](references/reference-8.md) (~5,060 tokens)
- Topics: fastapistaticfilesStaticFiles, Example, fastapistatus
Tutorial
- [Background Tasks¶ and more](references/tutorial-1.md) (~7,361 tokens)
- Topics: UsingBackgroundTasks, Create a task function, Add the background task
- [Body and more](references/tutorial-2.md) (~7,176 tokens)
- Topics: MixPathQueryand body parameters, Multiple body parameters, Singular values in body
- [Request Body¶ and more](references/tutorial-3.md) (~5,170 tokens)
- Topics: Import PydanticsBaseModel, Create your data model, Declare it as a parameter
- [Classes as Dependencies¶ and more](references/tutorial-4.md) (~5,045 tokens)
- Topics: Adictfrom the previous example, What makes a dependency, Classes as dependencies
- [Dependencies with yield¶ and more](references/tutorial-5.md) (~7,724 tokens)
- Topics: A database dependency withyield, A dependency withyieldandtry, Sub-dependencies withyield
- [JSON Compatible Encoder¶ and more](references/tutorial-6.md) (~7,718 tokens)
- Topics: Using thejsonable_encoder, Other data types, Example
- [Header Parameter Models¶ and more](references/tutorial-7.md) (~6,662 tokens)
- Topics: Header Parameters with a Pydantic Model, Check the Docs, Forbid Extra Headers
- [Path Parameters and Numeric Validations¶ and more](references/tutorial-8.md) (~5,500 tokens)
- Topics: ImportPath, Declare metadata, Order the parameters as you need
- [Query Parameters and String Validations¶](references/tutorial-9.md) (~7,157 tokens)
- Topics: Additional validation, UseAnnotatedin the type for theqparameter, AddQuerytoAnnotatedin theqparameter
- [Query Parameters¶ and more](references/tutorial-10.md) (~5,608 tokens)
- Topics: Defaults, Optional parameters, Query parameter type conversion
- [Response Model and more](references/tutorial-11.md) (~6,041 tokens)
- Topics: response_modelParameter, Return the same input data, Add an output model
- [Declare Request Example Data¶ and more](references/tutorial-12.md) (~5,513 tokens)
- Topics: Extra JSON Schema data in Pydantic models, Fieldadditional arguments, examplesin JSON Schema - OpenAPI
- [Get Current User¶](references/tutorial-13.md) (~3,047 tokens)
- Topics: Create a user model, Create aget_current_userdependency, Get the user
- [OAuth2 with Password (and hashing), Bearer with JWT tokens¶](references/tutorial-14.md) (~9,111 tokens)
- Topics: About JWT, InstallPyJWT, Password hashing
- [Simple OAuth2 with Password and Bearer¶](references/tutorial-15.md) (~7,465 tokens)
- Topics: Get theusernameandpassword, Code to get theusernameandpassword, Return the token
- [Security¶](references/tutorial-16.md) (~887 tokens)
- Topics: In a hurry, OAuth2, OpenID Connect
- [SQL (Relational) Databases¶](references/tutorial-17.md) (~23,437 tokens)
- Topics: InstallSQLModel, Create the App with a Single Model, Update the App with Multiple Models
- [Static Files¶ and more](references/tutorial-18.md) (~2,973 tokens)
- Topics: UseStaticFiles, Details, More info
Usage Guidelines
- Identify relevant sections - Match the user's question to the appropriate reference file(s)
- Load minimally - Only read files directly relevant to the question to conserve context
- Cite sources - Reference specific sections when answering
- Combine knowledge - For complex questions, you may need multiple reference files
When to use each reference:
- Advanced: Advanced-related features and documentation
- Deployment: Deployment, hosting, and infrastructure
- General: General documentation, overview, and getting started
- How To: How To-related features and documentation
- Reference: Reference-related features and documentation
- Tutorial: Tutorial-related features and documentation