data
Storyblok Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Storyblok KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.storyblok.*.
Use lua_read_doc("integrations.storyblok") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Storyblok workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.storyblok.list_stories({page = 1, per_page = 1, search = "example_search", sort_by = "example_sort_by"}))' --json kosmo integrations:lua --eval 'print(docs.read("storyblok"))' --json
kosmo integrations:lua --eval 'print(docs.read("storyblok.list_stories"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local storyblok = app.integrations.storyblok
local result = storyblok.list_stories({page = 1, per_page = 1, search = "example_search", sort_by = "example_sort_by"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.storyblok, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.storyblok.default.* or app.integrations.storyblok.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Storyblok, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Storyblok — Lua API Reference
list_stories
List stories in the configured Storyblok space. Supports pagination, search, and sorting.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1) |
per_page | integer | no | Number of stories per page (default: 25, max: 100) |
search | string | no | Search term to filter stories by name or slug |
sort_by | string | no | Sort field (e.g., "name:asc", "created_at:desc", "updated_at:desc") |
Examples
List stories
local result = app.integrations.storyblok.list_stories({
per_page = 25
})
for _, story in ipairs(result.stories) do
print(story.name .. " (" .. story.slug .. ")")
end
Search and sort stories
local result = app.integrations.storyblok.list_stories({
search = "blog",
sort_by = "updated_at:desc",
per_page = 10
})
get_story
Retrieve a single Storyblok story by its numeric ID, including full content.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The numeric ID of the story to retrieve |
Examples
Get a story
local result = app.integrations.storyblok.get_story({
id = 12345678
})
print("Name: " .. result.story.name)
print("Slug: " .. result.story.slug)
print("Content: " .. json.stringify(result.story.content))
create_story
Create a new story in the configured Storyblok space. Requires a name, slug, and content object.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | yes | The display name of the story |
slug | string | yes | URL-friendly slug for the story (e.g., "my-new-page") |
content | object | yes | The story content as a JSON object. Must match a component schema in the space (e.g., {component = "page", title = "Hello"}) |
parent_id | integer | no | The numeric ID of the parent story (for nested stories) |
is_startpage | boolean | no | Whether this is the root/start page of the space (default: false) |
tag_list | array | no | List of tags to assign to the story |
Examples
Create a story
local result = app.integrations.storyblok.create_story({
name = "My New Page",
slug = "my-new-page",
content = {
component = "page",
title = "My New Page",
body = "Hello, world!"
}
})
print("Created story: " .. result.story.id)
Create a nested story
local result = app.integrations.storyblok.create_story({
name = "Blog Post",
slug = "blog-post",
content = {
component = "post",
title = "Blog Post",
excerpt = "A short summary"
},
parent_id = 12345678,
tag_list = { "blog", "news" }
})
update_story
Update an existing Storyblok story. Provide the story ID and the fields to update (e.g., content, name, slug).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The numeric ID of the story to update |
content | object | no | Updated story content as a JSON object |
name | string | no | Updated display name of the story |
slug | string | no | Updated URL slug for the story |
tag_list | array | no | Updated list of tags |
At least one update field is required.
Examples
Update story content
local result = app.integrations.storyblok.update_story({
id = 12345678,
content = {
component = "page",
title = "Updated Title",
body = "Updated content"
}
})
print("Updated story: " .. result.story.name)
Update name and tags
local result = app.integrations.storyblok.update_story({
id = 12345678,
name = "Renamed Page",
tag_list = { "updated", "featured" }
})
delete_story
Delete a story from the configured Storyblok space by its numeric ID. This action is irreversible.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The numeric ID of the story to delete |
Examples
Delete a story
local result = app.integrations.storyblok.delete_story({
id = 12345678
})
print(result.message)
list_components
List all component schemas defined in the configured Storyblok space. Useful for understanding available content structures.
Parameters
This tool takes no parameters.
Examples
List components
local result = app.integrations.storyblok.list_components({})
for _, component in ipairs(result.components) do
print(component.name)
for _, field in ipairs(component.schema) do
print(" - " .. field.name .. " (" .. field.type .. ")")
end
end
get_current_user
List all available Storyblok spaces for the authenticated user. Useful as a health check or to discover space IDs.
Parameters
This tool takes no parameters.
Examples
List spaces (health check)
local result = app.integrations.storyblok.get_current_user({})
for _, space in ipairs(result.spaces) do
print(space.name .. " (ID: " .. space.id .. ")")
end
Multi-Account Usage
If you have multiple storyblok accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.storyblok.list_stories({...})
-- Explicit default (portable across setups)
app.integrations.storyblok.default.list_stories({...})
-- Named accounts
app.integrations.storyblok.production.list_stories({...})
app.integrations.storyblok.staging.list_stories({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Storyblok — Lua API Reference
## list_stories
List stories in the configured Storyblok space. Supports pagination, search, and sorting.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number for pagination (default: 1) |
| `per_page` | integer | no | Number of stories per page (default: 25, max: 100) |
| `search` | string | no | Search term to filter stories by name or slug |
| `sort_by` | string | no | Sort field (e.g., `"name:asc"`, `"created_at:desc"`, `"updated_at:desc"`) |
### Examples
#### List stories
```lua
local result = app.integrations.storyblok.list_stories({
per_page = 25
})
for _, story in ipairs(result.stories) do
print(story.name .. " (" .. story.slug .. ")")
end
```
#### Search and sort stories
```lua
local result = app.integrations.storyblok.list_stories({
search = "blog",
sort_by = "updated_at:desc",
per_page = 10
})
```
---
## get_story
Retrieve a single Storyblok story by its numeric ID, including full content.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The numeric ID of the story to retrieve |
### Examples
#### Get a story
```lua
local result = app.integrations.storyblok.get_story({
id = 12345678
})
print("Name: " .. result.story.name)
print("Slug: " .. result.story.slug)
print("Content: " .. json.stringify(result.story.content))
```
---
## create_story
Create a new story in the configured Storyblok space. Requires a name, slug, and content object.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | The display name of the story |
| `slug` | string | yes | URL-friendly slug for the story (e.g., `"my-new-page"`) |
| `content` | object | yes | The story content as a JSON object. Must match a component schema in the space (e.g., `{component = "page", title = "Hello"}`) |
| `parent_id` | integer | no | The numeric ID of the parent story (for nested stories) |
| `is_startpage` | boolean | no | Whether this is the root/start page of the space (default: false) |
| `tag_list` | array | no | List of tags to assign to the story |
### Examples
#### Create a story
```lua
local result = app.integrations.storyblok.create_story({
name = "My New Page",
slug = "my-new-page",
content = {
component = "page",
title = "My New Page",
body = "Hello, world!"
}
})
print("Created story: " .. result.story.id)
```
#### Create a nested story
```lua
local result = app.integrations.storyblok.create_story({
name = "Blog Post",
slug = "blog-post",
content = {
component = "post",
title = "Blog Post",
excerpt = "A short summary"
},
parent_id = 12345678,
tag_list = { "blog", "news" }
})
```
---
## update_story
Update an existing Storyblok story. Provide the story ID and the fields to update (e.g., content, name, slug).
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The numeric ID of the story to update |
| `content` | object | no | Updated story content as a JSON object |
| `name` | string | no | Updated display name of the story |
| `slug` | string | no | Updated URL slug for the story |
| `tag_list` | array | no | Updated list of tags |
At least one update field is required.
### Examples
#### Update story content
```lua
local result = app.integrations.storyblok.update_story({
id = 12345678,
content = {
component = "page",
title = "Updated Title",
body = "Updated content"
}
})
print("Updated story: " .. result.story.name)
```
#### Update name and tags
```lua
local result = app.integrations.storyblok.update_story({
id = 12345678,
name = "Renamed Page",
tag_list = { "updated", "featured" }
})
```
---
## delete_story
Delete a story from the configured Storyblok space by its numeric ID. This action is irreversible.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The numeric ID of the story to delete |
### Examples
#### Delete a story
```lua
local result = app.integrations.storyblok.delete_story({
id = 12345678
})
print(result.message)
```
---
## list_components
List all component schemas defined in the configured Storyblok space. Useful for understanding available content structures.
### Parameters
This tool takes no parameters.
### Examples
#### List components
```lua
local result = app.integrations.storyblok.list_components({})
for _, component in ipairs(result.components) do
print(component.name)
for _, field in ipairs(component.schema) do
print(" - " .. field.name .. " (" .. field.type .. ")")
end
end
```
---
## get_current_user
List all available Storyblok spaces for the authenticated user. Useful as a health check or to discover space IDs.
### Parameters
This tool takes no parameters.
### Examples
#### List spaces (health check)
```lua
local result = app.integrations.storyblok.get_current_user({})
for _, space in ipairs(result.spaces) do
print(space.name .. " (ID: " .. space.id .. ")")
end
```
---
## Multi-Account Usage
If you have multiple storyblok accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.storyblok.list_stories({...})
-- Explicit default (portable across setups)
app.integrations.storyblok.default.list_stories({...})
-- Named accounts
app.integrations.storyblok.production.list_stories({...})
app.integrations.storyblok.staging.list_stories({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.storyblok.list_stories({page = 1, per_page = 1, search = "example_search", sort_by = "example_sort_by"})
print(result) Functions
list_stories Read
List stories in the configured Storyblok space. Supports pagination, search, and sorting.
- Lua path
app.integrations.storyblok.list_stories- Full name
storyblok.storyblok_list_stories
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of stories per page (default: 25, max: 100). |
search | string | no | Search term to filter stories by name or slug. |
sort_by | string | no | Sort field (e.g., "name:asc", "created_at:desc", "updated_at:desc"). |
get Read
Retrieve a single Storyblok story by its numeric ID, including full content.
- Lua path
app.integrations.storyblok.get- Full name
storyblok.storyblok_get_story
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The numeric ID of the story to retrieve. |
create Write
Create a new story in the configured Storyblok space. Requires a name, slug, and content object.
- Lua path
app.integrations.storyblok.create- Full name
storyblok.storyblok_create_story
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | The display name of the story. |
slug | string | yes | URL-friendly slug for the story (e.g., "my-new-page"). |
content | object | yes | The story content as a JSON object. Must match a component schema in the space (e.g., {"component": "page", "title": "Hello"}). |
parent_id | integer | no | The numeric ID of the parent story (for nested stories). |
is_startpage | boolean | no | Whether this is the root/start page of the space (default: false). |
tag_list | array | no | List of tags to assign to the story. |
update Write
Update an existing Storyblok story. Provide the story ID and the fields to update (e.g., content, name, slug).
- Lua path
app.integrations.storyblok.update- Full name
storyblok.storyblok_update_story
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The numeric ID of the story to update. |
content | object | no | Updated story content as a JSON object. |
name | string | no | Updated display name of the story. |
slug | string | no | Updated URL slug for the story. |
tag_list | array | no | Updated list of tags. |
delete Write
Delete a story from the configured Storyblok space by its numeric ID. This action is irreversible.
- Lua path
app.integrations.storyblok.delete- Full name
storyblok.storyblok_delete_story
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The numeric ID of the story to delete. |
list_components Read
List all component schemas defined in the configured Storyblok space. Useful for understanding available content structures.
- Lua path
app.integrations.storyblok.list_components- Full name
storyblok.storyblok_list_components
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_current_user_spaces Read
List all available Storyblok spaces for the authenticated user. Useful as a health check or to discover space IDs.
- Lua path
app.integrations.storyblok.get_current_user_spaces- Full name
storyblok.storyblok_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||