# Fields

Every field in a content type defines what data an entry can store and how that data is validated and rendered.

## Shared settings

Every field type shares these settings:

| Setting | Description |
|---|---|
| **Name** | The key used in API payloads, validation errors, and rendered entry fields. Must be unique within the content type. |
| **Label** | The editor-facing display name shown in entry forms and content type settings. |
| **Required** | Required fields must be filled when an entry is created and when the field is submitted during updates. |
| **Primary** | When set, the field value is used as the entry's display name in lists, relation selectors, and API responses. |

## Field types

| Type | Description |
|---|---|
| **String** | Text values. Supports multiple subtypes. |
| **Number** | Numeric values. Supports uniqueness and decimal precision. |
| **Boolean** | True or false. Can default to true for new entries. |
| **Date** | Date, time, or datetime. Configurable format. |
| **Array** | A list of values. Editors can enter comma-separated values or pick from predefined options. |
| **Attachment** | One or more files from the same workspace. |
| **Relation** | One or more entries from allowed content types in the same content bucket. |
| **JSON** | Structured data stored as JSON. |

## String subtypes

String fields can be configured with an `input_type` that adds format validation and editor behavior:

| Subtype | Validation | Max length |
|---|---|---|
| (default) | None | 255 |
| `textarea` | None | 15000 |
| `richtext` | None (editor produces HTML) | 15000 |
| `email` | Email format | 255 |
| `url` | URL format | 255 |
| `slug` | Alpha-dash (letters, digits, hyphens, underscores) | 255 |
| `path` | Relative path starting with `/`, `./`, or `../` | 255 |
| `phone` | Digits and common phone characters (`+`, `-`, `(`, `)`, space) | 255 |
| `dropdown` | Must match one of the configured `options` | 255 |
| `list` | Must match one of the configured `options` | 255 |

## Attachments

Attachment fields reference files owned by the same workspace. Key settings:

- **Accepted MIME types** can be exact values (e.g. `image/png`) or wildcards (e.g. `image/*`).
- **Multiple** — allow multiple file attachments. When enabled, the API value is an array of file IDs.
- **Distinct** — prevent selecting the same file twice.
- **Cascade on delete** — delete the attached file when the entry is deleted.

On render, attachment values are resolved to file details such as the file name, ID, and download URL.

## Relations

Relation fields reference entries from allowed content types in the **same content bucket**. Key settings:

- **Allowed content types** — which content types can be referenced.
- **Multiple** — allow multiple relations.
- **Distinct** — prevent selecting the same entry twice.
- **Cascade on delete** — delete related entries when the source entry is deleted.

On render, relation values are resolved to entry details in the requested locale.

> Warning: Relations can only reference entries in the same content bucket. Cross-content bucket relations are not supported.

## Field properties reference

Common field properties include name, label, type, required, primary, unique, multiple, input type, options, decimal precision, date format, accepted file types, cascade-on-delete, distinct, checked by default, and current timestamp.

## Default values

| Type | Default |
|---|---|
| `string` | `null` |
| `number` | `null` |
| `boolean` | `false` (or `checked_by_default` if set) |
| `date` | `null` (or current timestamp if `current_timestamp` is set) |
| `array` | `null` |
| `attachment` | `null` |
| `relation` | `null` |
| `json` | `null` |

## Related pages

- [Content Types](/docs/content-modeling/content-types) — How fields fit into content types.
- [Field Types](/docs/content-modeling/field-types) — Detailed field type reference.
- [Entries](/docs/content/entries) — How field values are stored and rendered.
- [API Entries](/docs/api/entries) — Submitting field values via the API.
