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

# Zite Database Field Types

> Complete reference for all available field types and their configurations.

Reference for all supported field types, their value formats, and configuration settings.

***

## Text Fields

### Text

Short text input for names, titles, and brief descriptions.

**Value**

```typescript theme={null}
string // e.g., "John Doe", "Product Name"
```

**Type**

```json theme={null}
"single_line_text"
```

***

### Long Text

Multi-line text for comments, descriptions, and notes.

**Value**

```typescript theme={null}
string // Multi-line text, e.g., "This is a long description\nwith multiple lines"
```

**Type**

```json theme={null}
"long_text"
```

***

### Email

Email addresses with automatic format validation.

**Value**

```typescript theme={null}
string // Valid email address, e.g., "user@example.com"
```

**Type**

```json theme={null}
"email"
```

***

### URL

Website links with automatic URL validation.

**Value**

```typescript theme={null}
string // Valid URL, e.g., "https://example.com"
```

**Type**

```json theme={null}
"url"
```

***

### Phone Number

Phone numbers with flexible formatting.

**Value**

```typescript theme={null}
string // Phone number with any formatting, e.g., "+1 (555) 123-4567"
```

**Type**

```json theme={null}
"phone_number"
```

***

## Number Fields

### Number

Numeric values with customizable decimal places and formatting.

**Value**

```typescript theme={null}
number | null // e.g., 42.5, 1000, null
```

**Type**

```json theme={null}
"number"
```

**Settings**

```json theme={null}
{
  "name": "Quantity",
  "template": {
    "decimalPlaces": 2,        // 0-10, default: 1
    "numberFormat": "local"     // "local" | "comma_period" | "period_comma" | "space_comma" | "space_period", default: "local"
  }
}
```

***

### Currency

Monetary values with currency symbol and formatting.

**Value**

```typescript theme={null}
number | null // Stored as raw number, e.g., 99.99, 1000.00, null
```

**Type**

```json theme={null}
"currency"
```

**Settings**

```json theme={null}
{
  "name": "Price",
  "template": {
    "currencySymbol": "$",      // default: "$"
    "decimalPlaces": 2,         // 0-10, default: 2
    "numberFormat": "local"     // "local" | "comma_period" | "period_comma" | "space_comma" | "space_period", default: "local"
  }
}
```

***

### Percent

Percentage values with optional progress bar display.

**Value**

```typescript theme={null}
number | null // Stored as decimal (0.5 = 50%), e.g., 0.85, 1.0, null
```

**Type**

```json theme={null}
"percent"
```

**Settings**

```json theme={null}
{
  "name": "Completion Rate",
  "template": {
    "decimalPlaces": 1,         // 0+, default: 0
    "numberFormat": "local",    // default: "local"
    "showProgressBar": true,    // default: false
    "allowNegative": false      // default: false
  }
}
```

***

### Rating

Star rating system with customizable maximum value.

**Value**

```typescript theme={null}
number | null // Integer from 0 to maxRating, e.g., 4, 5, null
```

**Type**

```json theme={null}
"rating"
```

**Settings**

```json theme={null}
{
  "name": "Customer Rating",
  "template": {
    "maxRating": 5              // 1-10, default: 5
  }
}
```

***

### Duration

Time duration with customizable display format.

**Value**

```typescript theme={null}
number | null // Stored as total seconds, e.g., 3600 (1 hour), 7260 (2:01:00), null
```

**Type**

```json theme={null}
"duration"
```

**Settings**

```json theme={null}
{
  "name": "Meeting Length",
  "template": {
    "format": "h:mm:ss"         // "h:mm" | "h:mm:ss" | "h:mm:ss.s" | "h:mm:ss.ss" | "h:mm:ss.sss", default: "h:mm"
  }
}
```

***

## Selection Fields

### Single Select

Choose one option from a predefined list.

**Value**

```typescript theme={null}
string | null // Option label, e.g., "Active", "Pending", null
```

**Type**

```json theme={null}
"single_select"
```

**Settings**

