> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webstorio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Content SDK

> window.webstorio content methods — content types, entries, and categories.

Fetch structured content from your Webstorio CMS on published sites. Requires the **Content & CMS** feature (`content`).

## getContentTypes()

List all content types in the project.

```javascript theme={"dark"}
const types = await window.webstorio.getContentTypes();
// [{ id, key, name, fields, ... }]
```

## getContentEntries(contentTypeKey, options?)

List or filter entries for a content type.

```javascript theme={"dark"}
const result = await window.webstorio.getContentEntries("blog_post", {
  status: "published",   // "draft" | "published"
  categoryId: "...",     // optional UUID
  categoryKey: "news",   // optional string key
  limit: 10,
  offset: 0,
  slug: "my-post",       // optional — fetch by slug
});

// { entries: [...], total?, limit?, offset? }
```

Entry field values live in `entry.dataJson` (shape matches your content type schema).

## getContentEntryById(contentTypeKey, entryId)

Fetch a single entry by UUID. Use on detail pages with `getPathParams()`:

```javascript theme={"dark"}
const { content_entry_id } = window.webstorio.getPathParams();
const entry = await window.webstorio.getContentEntryById(
  "blog_post",
  content_entry_id,
);
```

## getContentCategories()

List all content categories.

```javascript theme={"dark"}
const categories = await window.webstorio.getContentCategories();
```

## getContentCategoryById(categoryId)

```javascript theme={"dark"}
const category = await window.webstorio.getContentCategoryById(categoryId);
```

## Field types

Each content type field in `schemaJson` is `{ key, type, label, required?, seoRole? }`. Values in `entry.dataJson` match the field `type`:

| Type       | Label       | Stored value          |
| ---------- | ----------- | --------------------- |
| `text`     | Short text  | string                |
| `longtext` | Rich text   | HTML string           |
| `number`   | Number      | number                |
| `boolean`  | Yes / no    | boolean               |
| `date`     | Date & Time | string (`YYYY-MM-DD`) |
| `url`      | Link        | string                |
| `image`    | Image       | string (asset URL)    |
| `video`    | Video       | string (asset URL)    |
| `document` | Document    | string (asset URL)    |
| `json`     | JSON        | object                |

`image`, `video`, and `document` store a public asset URL — upload files in **Assets** (or via the CLI) and pick them in the entry editor. `seoRole` (`title` | `description` | `keywords` | `image`) maps a field into page metadata.

## User guide

Non-technical setup: [Content & CMS](/guides/content-and-cms)
