* [ pydantic_core  ](../../api/pydantic_core/)
      * [ pydantic_core.core_schema  ](../../api/pydantic_core_schema/)
    * [ Pydantic Settings  ](../../api/pydantic_settings/)
    * Pydantic Extra Types  Pydantic Extra Types 
      * [ Color  ](../../api/pydantic_extra_types_color/)
      * [ Country  ](../../api/pydantic_extra_types_country/)
      * [ Payment  ](../../api/pydantic_extra_types_payment/)
      * [ Phone Numbers  ](../../api/pydantic_extra_types_phone_numbers/)
      * [ Routing Numbers  ](../../api/pydantic_extra_types_routing_numbers/)
      * [ Coordinate  ](../../api/pydantic_extra_types_coordinate/)
      * [ Mac Address  ](../../api/pydantic_extra_types_mac_address/)
      * [ ISBN  ](../../api/pydantic_extra_types_isbn/)
      * [ Pendulum  ](../../api/pydantic_extra_types_pendulum_dt/)
      * [ Currency  ](../../api/pydantic_extra_types_currency_code/)
      * [ Language  ](../../api/pydantic_extra_types_language_code/)
  * Examples  Examples 
    * [ Secrets  ](../../examples/secrets/)
  * Error Messages  Error Messages 
    * [ Error Handling  ](../../errors/errors/)
    * [ Validation Errors  ](../../errors/validation_errors/)
    * [ Usage Errors  ](../../errors/usage_errors/)
  * Integrations  Integrations 
    * [ Mypy  ](../../integrations/mypy/)
    * [ PyCharm  ](../../integrations/pycharm/)
    * [ Hypothesis  ](../../integrations/hypothesis/)
    * [ Visual Studio Code  ](../../integrations/visual_studio_code/)
    * [ datamodel-code-generator  ](../../integrations/datamodel_code_generator/)
    * [ devtools  ](../../integrations/devtools/)
    * [ Rich  ](../../integrations/rich/)
    * [ Linting  ](../../integrations/linting/)
  * [ Blog  ](https://blog.pydantic.dev/)
  * [ Pydantic People  ](../../pydantic_people/)

Page contents

  * TL;DR 
  * The long version 
  * validation 
  * Basic model usage 
    * Model methods and properties 
  * Nested models 
  * Rebuild model schema 
  * Arbitrary class instances 
    * Reserved names 
    * Nested attributes 
  * Error handling 
  * Helper functions 
    * Creating models without validation 
  * Generic models 
  * Dynamic model creation 
  * RootModel and custom root types 
  * Faux immutability 
  * Abstract base classes 
  * Field ordering 
  * Required fields 
  * Fields with non-hashable default values 
  * Fields with dynamic default values 
  * Automatically excluded attributes 
    * Class vars 
    * Private model attributes 
  * Data conversion 
  * Model signature 
  * Structural pattern matching 
  * Attribute copies 
  * Extra fields 

#  Models

API Documentation

[ ` pydantic.main.BaseModel ` ](../../api/base_model/#pydantic.BaseModel)  

One of the primary ways of defining schema in Pydantic is via models. Models
are simply classes which inherit from [ ` pydantic.BaseModel `
](../../api/base_model/#pydantic.BaseModel) and define fields as annotated
attributes.

You can think of models as similar to structs in languages like C, or as the
requirements of a single endpoint in an API.

Models share many similarities with Python's dataclasses, but have been
designed with some subtle-yet-important differences that streamline certain
workflows related to validation, serialization, and JSON schema generation.
You can find more discussion of this in the [ Dataclasses ](../dataclasses/)
section of the docs.

Untrusted data can be passed to a model and, after parsing and validation,
Pydantic guarantees that the fields of the resultant model instance will
conform to the field types defined on the model.

Validation — a _deliberate_ misnomer

###  TL;DR  ¶

We use the term "validation" to refer to the process of instantiating a model
(or other type) that adheres to specified types and constraints. This task,
which Pydantic is well known for, is most widely recognized as "validation" in
colloquial terms, even though in other contexts the term "validation" may be
more restrictive.

* * *

###  The long version  ¶

The potential co