```json theme={null}
{
  "name": "Status",
  "template": {
    "options": [
      { "label": "Active", "color": "green" },
      { "label": "Inactive", "color": "gray" },
      { "label": "Pending", "color": "yellow" }
    ]
  }
}
```

<Note>
  * `label` (required): The display text for the option
  * `color` (optional): Color key for the option. If not specified, a color will be auto-assigned. Available colors: purple, orange, blue, gray, red, yellow, green, pink, lime, tangerine, emerald, sky, teal, indigo, cyan, violet, fuchsia
  * `value` (optional): Not specified when creating new options. Useful in write operations when specifying existing options (e.g., reordering options, keeping old options and adding new ones)
</Note>

***

### Multiple Select

Choose multiple options from a predefined list.

**Value**

```typescript theme={null}
string[] // Array of option labels, e.g., ["Urgent", "Bug"], []
```

**Type**

```json theme={null}
"multiple_select"
```

**Settings**

```json theme={null}
{
  "name": "Tags",
  "template": {
    "options": [
      { "label": "Urgent", "color": "red" },
      { "label": "Bug", "color": "orange" },
      { "label": "Feature", "color": "blue" },
      { "label": "Enhancement", "color": "purple" }
    ]
  }
}
```

<Note>
  * `label` (required): The display text for the option
  * `color` (optional): Color key for the option. If not specified, a color will be auto-assigned. Available colors: purple, orange, blue, gray, red, yellow, green, pink, lime, tangerine, emerald, sky, teal, indigo, cyan, violet, fuchsia
  * `value` (optional): Not specified when creating new options. Useful in write operations when specifying existing options (e.g., reordering options, keeping old options and adding new ones)
</Note>

***

### Checkbox

Boolean true/false toggle.

**Value**

```typescript theme={null}
boolean // true or false
```

**Type**

```json theme={null}
"checkbox"
```

**Settings**

```json theme={null}
{
  "name": "Is Complete",
  "template": {
    "color": "#10b981"          // default: "#a8a4ac"
  }
}
```

***

## Date & Time Fields

### Date

Calendar date without time component.

**Value**

```typescript theme={null}
string | null // ISO date string (UTC), e.g., "2024-03-15T00:00:00.000Z", null
```

**Type**

```json theme={null}
"date"
```

**Settings**

```json theme={null}
{
  "name": "Due Date",
  "template": {
    "dateFormat": "us"          // "local" | "long" | "us" | "european" | "iso", default: "local"
  }
}
```

***

### DateTime

Date and time with timezone support.

**Value**

```typescript theme={null}
string | null // ISO datetime string, e.g., "2024-03-15T14:30:00.000Z", null
```

**Type**

```json theme={null}
"datetime"
```

**Settings**

```json theme={null}
{
  "name": "Meeting Time",
  "template": {
    "displayTimeZone": true,    // default: false
    "dateFormat": "us",         // "local" | "long" | "us" | "european" | "iso", default: "local"
    "timeFormat": "24h",        // "12h" | "24h", default: "12h"
    "timezone": "America/New_York" // default: "" (browser timezone)
  }
}
```

***

## File Fields

### Attachments

File attachments with URL and optional filename.

**Value**

```typescript theme={null}
Array<{
  url: string,          // Required: URL to the file
  filename?: string     // Optional: Display name for the file
}>
```

**Type**

```json theme={null}
"attachments"
```

<Note>
  When providing attachment values, the URL must be accessible. The filename is optional and used for display purposes only.
</Note>

***

## Relationship Fields

### Linked Record

Create relationships between records in different tables.

**Value**

```typescript theme={null}
string[] // Array of record IDs, e.g., ["rec123", "rec456"] or []
```

**Type**

```json theme={null}
"linked_record"
```

**Settings**

```json theme={null}
{
  "name": "Related Tasks",
  "template": {
    "tableId": "tbl789",        // required: ID of table to link to
    "allowMultiple": true,      // default: true
    "inverseFieldId": "fld456", // optional: ID of inverse field
    "isInverse": false          // optional: flag for inverse fields
  }
}
```

<Note>
  * `tableId` can be either a table ID or table name during base creation
  * Creating linked record fields automatically connects tables in both directions
</Note>

