KosmoKrator

media

Bannerbear Lua API for KosmoKrator Agents

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

10 functions 7 read 3 write API key auth

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.

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.bannerbear_create_image({
  template_id = "example_template_id",
  modifications = "example_modifications",
  width = 1,
  height = 1,
  transparent = true,
  metadata = "example_metadata"
})
print(result)

Functions

bannerbear_create_image

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.

Operation
Write write
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).

bannerbear_get_image

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

Operation
Read read
Full name
bannerbear.bannerbear_get_image
ParameterTypeRequiredDescription
image_id string yes The image UID returned by create_image.

bannerbear_list_images

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

Operation
Read read
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.

bannerbear_list_collections

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

Operation
Read read
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.

bannerbear_create_video

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.

Operation
Write write
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).

bannerbear_get_video

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

Operation
Read read
Full name
bannerbear.bannerbear_get_video
ParameterTypeRequiredDescription
video_id string yes The video UID returned by create_video.

bannerbear_list_templates

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

Operation
Read read
Full name
bannerbear.bannerbear_list_templates
ParameterTypeRequiredDescription
No parameters.

bannerbear_get_template

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.

Operation
Read read
Full name
bannerbear.bannerbear_get_template
ParameterTypeRequiredDescription
template_id string yes The template UID (e.g., "01H8XYZ..."). Use list_templates to find available templates.

bannerbear_create_animated_gif

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.

Operation
Write write
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).

bannerbear_get_current_user

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

Operation
Read read
Full name
bannerbear.bannerbear_get_current_user
ParameterTypeRequiredDescription
No parameters.