> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# SDK Types: Content Schema

**Publié le** : 2026-08-20
**Catégorie** : Types

# SDK Types: Content Schema

## `ContentSchema`

*Interface*

Complete content schema defining all custom fields for a structured category.
Attached to categories with `contentMode: 'structured'`.
Content articles in structured categories populate their `customData` field
according to this schema instead of using the free-form `body` editor.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `fields` | `SchemaField[]` | No | Ordered array of field definitions.<br>Fields are rendered in the admin editor in the order they appear here.<br>Each field's `key` becomes a property in the content's `customData` object. |


---

## `SchemaField`

*Interface*

A single field definition in a content schema.
Defines the structure, constraints, and display properties of one custom field.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `defaultValue` | `unknown` | Yes | Default value pre-filled when creating new content.<br>The type of this value should match the field's `type`<br>(e.g. `string` for text fields, `number` for number fields, `boolean` for boolean fields).<br>When not specified, the field starts empty. |
| `fields` | `SchemaField[]` | Yes | Sub-field definitions for `object` and `array` field types.<br>Required when `type` is `'object'` or `'array'`; ignored for other types.<br><br>- For `'object'`: defines the properties of the nested object.<br>- For `'array'`: defines the properties of each item in the array.<br><br>Sub-fields can themselves contain nested `fields` for deeply structured data. |
| `helpText` | `string` | Yes | Help text displayed below the field in the admin editor.<br>Used to provide additional context or instructions to content editors. |
| `itemLabel` | `string` | Yes | Display label for individual items in an `array` field.<br>Shown in the admin editor's repeater UI (e.g. "Slide", "Feature", "FAQ Item").<br>Only used when `type` is `'array'`. Ignored for other types. |
| `key` | `string` | No | Unique field identifier used as the property name in the content's `customData` object.<br>Must be a valid JavaScript identifier: lowercase letters, numbers, and underscores only.<br>No spaces or hyphens allowed. Must be unique within the schema. |
| `label` | `string` | No | Human-readable label displayed in the admin editor above the field.<br>Can contain spaces and special characters. Used for UI only, not in the data. |
| `maxItems` | `number` | Yes | Maximum number of items allowed in an `array` field (inclusive).<br>Only used when `type` is `'array'`. Ignored for other types.<br>The admin editor prevents adding items beyond this limit. |
| `minItems` | `number` | Yes | Minimum number of items required in an `array` field (inclusive).<br>Only used when `type` is `'array'`. Ignored for other types.<br>Validation fails if fewer items are provided. |
| `options` | `SchemaFieldOption[]` | Yes | Available options for `select` and `multiselect` field types.<br>Required when `type` is `'select'` or `'multiselect'`; ignored for other types.<br>Each option defines a `value` (stored in data) and a `label` (displayed in UI). |
| `placeholder` | `string` | Yes | Placeholder text shown in the input field when empty.<br>Only used for display in the admin editor.<br>Applies to `string`, `text`, `url`, `email`, `number`, and `date` types. |
| `required` | `boolean` | Yes | Whether a value must be provided when saving the content.<br>Defaults to `false` when not specified.<br>Required fields that are empty will cause a validation error on save. |
| `type` | `SchemaFieldType` | No | Field type that determines the editor widget, validation, and serialization.<br>See SchemaFieldType for the complete list and how each type maps<br>to a value in `customData`.<br><br>- `'richtext'` values are automatically converted to HTML strings by the API.<br>- `'image'` and `'file'` values are CDN URLs.<br>- `'object'` and `'array'` types require nested fields definitions.<br>- `'select'` and `'multiselect'` types require options definitions. |
| `validation` | `SchemaFieldValidation` | Yes | Validation rules for this field.<br>Applied both in the admin editor (client-side) and on the API (server-side).<br>See SchemaFieldValidation for which rules apply to which field types. |


---

## `SchemaFieldOption`

*Interface*

Option definition for `select` and `multiselect` field types.
Only meaningful when the parent field's `type` is `'select'` or `'multiselect'`.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `label` | `string` | No | Human-readable label displayed in the admin editor's dropdown.<br>Can contain spaces and special characters. |
| `value` | `string` | No | Machine-readable value stored in `customData` when this option is selected.<br>Must be unique within the field's options array. |


---

## `SchemaFieldType`

*TypeAlias*

Supported field types in a content schema.

Each type determines how the field is rendered in the admin editor and how
its value is serialized in the `customData` object:

| Type | Value in customData |
| --- | --- |
| `string` | Plain text string |
| `text` | Multi-line text string |
| `richtext` | HTML string (converted from TipTap editor) |
| `number` | Numeric value (integer or float) |
| `boolean` | `true` or `false` |
| `select` | Single string from the options list |
| `multiselect` | Array of strings from the options list |
| `image` | CDN URL string of the uploaded image |
| `file` | CDN URL string of the uploaded file |
| `url` | Full URL string (validated) |
| `email` | Email address string (validated) |
| `date` | ISO 8601 date string (`YYYY-MM-DD`) |
| `datetime` | ISO 8601 datetime string |
| `color` | Hex color string (e.g. `#ff5500`) |
| `object` | Nested object with sub-fields |
| `array` | Array of objects with sub-fields |
| `dataSource` | Resolved data from a DataSource reference |


```typescript
type SchemaFieldType = "string" | "text" | "richtext" | "number" | "boolean" | "select" | "multiselect" | "image" | "file" | "url" | "email" | "date" | "datetime" | "color" | "object" | "array" | "dataSource"
```

---

## `SchemaFieldValidation`

*Interface*

Validation rules for a schema field.
Which rules are applicable depends on the field's `type`:

- `minLength` / `maxLength`: apply to `string`, `text`, `richtext`, `url`, `email`
- `min` / `max`: apply to `number`
- `pattern`: applies to `string`, `text`

Invalid combinations (e.g. `minLength` on a `number` field) are ignored.

| Property | Type | Optional | Description |
| --- | --- | --- | --- |
| `max` | `number` | Yes | Maximum numeric value (inclusive).<br>Only applies to `number` field type. Ignored for non-numeric types. |
| `maxLength` | `number` | Yes | Maximum text length (inclusive).<br>Applies to string-like field types (`string`, `text`, `richtext`, `url`, `email`).<br>Ignored for non-string types. |
| `min` | `number` | Yes | Minimum numeric value (inclusive).<br>Only applies to `number` field type. Ignored for non-numeric types. |
| `minLength` | `number` | Yes | Minimum text length (inclusive).<br>Applies to string-like field types (`string`, `text`, `richtext`, `url`, `email`).<br>Ignored for non-string types. |
| `pattern` | `string` | Yes | Regular expression pattern for validation.<br>Only applies to `string` and `text` field types.<br>Must be a valid JavaScript regex pattern (without delimiters or flags). |