KosmoKrator

cms

Webflow Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Webflow KosmoKrator integration.

7 functions 6 read 1 write Manual OAuth token auth

Lua Namespace

Agents call this integration through app.integrations.webflow.*. Use lua_read_doc("integrations.webflow") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Webflow — Lua API Reference

list_sites

List all Webflow sites the authenticated user has access to.

Parameters

None.

Example

local result = app.integrations.webflow.list_sites({})

for _, site in ipairs(result.sites) do
  print(site.name .. " (" .. site.id .. ")")
end

get_site

Get details for a specific Webflow site.

Parameters

NameTypeRequiredDescription
idstringyesThe unique identifier of the Webflow site

Example

local result = app.integrations.webflow.get_site({
  id = "641d84b8f0bca14670785897"
})

print(result.name)
print(result.domain)

list_collections

List CMS collections for a Webflow site.

Parameters

NameTypeRequiredDescription
site_idstringyesThe unique identifier of the Webflow site
limitintegernoMaximum number of collections to return (default: 100)
offsetintegernoNumber of collections to skip for pagination (default: 0)

Example

local result = app.integrations.webflow.list_collections({
  site_id = "641d84b8f0bca14670785897"
})

for _, collection in ipairs(result.collections) do
  print(collection.displayName .. " (" .. collection.slug .. ")")
end

list_items

List items in a Webflow CMS collection.

Parameters

NameTypeRequiredDescription
collection_idstringyesThe unique identifier of the CMS collection
limitintegernoMaximum number of items to return (default: 100)
offsetintegernoNumber of items to skip for pagination (default: 0)

Example

local result = app.integrations.webflow.list_items({
  collection_id = "641d84b8f0bca14670785901",
  limit = 10
})

for _, item in ipairs(result.items) do
  print(item.fieldData.name)
end

Paginated example

local offset = 0
local limit = 50
local all_items = {}

repeat
  local result = app.integrations.webflow.list_items({
    collection_id = "641d84b8f0bca14670785901",
    limit = limit,
    offset = offset
  })

  for _, item in ipairs(result.items) do
    table.insert(all_items, item)
  end

  offset = offset + limit
until #result.items < limit

get_item

Get a single CMS item from a collection.

Parameters

NameTypeRequiredDescription
collection_idstringyesThe unique identifier of the CMS collection
idstringyesThe unique identifier of the CMS item

Example

local result = app.integrations.webflow.get_item({
  collection_id = "641d84b8f0bca14670785901",
  id = "641d84b8f0bca14670785905"
})

print(result.fieldData.name)
print(result.fieldData.slug)

create_item

Create a new item in a Webflow CMS collection.

Parameters

NameTypeRequiredDescription
collection_idstringyesThe unique identifier of the CMS collection
fieldsobjectyesField data as key-value pairs matching the collection schema
livebooleannoWhether to publish the item immediately (default: false)

Common Fields

FieldDescription
nameItem display name
slugURL slug (auto-generated from name if omitted)
_draftWhether the item is a draft
_archivedWhether the item is archived

Field names vary by collection. Use list_collections to inspect schema fields.

Examples

Create a draft item

local result = app.integrations.webflow.create_item({
  collection_id = "641d84b8f0bca14670785901",
  fields = {
    name = "My New Blog Post",
    slug = "my-new-blog-post",
    _draft = true
  }
})

print("Created item: " .. result.id)

Create and publish immediately

local result = app.integrations.webflow.create_item({
  collection_id = "641d84b8f0bca14670785901",
  fields = {
    name = "Breaking News",
    slug = "breaking-news"
  },
  live = true
})

print("Published item: " .. result.id)

get_current_user

Get the currently authenticated Webflow user.

Parameters

None.

Example

local result = app.integrations.webflow.get_current_user({})

print(result.user.email)
print(result.user.firstName .. " " .. result.user.lastName)

Multi-Account Usage

If you have multiple Webflow accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.webflow.list_sites({})

-- Explicit default (portable across setups)
app.integrations.webflow.default.list_sites({})

-- Named accounts
app.integrations.webflow.production.list_sites({})
app.integrations.webflow.staging.list_sites({})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# Webflow — Lua API Reference

## list_sites

List all Webflow sites the authenticated user has access to.

### Parameters

None.

### Example

```lua
local result = app.integrations.webflow.list_sites({})

for _, site in ipairs(result.sites) do
  print(site.name .. " (" .. site.id .. ")")
end
```

---

## get_site

Get details for a specific Webflow site.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The unique identifier of the Webflow site |

### Example

```lua
local result = app.integrations.webflow.get_site({
  id = "641d84b8f0bca14670785897"
})

print(result.name)
print(result.domain)
```

---

## list_collections

List CMS collections for a Webflow site.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | string | yes | The unique identifier of the Webflow site |
| `limit` | integer | no | Maximum number of collections to return (default: 100) |
| `offset` | integer | no | Number of collections to skip for pagination (default: 0) |

### Example

```lua
local result = app.integrations.webflow.list_collections({
  site_id = "641d84b8f0bca14670785897"
})

for _, collection in ipairs(result.collections) do
  print(collection.displayName .. " (" .. collection.slug .. ")")
end
```

---

## list_items

List items in a Webflow CMS collection.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `collection_id` | string | yes | The unique identifier of the CMS collection |
| `limit` | integer | no | Maximum number of items to return (default: 100) |
| `offset` | integer | no | Number of items to skip for pagination (default: 0) |

