Skip to content
FastAPI
Python Types Intro
en - English
de - Deutsch
es - español
fr - français
hi - हिन्दी
ja - 日本語
ko - 한국어
pt - português
ru - русский язык
tr - Türkçe
uk - українська мова
zh - 简体中文
zh-hant - 繁體中文
Search
fastapi/fastapi
FastAPI
Features
Learn
Reference
Resources
About
Release Notes
FastAPI
fastapi/fastapi
FastAPI
Features
Learn
Python Types Intro
Python Types Intro
On this page
Motivation
Edit it
Add types
More motivation
Declaring types
Simple types
typing
module
Generic types
List
Tuple and Set
Dict
Union
Possibly
None
Classes as types
Pydantic models
Type Hints with Metadata Annotations
Type hints in
FastAPI
Concurrency and async / await
Tutorial - User Guide
First Steps
Path Parameters
Query Parameters
Request Body
Query Parameters and String Validations
Path Parameters and Numeric Validations
Query Parameter Models
Body - Multiple Parameters
Body - Fields
Body - Nested Models
Declare Request Example Data
Extra Data Types
Cookie Parameters
Header Parameters
Cookie Parameter Models
Header Parameter Models
Response Model - Return Type
Extra Models
Response Status Code
Form Data
Form Models
Request Files
Request Forms and Files
Handling Errors
Path Operation Configuration
JSON Compatible Encoder
Body - Updates
Dependencies
Classes as Dependencies
Sub-dependencies
Dependencies in path operation decorators
Global Dependencies
Dependencies with yield
Security
Security - First Steps
Get Current User
Simple OAuth2 with Password and Bearer
OAuth2 with Password (and hashing), Bearer with JWT tokens
Middleware
CORS (Cross-Origin Resource Sharing)
SQL (Relational) Databases
Bigger Applications - Multiple Files
Stream JSON Lines
Server-Sent Events (SSE)
Background Tasks
Metadata and Docs URLs
Frontend
Static Files
Testing
Debugging
Advanced User Guide
Stream Data
Path Operation Advanced Configuration
Additional Status Codes
Return a Response Directly
Custom Response - HTML, Stream, File, others
Additional Responses in OpenAPI
Response Cookies
Response Headers
Response - Change Status Code
Advanced Dependencies