KosmoKrator

data

Brandfetch Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.brandfetch.get({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("brandfetch"))' --json
kosmo integrations:lua --eval 'print(docs.read("brandfetch.get"))' --json

Workflow file

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

workflow.lua
local brandfetch = app.integrations.brandfetch
local result = brandfetch.get({})

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.brandfetch, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.brandfetch.default.* or app.integrations.brandfetch.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Brandfetch, 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.

Brandfetch Lua API Reference

Namespace: app.integrations.brandfetch

This integration targets Brandfetch’s current APIs:

  • Brand API at https://api.brandfetch.io/v2/brands/...
  • Brand Search API at https://api.brandfetch.io/v2/search/...
  • Transaction API at https://api.brandfetch.io/v2/brands/transaction
  • Logo API CDN URLs at https://cdn.brandfetch.io/...

Examples

Get a brand by explicit domain:

local brand = app.integrations.brandfetch.get_brand_by_domain({
  domain = "brandfetch.com"
})

Search brands:

local results = app.integrations.brandfetch.search_brands({
  query = "Nike"
})

Enrich a transaction:

local merchant = app.integrations.brandfetch.enrich_transaction({
  transactionLabel = "STARBUCKS 1523 OMAHA NE",
  countryCode = "US"
})

Build a logo URL:

local logo = app.integrations.brandfetch.logo_url({
  identifier = "nike.com",
  options = {
    width = 400,
    height = 400,
    theme = "dark",
    type = "icon"
  }
})

Raw API Helpers

local result = app.integrations.brandfetch.api_get({
  path = "/v2/brands/domain/brandfetch.com"
})

Raw helper paths must be relative. Absolute URLs and parent-directory paths are rejected.

Raw agent markdown
# Brandfetch Lua API Reference

Namespace: `app.integrations.brandfetch`

This integration targets Brandfetch's current APIs:

- Brand API at `https://api.brandfetch.io/v2/brands/...`
- Brand Search API at `https://api.brandfetch.io/v2/search/...`
- Transaction API at `https://api.brandfetch.io/v2/brands/transaction`
- Logo API CDN URLs at `https://cdn.brandfetch.io/...`

## Examples

Get a brand by explicit domain:

```lua
local brand = app.integrations.brandfetch.get_brand_by_domain({
  domain = "brandfetch.com"
})
```

Search brands:

```lua
local results = app.integrations.brandfetch.search_brands({
  query = "Nike"
})
```

Enrich a transaction:

```lua
local merchant = app.integrations.brandfetch.enrich_transaction({
  transactionLabel = "STARBUCKS 1523 OMAHA NE",
  countryCode = "US"
})
```

Build a logo URL:

```lua
local logo = app.integrations.brandfetch.logo_url({
  identifier = "nike.com",
  options = {
    width = 400,
    height = 400,
    theme = "dark",
    type = "icon"
  }
})
```

## Raw API Helpers

```lua
local result = app.integrations.brandfetch.api_get({
  path = "/v2/brands/domain/brandfetch.com"
})
```

Raw helper paths must be relative. Absolute URLs and parent-directory paths are
rejected.
Metadata-derived Lua example
local result = app.integrations.brandfetch.get({})
print(result)

Functions

get Read

Get brand data by generic identifier.

Lua path
app.integrations.brandfetch.get
Full name
brandfetch.brandfetch_get_brand
ParameterTypeRequiredDescription
No parameters.
get_by_domain Read

Get brand data by explicit domain route.

Lua path
app.integrations.brandfetch.get_by_domain
Full name
brandfetch.brandfetch_get_brand_by_domain
ParameterTypeRequiredDescription
No parameters.
get_by_ticker Read

Get brand data by explicit ticker route.

Lua path
app.integrations.brandfetch.get_by_ticker
Full name
brandfetch.brandfetch_get_brand_by_ticker
ParameterTypeRequiredDescription
No parameters.
get_by_isin Read

Get brand data by explicit ISIN route.

Lua path
app.integrations.brandfetch.get_by_isin
Full name
brandfetch.brandfetch_get_brand_by_isin
ParameterTypeRequiredDescription
No parameters.
get_by_crypto Read

Get brand data by explicit crypto route.

Lua path
app.integrations.brandfetch.get_by_crypto
Full name
brandfetch.brandfetch_get_brand_by_crypto
ParameterTypeRequiredDescription
No parameters.
enrich_transaction Write

Turn raw payment transaction text into merchant brand data.

Lua path
app.integrations.brandfetch.enrich_transaction
Full name
brandfetch.brandfetch_enrich_transaction
ParameterTypeRequiredDescription
No parameters.
logo_url Read

Build a Logo API CDN URL with transformations.

Lua path
app.integrations.brandfetch.logo_url
Full name
brandfetch.brandfetch_logo_url
ParameterTypeRequiredDescription
No parameters.
list_logos Read

Fetch a brand and return logos.

Lua path
app.integrations.brandfetch.list_logos
Full name
brandfetch.brandfetch_list_logos
ParameterTypeRequiredDescription
No parameters.
list_colors Read

Fetch a brand and return colors.

Lua path
app.integrations.brandfetch.list_colors
Full name
brandfetch.brandfetch_list_colors
ParameterTypeRequiredDescription
No parameters.
list_fonts Read

Fetch a brand and return fonts.

Lua path
app.integrations.brandfetch.list_fonts
Full name
brandfetch.brandfetch_list_fonts
ParameterTypeRequiredDescription
No parameters.
verify_credentials Read

Verify Brand API credentials with the Brandfetch test brand.

Lua path
app.integrations.brandfetch.verify_credentials
Full name
brandfetch.brandfetch_get_current_user
ParameterTypeRequiredDescription
No parameters.
api_get Read

Call a safe relative Brandfetch API path with GET.

Lua path
app.integrations.brandfetch.api_get
Full name
brandfetch.brandfetch_api_get
ParameterTypeRequiredDescription
No parameters.
api_post Write

Call a safe relative Brandfetch API path with POST.

Lua path
app.integrations.brandfetch.api_post
Full name
brandfetch.brandfetch_api_post
ParameterTypeRequiredDescription
No parameters.