### Example

```lua
local result = app.integrations.webflow.list_items({
  collection_id = "641d84b8f0bca14670785901",
  limit = 10
})

for _, item in ipairs(result.items) do
  print(item.fieldData.name)
end
```

### Paginated example

```lua
local offset = 0
local limit = 50
local all_items = {}

repeat
  local result = app.integrations.webflow.list_items({
    collection_id = "641d84b8f0bca14670785901",
    limit = limit,
    offset = offset
  })

  for _, item in ipairs(result.items) do
    table.insert(all_items, item)
  end

  offset = offset + limit
until #result.items < limit
```

---

## get_item

Get a single CMS item from a collection.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `collection_id` | string | yes | The unique identifier of the CMS collection |
| `id` | string | yes | The unique identifier of the CMS item |

### Example

```lua
local result = app.integrations.webflow.get_item({
  collection_id = "641d84b8f0bca14670785901",
  id = "641d84b8f0bca14670785905"
})

print(result.fieldData.name)
print(result.fieldData.slug)
```

---

## create_item

Create a new item in a Webflow CMS collection.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `collection_id` | string | yes | The unique identifier of the CMS collection |
| `fields` | object | yes | Field data as key-value pairs matching the collection schema |
| `live` | boolean | no | Whether to publish the item immediately (default: false) |

### Common Fields

| Field | Description |
|-------|-------------|
| `name` | Item display name |
| `slug` | URL slug (auto-generated from name if omitted) |
| `_draft` | Whether the item is a draft |
| `_archived` | Whether the item is archived |

Field names vary by collection. Use `list_collections` to inspect schema fields.

### Examples

#### Create a draft item

```lua
local result = app.integrations.webflow.create_item({
  collection_id = "641d84b8f0bca14670785901",
  fields = {
    name = "My New Blog Post",
    slug = "my-new-blog-post",
    _draft = true
  }
})

print("Created item: " .. result.id)
```

#### Create and publish immediately

```lua
local result = app.integrations.webflow.create_item({
  collection_id = "641d84b8f0bca14670785901",
  fields = {
    name = "Breaking News",
    slug = "breaking-news"
  },
  live = true
})

print("Published item: " .. result.id)
```

---

## get_current_user

Get the currently authenticated Webflow user.

### Parameters

None.

### Example

```lua
local result = app.integrations.webflow.get_current_user({})

print(result.user.email)
print(result.user.firstName .. " " .. result.user.lastName)
```

---

## Multi-Account Usage

If you have multiple Webflow accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.webflow.list_sites({})

-- Explicit default (portable across setups)
app.integrations.webflow.default.list_sites({})

-- Named accounts
app.integrations.webflow.production.list_sites({})
app.integrations.webflow.staging.list_sites({})
```

All functions are identical across accounts — only the credentials differ.

Metadata-Derived Lua Example

local result = app.integrations.webflow.webflow_list_sites({})
print(result)

Functions

webflow_list_sites

List all Webflow sites the authenticated user has access to. Returns site IDs, names, and domains needed for further CMS operations.

Operation
Read read
Full name
webflow.webflow_list_sites
ParameterTypeRequiredDescription
No parameters.

webflow_get_site

Get details for a specific Webflow site by its ID. Returns site name, domain, publishing status, and other metadata.

Operation
Read read
Full name
webflow.webflow_get_site
ParameterTypeRequiredDescription
id string yes The unique identifier of the Webflow site (e.g., "641d84b8f0bca14670785897").

webflow_list_collections

List CMS collections for a Webflow site. Collections are content models (e.g., "Blog Posts", "Team Members") that hold structured items.

Operation
Read read
Full name
webflow.webflow_list_collections
ParameterTypeRequiredDescription
site_id string yes The unique identifier of the Webflow site.
limit integer no Maximum number of collections to return (default: 100).
offset integer no Number of collections to skip for pagination (default: 0).

webflow_list_items

List items in a Webflow CMS collection. Returns paginated results with item IDs, field data, and draft/publish status.

Operation
Read read
Full name
webflow.webflow_list_items
ParameterTypeRequiredDescription
collection_id string yes The unique identifier of the CMS collection.
limit integer no Maximum number of items to return (default: 100).
offset integer no Number of items to skip for pagination (default: 0).

webflow_get_item

Get a single CMS item from a Webflow collection by its ID. Returns full field data including rich text, images, and references.

Operation
Read read
Full name
webflow.webflow_get_item
ParameterTypeRequiredDescription
collection_id string yes The unique identifier of the CMS collection the item belongs to.
id string yes The unique identifier of the CMS item.

webflow_create_item

Create a new item in a Webflow CMS collection. Pass field data as key-value pairs matching the collection's schema. Set live to true to publish immediately.

Operation
Write write
Full name
webflow.webflow_create_item
ParameterTypeRequiredDescription
collection_id string yes The unique identifier of the CMS collection to add the item to.
fields object yes Field data as key-value pairs matching the collection schema. Common fields: name, slug, _archived, _draft.
live boolean no Whether to publish the item immediately (default: false). Set to true to make the item live on the site.

webflow_get_current_user

Get the currently authenticated Webflow user. Returns user profile including name, email, and account details.

Operation
Read read
Full name
webflow.webflow_get_current_user
ParameterTypeRequiredDescription
No parameters.