# ovok.cms

Canonical page: https://docs.ovok.com/web-sdk/core/namespaces/cms

Reads published content from the Ovok CMS. Reads are always made as the client's `tenantCode`. Legal pages and translations can be read before sign-in; other collections need a signed-in user.

## Read a legal page [#read-a-legal-page]

```ts
const terms = await ovok.cms.legalPage('terms-and-conditions', { locale: 'de-DE' });
```

- `locale` takes an app language (`de-DE`) or a CMS locale (`de`). Omitted, the CMS answers in its default locale.
- The `body` field is rich-text JSON, not HTML; render it with a rich-text renderer.

## List and read documents [#list-and-read-documents]

```ts
const page = await ovok.cms.documents.list('faqs', { limit: 20, sort: '-publishedAt' });

for await (const doc of ovok.cms.documents.list('faqs')) {
  console.log(doc.title);
}

const doc = await ovok.cms.documents.retrieve('faqs', 'how-to-pair-a-device');
```

- `list` returns a `PagePromise`: await it for the first page, or `for await` to walk every page.
- `limit` is at most 50. `sort` names a top-level field; prefix it with `-` for descending.
- `retrieve` takes a slug and throws `OvokValidationError` for an empty one. A draft and a missing document both come back as not found.
- Both calls use `v1/public/cms/collections/{collection}/items` and merge in the shared tenant's published documents.

## Release notes [#release-notes]

```ts
const notes = await ovok.cms.releaseNotes.list({ limit: 5 });
```

- Same paging and params as `documents.list`; newest first unless `sort` says otherwise.

## Load translations [#load-translations]

```ts
const translations = await ovok.cms.translations('de');
```

- Returns the `translations` collection as one nested tree: one group per document slug, with keys split at the dots.
- Reads every page of the collection, 50 documents at a time. If the CMS still offers a next page after 500 pages, it throws `OvokError` with code `cms_translations_page_limit` instead of returning a partial tree.
- Nothing is cached on the device. Cache the result in your app if you need it offline.

## Reference [#reference]

- [cms API reference](/web-sdk/core/reference/core/cms): every method and type.
- [ovok.content](/web-sdk/core/namespaces/content): the older content routes.
- [Errors and retries](/web-sdk/core/errors-and-retries)
