> ## 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.

# Event Schema

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

Go to Schema > Events in the menu and follow the following steps to create an
Event Schema in Castled.

### 1. Click on Create Event schema

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

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

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

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

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

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

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

### 5. Capture the schema name and map the Event timestamp field.

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

### 6. Capture the User object associated with the event using the Relationship section.

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

### 7. Save and finish to create an Event schema.

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

> [!NOTE]
>
> An Event Schema can be associated with only one User Schema


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