KosmoKrator

data

Bannerbear Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.bannerbear.*. Use lua_read_doc("integrations.bannerbear") 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 Bannerbear workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.bannerbear.create_image({template_id = "example_template_id", modifications = "example_modifications", width = 1, height = 1, transparent = true, metadata = "example_metadata"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("bannerbear"))' --json
kosmo integrations:lua --eval 'print(docs.read("bannerbear.create_image"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local bannerbear = app.integrations.bannerbear
local result = bannerbear.create_image({template_id = "example_template_id", modifications = "example_modifications", width = 1, height = 1, transparent = true, metadata = "example_metadata"})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.bannerbear, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.bannerbear.default.* or app.integrations.bannerbear.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Bannerbear, use the narrower mcp:lua command.

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.

Bannerbear — Lua API Reference

create_image

Generate an image from a Bannerbear template with custom modifications.

Parameters

NameTypeRequiredDescription
template_idstringyesTemplate UID (use list_templates to find)
modificationsarrayyesArray of modification objects (see below)
widthintegernoOverride template width (pixels)
heightintegernoOverride template height (pixels)
transparentbooleannoRender with transparent background (PNG only)
metadatastringnoCustom metadata string (max 500 chars)

Modification Object

Each modification targets a named layer in the template:

{
  name = "layer_name",
  text = "Hello World",       -- for text layers
  image_url = "https://...",  -- for image layers
  color = "#FF0000",          -- for shape/color layers
  barcode = "123456789"       -- for barcode layers
}

Examples

local result = app.integrations.bannerbear.create_image({
  template_id = "01H8XYZ...",
  modifications = {
    { name = "title", text = "Weekly Report" },
    { name = "subtitle", text = "Q1 2026" },
    { name = "photo", image_url = "https://example.com/photo.jpg" },
    { name = "bg_color", color = "#1a1a2e" }
  }
})

print(result.uid)   -- image UID for polling
print(result.status) -- "pending", "in_progress", or "completed"

get_image

Retrieve the status and URL of a previously created image.

Parameters

NameTypeRequiredDescription
image_idstringyesImage UID from create_image

Example

local result = app.integrations.bannerbear.get_image({
  image_id = "01H8ABC..."
})

if result.status == "completed" then
  print(result.image_url)  -- download URL for the generated image
else
  print("Status: " .. result.status)  -- "pending" or "in_progress"
end

create_video

Generate a video from a Bannerbear template.

Parameters

NameTypeRequiredDescription
template_idstringyesTemplate UID
modificationsarrayyesArray of modification objects per scene
fpsintegernoFrames per second
trimstringnoTrim as “start,end” in seconds (e.g., “0,5”)
metadatastringnoCustom metadata string (max 500 chars)

Example

local result = app.integrations.bannerbear.create_video({
  template_id = "01H8XYZ...",
  modifications = {
    { name = "headline", text = "Welcome!" },
    { name = "background", image_url = "https://example.com/bg.jpg" }
  },
  fps = 30
})

print(result.uid)

get_video

Retrieve the status and URL of a previously created video.

Parameters

NameTypeRequiredDescription
video_idstringyesVideo UID from create_video

Example

local result = app.integrations.bannerbear.get_video({
  video_id = "01H8DEF..."
})

if result.status == "completed" then
  print(result.video_url)
else
  print("Status: " .. result.status)
end

list_templates

List all available Bannerbear templates.

Parameters

None.

Example

local result = app.integrations.bannerbear.list_templates()

for _, tpl in ipairs(result) do
  print(tpl.uid .. " — " .. tpl.name .. " (" .. tpl.width .. "x" .. tpl.height .. ")")
end

get_template

Get details and modification layers for a specific template.

Parameters

NameTypeRequiredDescription
template_idstringyesTemplate UID

Example

local result = app.integrations.bannerbear.get_template({
  template_id = "01H8XYZ..."
})

print("Template: " .. result.name)
for _, layer in ipairs(result.modification_layers or {}) do
  print("  Layer: " .. layer.name .. " (" .. layer.type .. ")")
end

create_animated_gif

Generate an animated GIF from a Bannerbear template.

Parameters

NameTypeRequiredDescription
template_idstringyesTemplate UID
modificationsarrayyesArray of modification objects per frame
fpsintegernoFrames per second
metadatastringnoCustom metadata string (max 500 chars)

Example

local result = app.integrations.bannerbear.create_animated_gif({
  template_id = "01H8XYZ...",
  modifications = {
    { name = "frame_text", text = "Frame 1" },
    { name = "frame_text", text = "Frame 2" },
    { name = "frame_text", text = "Frame 3" }
  },
  fps = 10
})

print(result.uid)

list_images

List previously created Bannerbear images with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (1-based, defaults to 1)
limitintegernoResults per page (defaults to 20)

Example

local result = app.integrations.bannerbear.list_images({
  page = 1,
  limit = 10
})

for _, img in ipairs(result) do
  print(img.uid .. " — " .. img.status)
end

list_collections

List Bannerbear collections with pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (1-based, defaults to 1)
limitintegernoResults per page (defaults to 20)

Example

local result = app.integrations.bannerbear.list_collections({
  page = 1,
  limit = 10
})

for _, col in ipairs(result) do
  print(col.uid .. " — " .. (col.name or "untitled"))
end

get_current_user

Get the authenticated Bannerbear account details.

Parameters

None.

Example

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

print("Account: " .. result.name)
print("Email: " .. result.email)

Multi-Account Usage

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

-- Default account (always works)
app.integrations.bannerbear.function_name({...})

-- Explicit default (portable across setups)
app.integrations.bannerbear.default.function_name({...})

-- Named accounts
app.integrations.bannerbear.production.function_name({...})
app.integrations.bannerbear.staging.function_name({...})

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

Raw agent markdown
# Bannerbear — Lua API Reference

## create_image

Generate an image from a Bannerbear template with custom modifications.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `template_id` | string | yes | Template UID (use `list_templates` to find) |
| `modifications` | array | yes | Array of modification objects (see below) |
| `width` | integer | no | Override template width (pixels) |
| `height` | integer | no | Override template height (pixels) |
| `transparent` | boolean | no | Render with transparent background (PNG only) |
| `metadata` | string | no | Custom metadata string (max 500 chars) |

### Modification Object

Each modification targets a named layer in the template:

```lua
{
  name = "layer_name",
  text = "Hello World",       -- for text layers
  image_url = "https://...",  -- for image layers
  color = "#FF0000",          -- for shape/color layers
  barcode = "123456789"       -- for barcode layers
}
```

### Examples

```lua
local result = app.integrations.bannerbear.create_image({
  template_id = "01H8XYZ...",
  modifications = {
    { name = "title", text = "Weekly Report" },
    { name = "subtitle", text = "Q1 2026" },
    { name = "photo", image_url = "https://example.com/photo.jpg" },
    { name = "bg_color", color = "#1a1a2e" }
  }
})

print(result.uid)   -- image UID for polling
print(result.status) -- "pending", "in_progress", or "completed"
```

---

## get_image

Retrieve the status and URL of a previously created image.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `image_id` | string | yes | Image UID from `create_image` |

### Example

```lua
local result = app.integrations.bannerbear.get_image({
  image_id = "01H8ABC..."
})

if result.status == "completed" then
  print(result.image_url)  -- download URL for the generated image
else
  print("Status: " .. result.status)  -- "pending" or "in_progress"
end
```

---

## create_video

Generate a video from a Bannerbear template.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `template_id` | string | yes | Template UID |
| `modifications` | array | yes | Array of modification objects per scene |
| `fps` | integer | no | Frames per second |
| `trim` | string | no | Trim as "start,end" in seconds (e.g., "0,5") |
| `metadata` | string | no | Custom metadata string (max 500 chars) |

### Example

```lua
local result = app.integrations.bannerbear.create_video({
  template_id = "01H8XYZ...",
  modifications = {
    { name = "headline", text = "Welcome!" },
    { name = "background", image_url = "https://example.com/bg.jpg" }
  },
  fps = 30
})

print(result.uid)
```

---

## get_video

Retrieve the status and URL of a previously created video.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `video_id` | string | yes | Video UID from `create_video` |

### Example

```lua
local result = app.integrations.bannerbear.get_video({
  video_id = "01H8DEF..."
})

if result.status == "completed" then
  print(result.video_url)
else
  print("Status: " .. result.status)
end
```

---

## list_templates

List all available Bannerbear templates.

### Parameters

None.

### Example

```lua
local result = app.integrations.bannerbear.list_templates()

for _, tpl in ipairs(result) do
  print(tpl.uid .. " — " .. tpl.name .. " (" .. tpl.width .. "x" .. tpl.height .. ")")
end
```

---

## get_template

Get details and modification layers for a specific template.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `template_id` | string | yes | Template UID |

### Example

```lua
local result = app.integrations.bannerbear.get_template({
  template_id = "01H8XYZ..."
})

print("Template: " .. result.name)
for _, layer in ipairs(result.modification_layers or {}) do
  print("  Layer: " .. layer.name .. " (" .. layer.type .. ")")
end
```

---

## create_animated_gif

Generate an animated GIF from a Bannerbear template.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `template_id` | string | yes | Template UID |
| `modifications` | array | yes | Array of modification objects per frame |
| `fps` | integer | no | Frames per second |
| `metadata` | string | no | Custom metadata string (max 500 chars) |

### Example

```lua
local result = app.integrations.bannerbear.create_animated_gif({
  template_id = "01H8XYZ...",
  modifications = {
    { name = "frame_text", text = "Frame 1" },
    { name = "frame_text", text = "Frame 2" },
    { name = "frame_text", text = "Frame 3" }
  },
  fps = 10
})

print(result.uid)
```

---

## list_images

List previously created Bannerbear images with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (1-based, defaults to 1) |
| `limit` | integer | no | Results per page (defaults to 20) |

### Example

```lua
local result = app.integrations.bannerbear.list_images({
  page = 1,
  limit = 10
})

for _, img in ipairs(result) do
  print(img.uid .. " — " .. img.status)
end
```

---

## list_collections

List Bannerbear collections with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (1-based, defaults to 1) |
| `limit` | integer | no | Results per page (defaults to 20) |

### Example

```lua
local result = app.integrations.bannerbear.list_collections({
  page = 1,
  limit = 10
})

for _, col in ipairs(result) do
  print(col.uid .. " — " .. (col.name or "untitled"))
end
```

---

## get_current_user

Get the authenticated Bannerbear account details.

### Parameters

None.

### Example

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

print("Account: " .. result.name)
print("Email: " .. result.email)
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.bannerbear.function_name({...})

-- Explicit default (portable across setups)
app.integrations.bannerbear.default.function_name({...})

-- Named accounts
app.integrations.bannerbear.production.function_name({...})
app.integrations.bannerbear.staging.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.bannerbear.create_image({template_id = "example_template_id", modifications = "example_modifications", width = 1, height = 1, transparent = true, metadata = "example_metadata"})
print(result)

Functions

create_image Write

Generate an image from a Bannerbear template. Provide a template ID and an array of modifications to customize text, images, colors, and other layers. The image is generated asynchronously — use get_image to check status and retrieve the final URL.

Lua path
app.integrations.bannerbear.create_image
Full name
bannerbear.bannerbear_create_image
ParameterTypeRequiredDescription
template_id string yes The template UID (e.g., "01H8XYZ..."). Use list_templates to find available templates.
modifications array yes Array of modification objects. Each object has a "name" (layer name) and one of: "text" (string), "image_url" (URL), "color" (hex), or "barcode" (string). Example: [{"name": "title", "text": "Hello World"}, {"name": "photo", "image_url": "https://example.com/img.jpg"}].
width integer no Override the template width in pixels.
height integer no Override the template height in pixels.
transparent boolean no Render with a transparent background (PNG only).
metadata string no Custom metadata string to attach to the image (max 500 chars).
get_image Read

Retrieve the status and download URL of a previously created Bannerbear image. Images are generated asynchronously, so poll this endpoint until status is "completed".

Lua path
app.integrations.bannerbear.get_image
Full name
bannerbear.bannerbear_get_image
ParameterTypeRequiredDescription
image_id string yes The image UID returned by create_image.
list_images Read

List previously created Bannerbear images. Returns image UIDs, statuses, and download URLs. Supports pagination via page and limit parameters.

Lua path
app.integrations.bannerbear.list_images
Full name
bannerbear.bannerbear_list_images
ParameterTypeRequiredDescription
page integer no Page number for pagination (1-based). Defaults to 1.
limit integer no Number of results per page. Defaults to 20.
list_collections Read

List Bannerbear collections. Collections are groups of images generated from a single template with different data. Supports pagination via page and limit parameters.

Lua path
app.integrations.bannerbear.list_collections
Full name
bannerbear.bannerbear_list_collections
ParameterTypeRequiredDescription
page integer no Page number for pagination (1-based). Defaults to 1.
limit integer no Number of results per page. Defaults to 20.
create_video Write

Generate a video from a Bannerbear template. Provide a template ID and an array of modifications per scene. The video is generated asynchronously — use get_video to check status and retrieve the final URL.

Lua path
app.integrations.bannerbear.create_video
Full name
bannerbear.bannerbear_create_video
ParameterTypeRequiredDescription
template_id string yes The template UID (e.g., "01H8XYZ..."). Use list_templates to find available templates.
modifications array yes Array of modification objects for scenes. Each scene entry has a "name" (layer name) and one of: "text", "image_url", "color", or "barcode". Pass as JSON or array.
fps integer no Frames per second for the output video (default: template setting).
trim string no Trim the video. Pass as "start,end" in seconds (e.g., "0,5").
metadata string no Custom metadata string to attach (max 500 chars).
get_video Read

Retrieve the status and download URL of a previously created Bannerbear video. Videos are generated asynchronously, so poll this endpoint until status is "completed".

Lua path
app.integrations.bannerbear.get_video
Full name
bannerbear.bannerbear_get_video
ParameterTypeRequiredDescription
video_id string yes The video UID returned by create_video.
list_templates Read

List all available Bannerbear templates. Returns template UIDs, names, dimensions, and preview URLs. Use a template UID with create_image or create_video.

Lua path
app.integrations.bannerbear.list_templates
Full name
bannerbear.bannerbear_list_templates
ParameterTypeRequiredDescription
No parameters.
get_template Read

Get details for a specific Bannerbear template, including all available modification layers (text, image, color, etc.). Use this to discover which layer names to use when calling create_image or create_video.

Lua path
app.integrations.bannerbear.get_template
Full name
bannerbear.bannerbear_get_template
ParameterTypeRequiredDescription
template_id string yes The template UID (e.g., "01H8XYZ..."). Use list_templates to find available templates.
create_animated_gif Write

Generate an animated GIF from a Bannerbear template. Provide a template ID and an array of modifications per frame. The GIF is generated asynchronously — use get_image with the returned ID to check status.

Lua path
app.integrations.bannerbear.create_animated_gif
Full name
bannerbear.bannerbear_create_animated_gif
ParameterTypeRequiredDescription
template_id string yes The template UID (e.g., "01H8XYZ..."). Use list_templates to find available templates.
modifications array yes Array of modification objects per frame. Each entry has a "name" (layer name) and one of: "text", "image_url", "color", or "barcode". Pass as JSON or array.
fps integer no Frames per second for the animated GIF (default: template setting).
metadata string no Custom metadata string to attach (max 500 chars).
get_current_user Read

Get the authenticated Bannerbear account details, including plan info and usage.

Lua path
app.integrations.bannerbear.get_current_user
Full name
bannerbear.bannerbear_get_current_user
ParameterTypeRequiredDescription
No parameters.