# Objects

The Objects module is the platform's generic content model. A merchant defines **object types** (content types such as "FAQ", "Page", or "Store location") in the client dashboard, each with an ordered list of typed **properties**. Content editors then create **records** (entries) of those types. Your storefront reads both through the public API: the type definitions tell you what shape to expect, the records carry the content.

This makes the module a natural fit for LLM-driven and headless storefronts: fetch `/v1/api/objects/types` once to learn the schema, then render records generically.

The read endpoints below live under `/v1/api/objects`, require the `objects:read` scope on your API key, and require the `objects` module to be enabled (`403 {"error":"Module not enabled: objects"}` otherwise).

## Object types and properties

An object type has a `key` (a unique slug used in URLs; the values `types`, `records`, `properties`, and `bulk` are reserved and never appear), a singular `name`, a `plural_name`, and `settings` that say whether its records are published and how they are addressed. Every type automatically carries a required `name` text property; merchants add the rest.

The type `settings` object:

| Field | Type | Description |
| --- | --- | --- |
| `publishable` | boolean | `true` when records of this type start as drafts and must be published (see [Publishing and visibility](#publishing-and-visibility)). `false` for types without a draft step. |
| `slug` | object | Present only when the type gives its records addresses: `{source, prefixes}`. `source` is the key of the text property the address is derived from. `prefixes` maps a language tag to the address prefix for that language, for example `{"en": "/services", "nl": "/diensten"}`; an empty string means no prefix. Absent when the type has no addresses. |

A property definition has:

| Field | Type | Description |
| --- | --- | --- |
| `key` | string | Machine key, matching `/^[a-z][a-z0-9_]*$/`. This is the key used inside record `values`. |
| `label` | string | Human label. |
| `type` | string | One of the property types below. |
| `options` | array of string or null | The allowed values for `select` and `token_variant` properties; `null` for all other types. |
| `localized` | boolean | `true` when the value is stored once per content language (see [Localized values](#localized-values)). |
| `config` | object or null | Kind-specific configuration: `{fields, item_label_field}` for a `repeater`, `{object_type_keys}` for `record_ref` and `record_ref_list`. `null` for the other types. |
| `is_required` | boolean | Whether the property must have a value. For a localized property this means a value in the default language. |
| `position` | integer | Sort position within the type, 0-based. |

Property types and the value each produces inside `values`. The same kinds are available to fields inside sections and repeater rows.

| Type | Value in `values` | Constraints |
| --- | --- | --- |
| `text` | string | Maximum 255 characters. |
| `textarea` | string | Maximum 10000 characters. |
| `richtext` | string (HTML) | Maximum 50000 characters. Sanitized server-side to the allowlist in [Rich text values](#rich-text-values). A value with too many unclosed formatting tags (`b`, `i`, `strong`, `em`, `a` and the like) is rejected on save with a validation error. |
| `number` | number | Integer or float. |
| `money` | integer | Non-negative, in cents. `15900` means 159.00 in the store currency. |
| `boolean` | boolean | |
| `select` | string | One of the property's `options`. |
| `date` | string | `YYYY-MM-DD`. |
| `datetime` | string | ISO 8601 with an offset, for example `2026-10-12T10:00:00+02:00`. |
| `customer` | string (uuid) | A customer id. |
| `media` | object or null | `{id, url, alt, width, height, mime_type, focal, variants}` of a public media library item; see [Media values](#media-values). |
| `media_list` | array of object | Up to 50 media objects, each with an extra `caption`; see [Media values](#media-values). |
| `link` | object `{url, label}` | `url` required, maximum 2000 characters, same scheme allowlist as richtext hrefs; `label` optional, maximum 200 characters. |
| `icon` | string | Icon name matching `/^[a-z][a-z0-9-]{0,39}$/`. |
| `token_variant` | string | One of the property's `options`. |
| `color` | string | `#RRGGBB`, for example `#1A2B3C`. |
| `email` | string | A valid email address, maximum 255 characters. |
| `phone` | string | 5 to 30 characters: digits, spaces, `()-.`, with an optional leading `+`. |
| `tags` | array of string | Up to 50 tags of 1 to 60 characters each, duplicates removed. |
| `record_ref` | string (uuid) | The id of another record, from one of the property's `config.object_type_keys` types. Fetch it with `GET /v1/api/objects/records/{id}`. |
| `record_ref_list` | array of string (uuid) | References to other records; maximum 24 entries. |
| `repeater` | array of row objects | Each row is `{"_key": "row_{24 hex}", ...fields}`, with the fields defined in the property's `config.fields`. Maximum 50 rows. A row can hold one more repeater whose rows hold no repeater, and a repeater has at most 40 fields. A repeater itself cannot be localized, but its fields can. |
| `sections` | array | Structured page-builder content; see below. |

Properties can be archived in the dashboard. Archived properties are invisible on the public API: they are omitted from the type's property list and their keys are stripped from record `values`.

## Records

A record is `{id, values, published_at, created_at}`, plus `slugs` when the type has addresses. `values` is a JSON object keyed by property key. Properties without a value are simply absent from `values` (null values are dropped on save), so always treat missing keys as "no value". The one exception is a `media` value that points at an item that is missing or private: that key is present with the value `null`. `published_at` and `created_at` are ISO 8601 timestamps; `published_at` is when the record went live (for a type that is not publishable it is the creation time).

`slugs` maps a language tag to the record's address in that language, for example `{"en": "kitchen-fitting", "nl": "keukenmontage"}`. The slug is the last path segment: the full path on your storefront is the type's prefix for that language (from `settings.slug.prefixes`) plus `/` plus the slug. Only enabled content languages appear. Look a record up by address with `GET /v1/api/objects/types/{key}/records/by-slug/{slug}` (see [Records](./records)).

## Publishing and visibility

The public API only ever serves content a merchant has published.

- On a type with `settings.publishable: true`, a record is visible when it is published and its `published_at` is now or in the past. Drafts, and records scheduled for a future `published_at`, are omitted from the list and answer `404` on both single-record endpoints. A scheduled record appears on its own when its time arrives; no webhook fires at that moment.
- On a type that is not publishable, records have no draft step and are visible as soon as they are created. (Drafts left over from before Publishing was switched off stay hidden.)
- Visibility is the same on every endpoint. `filter[status]` is not available on the public API (it answers `422`), because every record you can read is already published.

## Localized values

A property or section field flagged `localized` stores one value per content language. Its value in `values` is a map from language tag to value, `{"en": "Hello", "nl": "Hallo"}`, with tags matching `/^[a-z]{2}(-[A-Z]{2})?$/`. The API cuts the map down to the languages currently enabled for the store, so a language the merchant has since disabled never leaks. A language the merchant left empty is simply absent from the map: fall back to the store's default language, which is always the first enabled language and always filled in when the property is required. A value that is not required may have no entry for the default language, for example `{"nl": "Hallo"}` on a store whose default is `en`; when no enabled language remains in the map, the value is `null`.

A property that is not `localized` always returns a bare value, whatever the kind. Number, money, boolean, date, datetime, customer, color, media_list, record references, repeater and sections properties cannot be localized (the fields inside a repeater row or a section can). Handle both shapes for the same kind, because a merchant can switch a property to localized later.

## Rich text values

A `richtext` value is stored and returned as an HTML string. Every write (dashboard, import) goes through one allowlist, and sanitizing already clean HTML changes nothing.

| Part | Kept |
| --- | --- |
| Elements | `p`, `br`, `h1` to `h6`, `strong`, `b`, `em`, `i`, `u`, `s`, `sub`, `sup`, `blockquote`, `hr`, `ul`, `ol`, `li`, `a`, `img`, `figure`, `figcaption`, `table`, `thead`, `tbody`, `tr`, `th`, `td`, `pre`, `code` |
| Attributes on every element | `class` and `id`: tokens of 1 to 64 characters that start with a letter and hold letters, digits, `-` and `_` (`class` keeps up to 10 distinct tokens) |
| `a` | `href`, `title`, `target` (only `_blank`), `rel` |
| `img` | `src`, `alt`, `title`, `width`, `height` (1 to 99999), `data-media-id` |
| `th`, `td` | `colspan`, `rowspan` (1 to 50) |
| `ol` | `start`, `reversed` |

Everything else is removed. `script`, `style`, `iframe`, `object`, `embed`, `form`, `input`, `button`, `textarea`, `select`, `meta`, `link`, `base`, `svg`, `math`, `template` and `noscript` go together with their content; any other unknown element is unwrapped and its text kept. Inline `style` and `on*` attributes never survive.

- `href` and `src` hold no whitespace or control characters. An `href` is `https://`, `http://`, `mailto:`, `tel:`, root-relative `/` (not `//host`) or a `#fragment`. An `img` `src` is `https://` or root-relative `/`; an `http://` `src` is only kept together with a valid `data-media-id`, and an `img` without a usable `src` is removed.
- `target="_blank"` always carries `rel="noopener noreferrer"` (existing `rel` tokens are kept).
- `data-media-id` is a media library uuid. On a public read, a tag with the id of public media of the store gets the current `src` and, when missing, `width` and `height`; an id that is not the store's (or not public) loses the attribute and, for an `http://` `src`, the image. Library images therefore stay current when the file is replaced.

Storefronts render the string as HTML. The server cleans it, but a storefront may sanitize it again with its own policy, and should set a Content Security Policy (at least `script-src` without `unsafe-inline` and an `img-src` that allows your media host).

## Media values

`media` and `media_list` values are resolved for you, so a storefront needs no second request:

```json title="media value"
{
  "id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
  "url": "https://cdn.borkol.com/t/abc/hero.webp",
  "alt": "Oak table in a sunny room",
  "width": 1600,
  "height": 900,
  "mime_type": "image/webp",
  "focal": { "x": 0.5, "y": 0.3 },
  "variants": {
    "thumb": "https://wsrv.nl/?url=https%3A%2F%2Fcdn.borkol.com%2Ft%2Fabc%2Fhero.webp&w=160&we=1&output=webp&q=80",
    "card": "https://wsrv.nl/?url=https%3A%2F%2Fcdn.borkol.com%2Ft%2Fabc%2Fhero.webp&w=480&we=1&output=webp&q=80",
    "detail": "https://wsrv.nl/?url=https%3A%2F%2Fcdn.borkol.com%2Ft%2Fabc%2Fhero.webp&w=1200&we=1&output=webp&q=80"
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `id` | string (uuid) | The media library id. |
| `url` | string | Public URL of the file. |
| `alt` | string or null | Alternative text from the media library. |
| `width`, `height` | integer or null | Pixel size; `null` when it is not known (for example for files that are not images). |
| `mime_type` | string | For example `image/webp`. |
| `focal` | object or null | The focal point `{x, y}`, each from `0` (left, top) to `1` (right, bottom): the point to keep in view when the image is cropped. The merchant can set it for this one use of the image; otherwise it is the image's default from the media library; `null` when neither is set. |
| `variants` | object | Resized WebP URLs by name: `thumb` (160 px wide), `card` (480 px) and `detail` (1200 px). Never upscaled past the original. |

A `media` value is this object, or `null` when the item no longer exists or is private. A `media_list` value is a list of these objects, each with an extra `caption` (`string`, a locale map, or `null`); an item may carry its own `alt` that replaces the library one (a string or a locale map). Items that are missing or private are dropped from the list, so the list can be shorter than what the merchant picked. Only public media is ever exposed; private files never appear.

To crop around the focal point, use it as the anchor of your crop, for example CSS `object-position: calc(x * 100%) calc(y * 100%)` with `object-fit: cover`; [Images](/api/build-a-site/images) has `borkolImage` and `focalStyle`, which center the crop on the point exactly. A change to an image's default focal point or alt text sends the webhook event [`media.updated`](/api/webhooks/index#mediaupdated) when a published record shows that image.

## Sections values

A property of type `sections` holds page-builder content: its value is a **list of section instances**. A sections value that was stored empty returns `[]`. Each instance has this shape:

```json title="Section instance"
{
  "_key": "sec_a1b2c3d4e5f60718293a4b5c",
  "type": "content_section",
  "look": "default",
  "v": 1,
  "visible": true,
  "data": { "heading": { "en": "Welcome" }, "body": { "en": "Fresh bread every morning." } }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `_key` | string | Stable instance key, `sec_` plus 24 hex characters. |
| `type` | string | The section type key, one of the store's section types (`GET /v1/api/objects/section-types`). |
| `look` | string | The visual variant (look) key of that section type. |
| `v` | integer | Schema version of the section type at save time. |
| `visible` | boolean | Editors can hide a section without deleting it. Skip instances with `visible: false` when rendering. |
| `data` | object | Field values, keyed by the section type's field keys. |

Section instances are validated on write against the store's section type definitions (key, name, icon, looks, schema version, fields, item label field). A store starts with a set of seeded section types; a connected site pushes its own (see [Build a site](/api/build-a-site/index)). Read the definitions with [`GET /v1/api/objects/section-types`](/api/build-a-site/schema#get-v1apiobjectssection-types); a `sections` property lists the keys it allows in `section_type_keys`.

Every field kind in the property table above can appear inside `data`, with the same value shape and the same public serialization: `media` and `media_list` values are media objects, localized fields are locale maps cut down to the enabled languages, and repeater rows keep their `_key`. A section whose type no longer exists in the store is left out of the list. Sections with `visible: false` are still returned; skip them when rendering.

**Limits.** A section has at most 40 fields. A sections property holds at most 100 sections (or the property's configured maximum) and at most 256KB of JSON.

## Menu, single records and subpages

Three type settings shape how content is organised. They are returned in `settings` on every type and default as shown when a type never set them.

| Key | Type | Default | Description |
| --- | --- | --- | --- |
| `menu.placement` | string | `objects` | `objects` lists the type under Objects in the dashboard; `sidebar` gives it its own sidebar item. Dashboard only; it does not change the API. |
| `menu.icon` | string or null | `null` | A lowercase kebab Lucide icon name, for example `file-text`. |
| `menu.position` | integer | `100` | 0 to 999, lower first. |
| `singleton` | boolean | `false` | The type holds a single record (site settings, a one-off page). The store cannot create a second one. |
| `hierarchical` | boolean | `false` | Records can have a parent record of the same type, up to 5 levels deep (a root is level 1). |

On a hierarchical type, each record's `parent_id` names its parent (`null` for a root) and `position` orders it among its siblings. Fetch a tree level by level with `filter[parent]=root`, then `filter[parent]={id}`, sorted with `sort=position`. Every record has both fields, so a storefront can read them without checking the type first. Parent slugs are not joined into nested paths: build `/about/team` from the records yourself.

## The standard Pages type

Every store with Objects has a type with `key` and `system_key` both `page`. A storefront can rely on it and on these core properties:

| Key | Kind | Localized | Description |
| --- | --- | --- | --- |
| `title` | `text` | yes | Required. The page title; addresses derive from it. |
| `body` | `sections` | no | The page content as sections; `section_type_keys` lists the section types it allows. |
| `seo_title` | `text` | yes | Title for search engines. |
| `seo_description` | `textarea` | yes | Description for search engines. |
| `social_image` | `media` | no | Image for link previews. |

Its settings are fixed apart from `publishable` and the menu icon and position: `hierarchical` is `true`, and `slug` is `{"source": "title"}` with an empty prefix in every language, so a page's address is a root path such as `/about-us`. A store may add its own properties next to the core ones; core properties keep their key and kind. `name` and `plural_name` stay `Page` and `Pages` in the API (the dashboard shows them in the user's language). A store that already had a type of its own keyed `page` keeps it, and `system_key` is `null` there.

## Conventions

- All ids are UUIDs. All data is implicitly scoped to your store by the API key.
- Money is always integer cents. Dates in `date` fields and range filters are `YYYY-MM-DD` strings. `created_at` and `published_at` timestamps are ISO 8601.
- Only the record list endpoint is paginated; the types list returns a plain `data` array.

## Endpoints

| Endpoint | Purpose |
| --- | --- |
| `GET /v1/api/objects/types` | List all object types with their property definitions. See [Types](./types). |
| `GET /v1/api/objects/types/{key}/records` | Paginated, filterable record list for one type. See [Records](./records). |
| `GET /v1/api/objects/types/{key}/records/by-slug/{slug}` | Fetch a single record by its address in one language. See [Records](./records). |
| `GET /v1/api/objects/records/{id}` | Fetch a single record by id. See [Records](./records). |
| `GET /v1/api/objects/section-types` | List the store's active section types. See [Schema](/api/build-a-site/schema). |
| `GET /v1/api/objects/schema` | The connected site, the types and the section types in one response. See [Schema](/api/build-a-site/schema). |

A connected site pushes its schema with `PUT /v1/api/objects/schema` and uploads section thumbnails with `POST /v1/api/objects/media`, both with the `objects:schema` scope. See [Build a site](/api/build-a-site/index).
