# Checking What Comes In

Checking What Comes In: Checking Input by Hand, Request Models with Pydantic, Field Rules: Lengths, Ranges and Choices.

Updated: November 19, 2026

1. [Checking Input by Hand](https://www.ask-codey.com/lessons/fastapi-validation-by-hand) (Apprentice): An API can't trust what a request sends, so before it saves anything it checks each field for being there, having the right type, staying in its range and being an allowed value, and it collects every problem to send back at once.
2. [Request Models with Pydantic](https://www.ask-codey.com/lessons/fastapi-pydantic-request-models) (Apprentice): A Pydantic model replaces checks written by hand with a class that names each field of a request body and its type, with defaults for fields that may be left out, None for optional ones, and models inside models, and FastAPI checks every request against it before the route runs.
3. [Field Rules: Lengths, Ranges and Choices](https://www.ask-codey.com/lessons/fastapi-pydantic-field-rules) (Journeyman): Field() puts rules on a model's fields, such as a name of 1 to 80 characters and an age of 18 or over, Literal allows only a fixed set of values, EmailStr checks the shape of an email address, and Query puts the same kind of rules on a query parameter.

Source: https://www.ask-codey.com/courses/python-web-apis/topics/fastapi-checking-input
