> ## Documentation Index
> Fetch the complete documentation index at: https://docs.castled.io/llms.txt
> Use this file to discover all available pages before exploring further.

# User Schema

Data teams needs to define the User schema to be used in Customer Segmentation.

Go to Schema > Users/Contacts in the menu and follow the following steps to
create an User Schema in Castled.

### 1. Click on Create User schema.

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-1.png)

### 2. Select the warehouse config and enter the query to define the user entity being created.

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-2.png)

### 3. Run the query and preview the result.

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-3.png)

### 4. After previewing the query result click Next.

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-4.png)

### 5. Capture the schema name.

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-5.png)

### 6. Map the mandatory and optional fields to be used for the delivery and personalization of cross-channel campaigns.

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-6.png)

### 7. Capture the event and custom objects related to the user using the Relationship section.

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-7.png)

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-8.png)

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-9.png)

### 8. Save and finish to create an User schema

![](https://mintlify.s3-us-west-1.amazonaws.com/castled/images/user-schema-10.png)

> [!NOTE]
>
> 1. User Schema can be associated with many Events / Custom Objects
> 2. ID and Email needs to be mandatorily mapped


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.