productivity
Confluence Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Confluence KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.confluence.*.
Use lua_read_doc("integrations.confluence") 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
Confluence workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.confluence.create_page({space_key = "example_space_key", title = "example_title", body = "example_body", parent_id = "example_parent_id", type = "example_type"}))' --json kosmo integrations:lua --eval 'print(docs.read("confluence"))' --json
kosmo integrations:lua --eval 'print(docs.read("confluence.create_page"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local confluence = app.integrations.confluence
local result = confluence.create_page({space_key = "example_space_key", title = "example_title", body = "example_body", parent_id = "example_parent_id", type = "example_type"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.confluence, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.confluence.default.* or app.integrations.confluence.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Confluence, 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.
HTTP client for the Confluence Cloud REST API — Lua API Reference
confluence_add_comment
Add a comment to a Confluence page. Requires the page ID and comment body in HTML..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page to comment on. |
body | string | yes | The comment body in Confluence storage format (HTML). Example: |
Example
local result = app.integrations.confluence.confluence_add_comment({
page_id = ""
body = ""
})
confluence_add_labels
Add one or more labels to a Confluence page. Labels are provided as an array of name strings..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page. |
labels | array | yes | Array of label name strings to add. Example: [ |
Example
local result = app.integrations.confluence.confluence_add_labels({
page_id = ""
labels = {}
})
confluence_create_page
Create a new page in a Confluence space. Requires space_key, title, and body (HTML). Optionally specify a parent page ID..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
space_key | string | yes | The space key (e.g. |
title | string | yes | The title of the page. |
body | string | yes | The page body in Confluence storage format (HTML). Example: |
parent_id | string | no | Optional parent page ID to nest the new page under. |
type | string | no | Content type. Default: |
Example
local result = app.integrations.confluence.confluence_create_page({
space_key = ""
title = ""
body = ""
})
confluence_delete_page
Delete a Confluence page by its ID. This action moves the page to the trash..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page to delete. |
Example
local result = app.integrations.confluence.confluence_delete_page({
page_id = ""
})
confluence_get_labels
Get the labels attached to a Confluence page by its ID..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page. |
Example
local result = app.integrations.confluence.confluence_get_labels({
page_id = ""
})
confluence_get_page
Get details for a specific Confluence page by ID. Returns title, body, version, space, and other metadata..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page. |
expand | string | no | Comma-separated list of properties to expand. Example: |
Example
local result = app.integrations.confluence.confluence_get_page({
page_id = ""
expand = ""
})
confluence_get_page_ancestors
Get the ancestor (parent) pages of a Confluence page by its ID. Returns the full ancestor hierarchy..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page. |
Example
local result = app.integrations.confluence.confluence_get_page_ancestors({
page_id = ""
})
confluence_get_page_children
Get the child pages of a Confluence page by its ID. Supports pagination and property expansion..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the parent page. |
limit | integer | no | Maximum number of results per page. Default: 25. |
start | integer | no | Start offset for pagination. Default: 0. |
expand | string | no | Comma-separated list of properties to expand. Example: |
Example
local result = app.integrations.confluence.confluence_get_page_children({
page_id = ""
limit = 0
start = 0
})
confluence_get_space
Get details for a specific Confluence space by its key..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
space_key | string | yes | The space key (e.g. |
Example
local result = app.integrations.confluence.confluence_get_space({
space_key = ""
})
confluence_get_spaces
List Confluence spaces accessible to the authenticated user. Supports pagination and filtering by type and status..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results per page. Default: 25. |
start | integer | no | Start offset for pagination. Default: 0. |
type | string | no | Space type filter. Example: |
status | string | no | Space status filter. Example: |
Example
local result = app.integrations.confluence.confluence_get_spaces({
limit = 0
start = 0
type = ""
})
confluence_search_pages
Search for Confluence content using CQL (Confluence Query Language). Examples: .
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cql | string | yes | CQL query string. Example: \ |
limit | integer | no | Maximum number of results per page. Default: 25. |
start | integer | no | Start offset for pagination. Default: 0. |
expand | string | no | Comma-separated list of properties to expand. Example: |
Example
local result = app.integrations.confluence.confluence_search_pages({
cql = ""
limit = 0
start = 0
})
confluence_update_page
Update an existing Confluence page. Requires page_id, title, body, and the new version number (current version + 1)..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page to update. |
title | string | yes | The updated title of the page. |
body | string | yes | The updated page body in Confluence storage format (HTML). |
version | integer | yes | The new version number (must be current version + 1). |
status | string | no | Optional status. Example: |
Example
local result = app.integrations.confluence.confluence_update_page({
page_id = ""
title = ""
body = ""
})
Multi-Account Usage
If you have multiple confluence accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.confluence.function_name({...})
-- Explicit default (portable across setups)
app.integrations.confluence.default.function_name({...})
-- Named accounts
app.integrations.confluence.work.function_name({...})
app.integrations.confluence.personal.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# HTTP client for the Confluence Cloud REST API — Lua API Reference
## confluence_add_comment
Add a comment to a Confluence page. Requires the page ID and comment body in HTML..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_id` | string | yes | The content ID of the page to comment on. |
| `body` | string | yes | The comment body in Confluence storage format (HTML). Example: |
### Example
```lua
local result = app.integrations.confluence.confluence_add_comment({
page_id = ""
body = ""
})
```
## confluence_add_labels
Add one or more labels to a Confluence page. Labels are provided as an array of name strings..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_id` | string | yes | The content ID of the page. |
| `labels` | array | yes | Array of label name strings to add. Example: [ |
### Example
```lua
local result = app.integrations.confluence.confluence_add_labels({
page_id = ""
labels = {}
})
```
## confluence_create_page
Create a new page in a Confluence space. Requires space_key, title, and body (HTML). Optionally specify a parent page ID..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `space_key` | string | yes | The space key (e.g. |
| `title` | string | yes | The title of the page. |
| `body` | string | yes | The page body in Confluence storage format (HTML). Example: |
| `parent_id` | string | no | Optional parent page ID to nest the new page under. |
| `type` | string | no | Content type. Default: |
### Example
```lua
local result = app.integrations.confluence.confluence_create_page({
space_key = ""
title = ""
body = ""
})
```
## confluence_delete_page
Delete a Confluence page by its ID. This action moves the page to the trash..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_id` | string | yes | The content ID of the page to delete. |
### Example
```lua
local result = app.integrations.confluence.confluence_delete_page({
page_id = ""
})
```
## confluence_get_labels
Get the labels attached to a Confluence page by its ID..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_id` | string | yes | The content ID of the page. |
### Example
```lua
local result = app.integrations.confluence.confluence_get_labels({
page_id = ""
})
```
## confluence_get_page
Get details for a specific Confluence page by ID. Returns title, body, version, space, and other metadata..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_id` | string | yes | The content ID of the page. |
| `expand` | string | no | Comma-separated list of properties to expand. Example: |
### Example
```lua
local result = app.integrations.confluence.confluence_get_page({
page_id = ""
expand = ""
})
```
## confluence_get_page_ancestors
Get the ancestor (parent) pages of a Confluence page by its ID. Returns the full ancestor hierarchy..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_id` | string | yes | The content ID of the page. |
### Example
```lua
local result = app.integrations.confluence.confluence_get_page_ancestors({
page_id = ""
})
```
## confluence_get_page_children
Get the child pages of a Confluence page by its ID. Supports pagination and property expansion..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_id` | string | yes | The content ID of the parent page. |
| `limit` | integer | no | Maximum number of results per page. Default: 25. |
| `start` | integer | no | Start offset for pagination. Default: 0. |
| `expand` | string | no | Comma-separated list of properties to expand. Example: |
### Example
```lua
local result = app.integrations.confluence.confluence_get_page_children({
page_id = ""
limit = 0
start = 0
})
```
## confluence_get_space
Get details for a specific Confluence space by its key..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `space_key` | string | yes | The space key (e.g. |
### Example
```lua
local result = app.integrations.confluence.confluence_get_space({
space_key = ""
})
```
## confluence_get_spaces
List Confluence spaces accessible to the authenticated user. Supports pagination and filtering by type and status..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of results per page. Default: 25. |
| `start` | integer | no | Start offset for pagination. Default: 0. |
| `type` | string | no | Space type filter. Example: |
| `status` | string | no | Space status filter. Example: |
### Example
```lua
local result = app.integrations.confluence.confluence_get_spaces({
limit = 0
start = 0
type = ""
})
```
## confluence_search_pages
Search for Confluence content using CQL (Confluence Query Language). Examples: \.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `cql` | string | yes | CQL query string. Example: \ |
| `limit` | integer | no | Maximum number of results per page. Default: 25. |
| `start` | integer | no | Start offset for pagination. Default: 0. |
| `expand` | string | no | Comma-separated list of properties to expand. Example: |
### Example
```lua
local result = app.integrations.confluence.confluence_search_pages({
cql = ""
limit = 0
start = 0
})
```
## confluence_update_page
Update an existing Confluence page. Requires page_id, title, body, and the new version number (current version + 1)..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_id` | string | yes | The content ID of the page to update. |
| `title` | string | yes | The updated title of the page. |
| `body` | string | yes | The updated page body in Confluence storage format (HTML). |
| `version` | integer | yes | The new version number (must be current version + 1). |
| `status` | string | no | Optional status. Example: |
### Example
```lua
local result = app.integrations.confluence.confluence_update_page({
page_id = ""
title = ""
body = ""
})
```
---
## Multi-Account Usage
If you have multiple confluence accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.confluence.function_name({...})
-- Explicit default (portable across setups)
app.integrations.confluence.default.function_name({...})
-- Named accounts
app.integrations.confluence.work.function_name({...})
app.integrations.confluence.personal.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.confluence.create_page({space_key = "example_space_key", title = "example_title", body = "example_body", parent_id = "example_parent_id", type = "example_type"})
print(result) Functions
create_page Write
Create a new page in a Confluence space. Requires space_key, title, and body (HTML). Optionally specify a parent page ID.
- Lua path
app.integrations.confluence.create_page- Full name
confluence.confluence_create_page
| Parameter | Type | Required | Description |
|---|---|---|---|
space_key | string | yes | The space key (e.g. "DEV"). |
title | string | yes | The title of the page. |
body | string | yes | The page body in Confluence storage format (HTML). Example: "<p>Hello world</p>". |
parent_id | string | no | Optional parent page ID to nest the new page under. |
type | string | no | Content type. Default: "page". |
get_page Read
Get details for a specific Confluence page by ID. Returns title, body, version, space, and other metadata.
- Lua path
app.integrations.confluence.get_page- Full name
confluence.confluence_get_page
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page. |
expand | string | no | Comma-separated list of properties to expand. Example: "body.storage,version,space,ancestors". |
update_page Write
Update an existing Confluence page. Requires page_id, title, body, and the new version number (current version + 1).
- Lua path
app.integrations.confluence.update_page- Full name
confluence.confluence_update_page
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page to update. |
title | string | yes | The updated title of the page. |
body | string | yes | The updated page body in Confluence storage format (HTML). |
version | integer | yes | The new version number (must be current version + 1). |
status | string | no | Optional status. Example: "current" or "draft". |
delete_page Write
Delete a Confluence page by its ID. This action moves the page to the trash.
- Lua path
app.integrations.confluence.delete_page- Full name
confluence.confluence_delete_page
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page to delete. |
search_pages Read
Search for Confluence content using CQL (Confluence Query Language). Examples: 'title = "My Page"', 'space = "DEV" and type = "page"'.
- Lua path
app.integrations.confluence.search_pages- Full name
confluence.confluence_search_pages
| Parameter | Type | Required | Description |
|---|---|---|---|
cql | string | yes | CQL query string. Example: 'title = "My Page"' or 'space = "DEV" and type = "page"'. |
limit | integer | no | Maximum number of results per page. Default: 25. |
start | integer | no | Start offset for pagination. Default: 0. |
expand | string | no | Comma-separated list of properties to expand. Example: "body.storage,version,space". |
get_page_ancestors Read
Get the ancestor (parent) pages of a Confluence page by its ID. Returns the full ancestor hierarchy.
- Lua path
app.integrations.confluence.get_page_ancestors- Full name
confluence.confluence_get_page_ancestors
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page. |
get_page_children Read
Get the child pages of a Confluence page by its ID. Supports pagination and property expansion.
- Lua path
app.integrations.confluence.get_page_children- Full name
confluence.confluence_get_page_children
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the parent page. |
limit | integer | no | Maximum number of results per page. Default: 25. |
start | integer | no | Start offset for pagination. Default: 0. |
expand | string | no | Comma-separated list of properties to expand. Example: "body.storage,version,space". |
add_comment Write
Add a comment to a Confluence page. Requires the page ID and comment body in HTML.
- Lua path
app.integrations.confluence.add_comment- Full name
confluence.confluence_add_comment
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page to comment on. |
body | string | yes | The comment body in Confluence storage format (HTML). Example: "<p>Great article!</p>". |
get_spaces Read
List Confluence spaces accessible to the authenticated user. Supports pagination and filtering by type and status.
- Lua path
app.integrations.confluence.get_spaces- Full name
confluence.confluence_get_spaces
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of results per page. Default: 25. |
start | integer | no | Start offset for pagination. Default: 0. |
type | string | no | Space type filter. Example: "global" or "personal". |
status | string | no | Space status filter. Example: "current" or "archived". |
get_space Read
Get details for a specific Confluence space by its key.
- Lua path
app.integrations.confluence.get_space- Full name
confluence.confluence_get_space
| Parameter | Type | Required | Description |
|---|---|---|---|
space_key | string | yes | The space key (e.g. "DEV"). |
get_labels Read
Get the labels attached to a Confluence page by its ID.
- Lua path
app.integrations.confluence.get_labels- Full name
confluence.confluence_get_labels
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page. |
add_labels Write
Add one or more labels to a Confluence page. Labels are provided as an array of name strings.
- Lua path
app.integrations.confluence.add_labels- Full name
confluence.confluence_add_labels
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | yes | The content ID of the page. |
labels | array | yes | Array of label name strings to add. Example: ["documentation", "api"]. |