KosmoKrator

productivity

Sellfy Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.sellfy.list_products({page_size = 1, page = 1}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("sellfy"))' --json
kosmo integrations:lua --eval 'print(docs.read("sellfy.list_products"))' --json

Workflow file

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

workflow.lua
local sellfy = app.integrations.sellfy
local result = sellfy.list_products({page_size = 1, page = 1})

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

MCP-only Lua

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

Sellfy — Lua API Reference

list_products

List all products in your Sellfy store.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of products per page (default: 10)
pageintegernoPage number for pagination (default: 1)

Example

local result = app.integrations["sellfy"].list_products({
  page_size = 20,
  page = 1
})

for _, product in ipairs(result.products) do
  print(product.name .. " - " .. product.price)
end

get_product

Get details for a specific product by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe product ID

Example

local result = app.integrations["sellfy"].get_product({
  id = "12345"
})

print(result.name)
print(result.status)

create_product

Create a new product in your Sellfy store.

Parameters

NameTypeRequiredDescription
namestringyesThe product name
pricenumberyesThe product price
typestringnoProduct type: “digital”, “subscription”, or “physical”. Default: “digital”
descriptionstringnoProduct description
currencystringnoCurrency code (e.g., “USD”, “EUR”)

Example

local result = app.integrations["sellfy"].create_product({
  name = "My eBook",
  price = 9.99,
  type = "digital",
  description = "A comprehensive guide to selling digital products",
  currency = "USD"
})

print("Created product: " .. result.id)

list_orders

List all orders in your Sellfy store.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of orders per page (default: 10)
pageintegernoPage number for pagination (default: 1)

Example

local result = app.integrations["sellfy"].list_orders({
  page_size = 25,
  page = 1
})

for _, order in ipairs(result.orders) do
  print(order.id .. ": " .. order.total .. " " .. order.currency)
end

get_order

Get details for a specific order by ID.

Parameters

NameTypeRequiredDescription
idstringyesThe order ID

Example

local result = app.integrations["sellfy"].get_order({
  id = "67890"
})

print(result.id)
print(result.status)
print("Total: " .. result.total)

list_customers

List all customers in your Sellfy store.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of customers per page (default: 10)
pageintegernoPage number for pagination (default: 1)

Example

local result = app.integrations["sellfy"].list_customers({
  page_size = 50
})

for _, customer in ipairs(result.customers) do
  print(customer.name .. " (" .. customer.email .. ")")
end

get_current_user

Get the currently authenticated Sellfy user profile.

Parameters

None.

Example

local result = app.integrations["sellfy"].get_current_user({})

print(result.name)
print(result.email)

Multi-Account Usage

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

-- Default account (always works)
app.integrations["sellfy"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["sellfy"].default.function_name({...})

-- Named accounts
app.integrations["sellfy"].work.function_name({...})
app.integrations["sellfy"].personal.function_name({...})

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

Raw agent markdown
# Sellfy — Lua API Reference

## list_products

List all products in your Sellfy store.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of products per page (default: 10) |
| `page` | integer | no | Page number for pagination (default: 1) |

### Example

```lua
local result = app.integrations["sellfy"].list_products({
  page_size = 20,
  page = 1
})

for _, product in ipairs(result.products) do
  print(product.name .. " - " .. product.price)
end
```

---

## get_product

Get details for a specific product by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The product ID |

### Example

```lua
local result = app.integrations["sellfy"].get_product({
  id = "12345"
})

print(result.name)
print(result.status)
```

---

## create_product

Create a new product in your Sellfy store.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | The product name |
| `price` | number | yes | The product price |
| `type` | string | no | Product type: "digital", "subscription", or "physical". Default: "digital" |
| `description` | string | no | Product description |
| `currency` | string | no | Currency code (e.g., "USD", "EUR") |

### Example

```lua
local result = app.integrations["sellfy"].create_product({
  name = "My eBook",
  price = 9.99,
  type = "digital",
  description = "A comprehensive guide to selling digital products",
  currency = "USD"
})

print("Created product: " .. result.id)
```

---

## list_orders

List all orders in your Sellfy store.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of orders per page (default: 10) |
| `page` | integer | no | Page number for pagination (default: 1) |

### Example

```lua
local result = app.integrations["sellfy"].list_orders({
  page_size = 25,
  page = 1
})

for _, order in ipairs(result.orders) do
  print(order.id .. ": " .. order.total .. " " .. order.currency)
end
```

---

## get_order

Get details for a specific order by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The order ID |

### Example

```lua
local result = app.integrations["sellfy"].get_order({
  id = "67890"
})

print(result.id)
print(result.status)
print("Total: " .. result.total)
```

---

## list_customers

List all customers in your Sellfy store.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of customers per page (default: 10) |
| `page` | integer | no | Page number for pagination (default: 1) |

### Example

```lua
local result = app.integrations["sellfy"].list_customers({
  page_size = 50
})

for _, customer in ipairs(result.customers) do
  print(customer.name .. " (" .. customer.email .. ")")
end
```

---

## get_current_user

Get the currently authenticated Sellfy user profile.

### Parameters

None.

### Example

```lua
local result = app.integrations["sellfy"].get_current_user({})

print(result.name)
print(result.email)
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations["sellfy"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["sellfy"].default.function_name({...})

-- Named accounts
app.integrations["sellfy"].work.function_name({...})
app.integrations["sellfy"].personal.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.sellfy.list_products({page_size = 1, page = 1})
print(result)

Functions

list_products Read

List all products in your Sellfy store. Returns product names, prices, and status.

Lua path
app.integrations.sellfy.list_products
Full name
sellfy.sellfy_list_products
ParameterTypeRequiredDescription
page_size integer no Number of products per page (default: 10).
page integer no Page number for pagination (default: 1).
get_product Read

Get details for a specific Sellfy product by ID. Returns full product information including pricing, description, and status.

Lua path
app.integrations.sellfy.get_product
Full name
sellfy.sellfy_get_product
ParameterTypeRequiredDescription
id string yes The product ID.
create_product Write

Create a new product in your Sellfy store. Supports digital products, subscriptions, and physical goods.

Lua path
app.integrations.sellfy.create_product
Full name
sellfy.sellfy_create_product
ParameterTypeRequiredDescription
name string yes The product name.
price number yes The product price.
type string no Product type (e.g., "digital", "subscription", "physical"). Default: "digital".
description string no Product description.
currency string no Currency code (e.g., "USD", "EUR"). Default: store default.
list_orders Read

List all orders in your Sellfy store. Returns order details including status, totals, and customer info.

Lua path
app.integrations.sellfy.list_orders
Full name
sellfy.sellfy_list_orders
ParameterTypeRequiredDescription
page_size integer no Number of orders per page (default: 10).
page integer no Page number for pagination (default: 1).
get_order Read

Get details for a specific Sellfy order by ID. Returns full order information including line items, totals, and customer data.

Lua path
app.integrations.sellfy.get_order
Full name
sellfy.sellfy_get_order
ParameterTypeRequiredDescription
id string yes The order ID.
list_customers Read

List all customers in your Sellfy store. Returns customer names, emails, and purchase history.

Lua path
app.integrations.sellfy.list_customers
Full name
sellfy.sellfy_list_customers
ParameterTypeRequiredDescription
page_size integer no Number of customers per page (default: 10).
page integer no Page number for pagination (default: 1).
get_current_user Read

Get the currently authenticated Sellfy user profile. Useful for verifying API credentials and viewing account info.

Lua path
app.integrations.sellfy.get_current_user
Full name
sellfy.sellfy_get_current_user
ParameterTypeRequiredDescription
No parameters.