# Records

Records are the content half of the Objects module. The list endpoint is the only paginated endpoint on the Objects surface and supports sorting, free-text search, and per-property filtering over the record values. All three endpoints require the `objects:read` scope, and record `values` only ever contain active (non-archived) property keys. They only serve published content: on a publishable type, drafts and records scheduled for the future are left out of the list and answer `404` when fetched directly (see [Publishing and visibility](./index#publishing-and-visibility)). Localized values are locale maps cut down to the languages enabled for the store, and `media` values are media objects (see [Media values](./index#media-values)). With a preview token in `X-Borkol-Preview`, the three endpoints also serve the token's own record as its draft and add `status` to that record; see [Preview](/api/build-a-site/preview).

## GET /v1/api/objects/types/{key}/records

Paginated list of records of one object type, addressed by the type's key (from `GET /v1/api/objects/types`).

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | string | Yes | The object type key, for example `faq`. |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `sort` | string | No | Sort column: `created_at` or any active property key. Prefix with `-` for descending. Default `-created_at`. `number` and `money` properties sort numerically, `date` properties sort as dates; records without a value for the property sort last. `position` sorts by the record's position among its siblings (lower first, then oldest first), unless the type has a property keyed `position`. |
| `q` | string | No | Case-insensitive substring search, ORed across the type's `text`, `textarea`, `email` and `phone` properties, the `url` and `label` of its `link` properties and the text of its `richtext` properties (tags removed, so markup and attribute values never match). For a localized property the language given by `locale` is searched (the store's default language when absent). Ignored (matches everything) when the type has none of these properties. Must be a single string. |
| `filter[{propertyKey}]` | string | No | Exact-match filter on one property. Filtering by `status` is not available on the public API, since every record is already published; `filter[status]` answers `422` unless the type has a property keyed `status`. Booleans accept `true`, `false`, `1`, `0`. `select` matches the option string. Repeatable for multiple properties; multiple filters combine with AND. `filter[{propertyKey}]` on a `tags` property matches records whose list contains that exact tag; on a `record_ref_list` property, records whose list contains that record id; on a `record_ref`, records pointing at that id. A value that is an array answers `422` on `filter`. A `color` property matches by equality, ignoring letter case (`#1a2b3c` finds `#1A2B3C`). |
| `filter[parent]` | string | No | `root` for records without a parent, or a record id for the direct children of that record. Meant for hierarchical types (see [Hierarchical types](./index#menu-single-records-and-subpages)); on other types `root` matches every record. Any other value answers `422`. Ignored as a tree filter when the type has a property keyed `parent`, which then owns the name. |
| `filter[path]` | string | No | The one record at a composed address in the `locale` language: the type's address prefix, then the addresses of its parent records and its own, for example `/about/team`. Answers at most one record, or an empty list when nothing is live at that path: a path through a draft, scheduled or deleted parent record resolves to nothing, and staged (unpublished) address changes never match. A trailing `/` is ignored. On the `page` type the root page with the address `home` is the home page and answers `/` (`/home` is not a second address). Must be a single string. Ignored as a path filter when the type has a property keyed `path`, which then owns the name. |
| `filter[{propertyKey}][from]` | string | No | Lower bound (inclusive). Only for `number`, `money`, and `date` properties. Dates as `YYYY-MM-DD`, money in cents. |
| `filter[{propertyKey}][to]` | string | No | Upper bound (inclusive). Same types and formats as `from`. `from` and `to` can be combined or used alone. |
| `per_page` | integer | No | Page size. Default 25, clamped to the range 1 to 100. |
| `page` | integer | No | Page number, default 1. |
| `locale` | string | No | A language tag enabled for the store, for example `nl`. Localized `filter[...]`, `sort` and `q` use this language; the store's default language when absent. A language that is not enabled falls back to the default language here (the by-slug endpoint answers `422` instead). |
| `fallback_locale` | string | No | An enabled language tag. A localized value that is missing or empty in `locale` takes this language's value in the response, so `locale=nl&fallback_locale=en` serves the English title under `nl` until the Dutch one is written. Applies to fields, repeater rows, section data and expanded references; the stored values do not change. A language that is not enabled answers `422`. |
| `include` | string | No | `refs` expands record references (see [Expanding references](#expanding-references)). Comma list or `include[]=refs`; other tokens are ignored. |

```bash title="Request"
curl --globoff "https://api.borkol.com/v1/api/objects/types/faq/records?sort=-created_at&q=delivery&filter[category]=shipping&per_page=10" \
  -H "Authorization: Bearer {api_key}"
```

```javascript title="Request (JS)"
const params = new URLSearchParams({
  sort: "-created_at",
  q: "delivery",
  "filter[category]": "shipping",
  per_page: "10",
});
const res = await fetch(
  `https://api.borkol.com/v1/api/objects/types/faq/records?${params}`,
  { headers: { Authorization: `Bearer ${apiKey}` } },
);
const { data, meta } = await res.json();
```

Status: `200 OK`. Each record is `{id, values, published_at, created_at, updated_at}`, plus `slugs` (language tag to address) when the type has addresses. The response uses the standard Laravel pagination envelope: `data` (the records), `links` (`first`, `last`, `prev`, `next` page URLs, `null` where absent), and `meta` (`current_page`, `from`, `last_page`, `links`, `path`, `per_page`, `to`, `total`). `updated_at` is when the live record last changed. Edits a merchant has staged but not published yet do not move it.

Every record also carries `parent_id` (the parent record's id, or `null`) and `position` (integer, order among siblings), on every type: `null` and `0` on types without subpages.

```json title="Response"
{
  "data": [
    {
      "id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
      "parent_id": null,
      "position": 0,
      "values": {
        "name": "How long does delivery take?",
        "answer": "Orders ship within 2 business days.",
        "category": "shipping"
      },
      "published_at": "2026-08-01T09:15:00.000000Z",
      "created_at": "2026-08-01T09:15:00.000000Z",
      "updated_at": "2026-08-01T09:15:00.000000Z",
      "slugs": { "en": "how-long-does-delivery-take" }
    }
  ],
  "links": {
    "first": "https://api.borkol.com/v1/api/objects/types/faq/records?page=1",
    "last": "https://api.borkol.com/v1/api/objects/types/faq/records?page=3",
    "prev": null,
    "next": "https://api.borkol.com/v1/api/objects/types/faq/records?page=2"
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 3,
    "links": [
      { "url": null, "label": "&laquo; Previous", "active": false },
      { "url": "https://api.borkol.com/v1/api/objects/types/faq/records?page=1", "label": "1", "active": true },
      { "url": "https://api.borkol.com/v1/api/objects/types/faq/records?page=2", "label": "2", "active": false },
      { "url": "https://api.borkol.com/v1/api/objects/types/faq/records?page=3", "label": "3", "active": false },
      { "url": "https://api.borkol.com/v1/api/objects/types/faq/records?page=2", "label": "Next &raquo;", "active": false }
    ],
    "path": "https://api.borkol.com/v1/api/objects/types/faq/records",
    "per_page": 10,
    "to": 10,
    "total": 25
  }
}
```

### Expanding references

By default a `record_ref` value is the id of the linked record and a `record_ref_list` value is a list of ids. Pass `include=refs` (or `include[]=refs`) to get the linked records inline instead. It works on the list, on `GET /v1/api/objects/records/{id}` and on the by-slug endpoint, and covers references at the top level, inside repeater rows, inside section data and inside localized values.

An expanded record is `{id, type_key, values, slugs?, published_at}`: `slugs` is only present when the target's type has address (slug) settings, and `values` is shaped like any public record (localized maps cut down to the enabled languages, `media` as objects). Expansion goes one level only: references inside an expanded record stay ids. Only publicly visible targets are expanded; a target that is a draft, scheduled, deleted or missing is dropped, so a `record_ref` becomes `null` and the entry disappears from a `record_ref_list`. Unknown `include` tokens are ignored. The linked records of a whole page are loaded together, so the request cost does not grow per record.

```bash title="Request"
curl "https://api.borkol.com/v1/api/objects/types/service/records?include=refs" \
  -H "Authorization: Bearer {api_key}"
```

```json title="Response"
{
  "data": [
    {
      "id": "7a8b9c0d-1e2f-4a3b-84c5-d6e7f8a9b0c1",
      "parent_id": null,
      "position": 0,
      "values": {
        "name": "Kitchen fitting",
        "author": {
          "id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f",
          "type_key": "team_member",
          "values": { "name": "Sam Jansen" },
          "slugs": { "en": "sam-jansen" },
          "published_at": "2026-09-01T10:00:00.000000Z"
        },
        "related": []
      },
      "published_at": "2026-10-01T08:00:00.000000Z",
      "created_at": "2026-09-28T13:20:00.000000Z",
      "updated_at": "2026-09-28T13:20:00.000000Z",
      "slugs": { "en": "kitchen-fitting" }
    }
  ]
}
```

### Errors

- `404` when no object type has that key.
- `422` with `errors.sort` `["Cannot sort by {column}."]` when `sort` names something that is neither `created_at` nor an active property key.
- `422` with `errors.filter` `["Cannot filter by {field}."]` when a filter names an unknown or archived property (including `status`), or passes an array (`from`/`to`) to a property that is not `number`, `money`, or `date`.
- `422` with `errors.filter` `["Invalid filter value for {field}."]` when a `number` or `money` value or bound is not numeric, or a `date` value or bound is not a valid `YYYY-MM-DD` date.
- `422` with `errors.filter` `["Invalid filter value for path: a single path such as /about/team."]` when `filter[path]` is sent as an array.
- `422` with `errors.fallback_locale` `["This language is not enabled."]` when `fallback_locale` is not an enabled content language of the store.
- `422` with `errors.q` `["Search must be a single value."]` when `q` is sent more than once or as an array (`?q[]=x`).
- `403` `{"error":"Module not enabled: objects"}` and `403` `{"message":"Invalid ability provided."}` for module and scope failures.

## GET /v1/api/objects/types/{key}/records/by-slug/{slug}

Fetch one record by its address in one language. Use it to resolve a storefront URL: strip the type's prefix for the language from the path and pass the rest as `slug`. Only published, currently visible records match, and an address is matched within the one language you ask for.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | string | Yes | The object type key, for example `service`. |
| `slug` | string | Yes | The record's address in the requested language, for example `kitchen-fitting`. |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `locale` | string | No | A language tag enabled for the store, for example `nl`. Defaults to the store's default language. |
| `fallback_locale` | string | No | An enabled language tag. A localized value that is missing or empty in `locale` takes this language's value in the response, so `locale=nl&fallback_locale=en` serves the English title under `nl` until the Dutch one is written. Applies to fields, repeater rows, section data and expanded references; the stored values do not change. A language that is not enabled answers `422`. |
| `include` | string | No | `refs` expands record references, as on the list. See [Expanding references](#expanding-references). |

```bash title="Request"
curl "https://api.borkol.com/v1/api/objects/types/service/records/by-slug/keukenmontage?locale=nl" \
  -H "Authorization: Bearer {api_key}"
```

Status: `200 OK`, with the record in the same shape as the list items.

```json title="Response"
{
  "data": {
    "id": "7a8b9c0d-1e2f-4a3b-84c5-d6e7f8a9b0c1",
    "parent_id": null,
    "position": 0,
    "values": {
      "name": { "en": "Kitchen fitting", "nl": "Keukenmontage" },
      "cover": {
        "id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
        "url": "https://cdn.borkol.com/t/abc/kitchen.webp",
        "alt": "A fitted oak kitchen",
        "width": 1600,
        "height": 900,
        "mime_type": "image/webp"
      }
    },
    "published_at": "2026-10-01T08:00:00.000000Z",
    "created_at": "2026-09-28T13:20:00.000000Z",
    "updated_at": "2026-09-28T13:20:00.000000Z",
    "slugs": { "en": "kitchen-fitting", "nl": "keukenmontage" }
  }
}
```

If a merchant renames an address, the old address is not served here any more. A redirect is recorded only when the type has a non-empty address prefix for that language; resolve the old path with [`GET /v1/api/redirects`](/api/getting-started/seo) to send visitors to the new one.

### Errors

- `404` when no object type has that key, or no visible record has that address in that language (a draft or scheduled record is a `404`).
- `422` with `errors.locale` `["This language is not enabled."]` when `locale` is not an enabled content language of the store.
- `422` with `errors.fallback_locale` `["This language is not enabled."]` when `fallback_locale` is not an enabled content language of the store.
- `403` module and scope errors as above.

## GET /v1/api/objects/records/{id}

Fetch a single record by id. This works across all object types; you do not need to know the type key. `values` contains only active property keys. A `sections` property holds the section stack; see the [Objects concept page](./index) for the section instance shape, including locale-map values on localized fields and media objects. The record is only served while it is published and visible.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | Yes | The record id. |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `include` | string | No | `refs` expands record references, as on the list. See [Expanding references](#expanding-references). |
| `locale` | string | No | The language `fallback_locale` fills. Defaults to the store's default language; a language that is not enabled falls back to the default. |
| `fallback_locale` | string | No | An enabled language tag. A localized value that is missing or empty in `locale` takes this language's value in the response, so `locale=nl&fallback_locale=en` serves the English title under `nl` until the Dutch one is written. Applies to fields, repeater rows, section data and expanded references; the stored values do not change. A language that is not enabled answers `422`. |

```bash title="Request"
curl https://api.borkol.com/v1/api/objects/records/6f7a8b9c-0d1e-4f2a-b3c4-d5e6f7a8b9c0 \
  -H "Authorization: Bearer {api_key}"
```

Status: `200 OK`.

```json title="Response"
{
  "data": {
    "id": "6f7a8b9c-0d1e-4f2a-b3c4-d5e6f7a8b9c0",
    "parent_id": null,
    "position": 0,
    "values": {
      "name": "About us",
      "body": [
        {
          "_key": "sec_a1b2c3d4e5f60718293a4b5c",
          "type": "hero",
          "look": "default",
          "v": 1,
          "visible": true,
          "data": {
            "title": { "en": "Welcome to our shop" },
            "image": {
              "id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
              "url": "https://cdn.borkol.com/t/abc/hero.webp",
              "alt": "Our shop front",
              "width": 1600,
              "height": 900,
              "mime_type": "image/webp"
            },
            "cta": { "url": "/products", "label": "Shop now" }
          }
        }
      ]
    },
    "published_at": "2026-07-20T14:05:33.000000Z",
    "created_at": "2026-07-20T14:05:33.000000Z",
    "updated_at": "2026-07-20T14:05:33.000000Z"
  }
}
```

### Errors

- `404` when the record does not exist for this store, or is a draft or scheduled for the future.
- `422` with `errors.fallback_locale` `["This language is not enabled."]` when `fallback_locale` is not an enabled content language of the store.
- `403` module and scope errors as above.