***

### Lookup

Display values from linked records.

**Value**

```typescript theme={null}
any | any[] | null
// Returns the actual values from the looked-up field
// Single value if linked record field has allowMultiple: false
// Array of values if linked record field has allowMultiple: true
// Type depends on the field being looked up (string, number, boolean, etc.)
```

**Type**

```json theme={null}
"lookup"
```

**Settings**

```json theme={null}
{
  "name": "Task Names",
  "template": {
    "linkedRecordFieldId": "fld123", // required: ID of linked record field in same table
    "lookupFieldId": "fld456"        // required: ID of field to lookup in linked table
  }
}
```

<Warning>
  Lookup fields cannot be created during initial base setup. Add them later using the field creation endpoint.
</Warning>

***

## Computed Fields

### Formula

Dynamically computed values based on other fields using formula expressions.

<Note>
  Formula fields are read-only and automatically recalculate when referenced fields change. See the [Formulas guide](/help/database/configure-database/formulas) for the complete list of supported functions.
</Note>

**Value**

```typescript theme={null}
string | number | Date | boolean | any[]  // Based on resultType
```

**Type**

```json theme={null}
"formula"
```

**Settings**

```json theme={null}
{
  "name": "Total Price",
  "template": {
    "expression": "SUM({Price}, {Tax})",
    "resultType": "number",
    "formatting": {
      "numberDisplayType": "currency",
      "decimalPlaces": 2
    }
  }
}
```

| Property     | Type   | Description                                                                                        |
| ------------ | ------ | -------------------------------------------------------------------------------------------------- |
| `expression` | string | The [formula expression](/help/database/configure-database/formulas), e.g. `"SUM({Price}, {Tax})"` |
| `resultType` | string | The output type: `"text"`, `"number"`, `"date"`, `"boolean"`, or `"array"`                         |
| `formatting` | object | Optional display formatting options (see below)                                                    |

**Formatting Options**

For numbers (`numberDisplayType`):

* `"number"` - Plain number
* `"currency"` - Currency display (use with `decimalPlaces`, `numberFormat`)
* `"percent"` - Percentage display
* `"duration"` - Time duration

For dates:

* `dateFormat` - Date format string
* `timeFormat` - Time format (`"12h"` or `"24h"`)
* `timezone` - Timezone for display
* `displayTimeZone` - Whether to show timezone

***

## System Fields

### Autonumber

Auto-incrementing integer field, system-generated.

**Value**

```typescript theme={null}
number | null  // e.g., 1, 2, 3, ... (auto-assigned by the system)
```

**Type**

```json theme={null}
"autonumber"
```

**Settings**

```json theme={null}
{
  "name": "ID",
  "template": {}  // No configuration options
}
```

<Note>
  Autonumber values are auto-generated and cannot be set manually. The field is read-only.
</Note>

***

### Source

Tracks where the record was created from (form, API, workflow, etc.).

**Value**

```typescript theme={null}
// Discriminated union based on `type`
| { type: "public_api", apiKeyId?: number }
| { type: "form_submission", flowPublicId: string, sessionId: string }
| { type: "workflow", workflowId: string, executionId: string }
| { type: "manual", reason?: string, userId?: number }
| null
```

**Type**

```json theme={null}
"source"
```

**Settings**

```json theme={null}
{
  "name": "Source",
  "template": {}  // No configuration options
}
```

<Note>
  Source values are system-generated and cannot be set manually. The value is stored as JSONB.
</Note>

***

## Primary Field Requirements

The first field in each table becomes the **primary field** and must be one of these types:

* `single_line_text`
* `long_text`
* `date`
* `phone_number`
* `email`
* `url`
* `number`
* `currency`
* `percent`
* `duration`
* `autonumber`
* `formula`

***

## General Notes

1. **Empty Values**: Each field type has a default empty value:
   * Text fields: `""` (empty string)
   * Number fields: `null`
   * Boolean fields: `false`
   * Array fields: `[]` (empty array)
   * Object fields: `null`

<Warning>
  Changing field types after data has been added may result in data loss if the new type is incompatible with existing values.
</Warning>
