KosmoKrator

data

Zoho Inventory Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.zoho_inventory.list_items({page = 1, per_page = 1, status = "example_status"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("zoho-inventory"))' --json
kosmo integrations:lua --eval 'print(docs.read("zoho-inventory.list_items"))' --json

Workflow file

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

workflow.lua
local zoho_inventory = app.integrations.zoho_inventory
local result = zoho_inventory.list_items({page = 1, per_page = 1, status = "example_status"})

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

MCP-only Lua

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

Zoho Inventory — Lua API Reference

list_items

List inventory items (products) from Zoho Inventory.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
per_pageintegernoResults per page, max 200 (default: 25)
statusstringnoFilter by status: active, inactive, all

Examples

-- List first page of active items
local result = app.integrations["zoho-inventory"].zoho_inventory_list_items({
  page = 1,
  per_page = 25,
  status = "active"
})

for _, item in ipairs(result.items or {}) do
  print(item.name .. " — " .. item.sku .. " — stock: " .. (item.actual_available_stock or "0"))
end
-- Paginate through all items
local page = 1
repeat
  local result = app.integrations["zoho-inventory"].zoho_inventory_list_items({ page = page, per_page = 200 })
  for _, item in ipairs(result.items or {}) do
    print(item.item_id .. ": " .. item.name)
  end
  page = (result.page_context or {}).page + 1
until not result.items or #result.items == 0

get_item

Get details of a specific inventory item.

Parameters

NameTypeRequiredDescription
item_idstringyesThe Zoho Inventory item ID

Example

local result = app.integrations["zoho-inventory"].zoho_inventory_get_item({ item_id = "4815162342" })
local item = result.item
print(item.name .. " — " .. item.unit .. " — $" .. item.rate)

list_orders

List sales orders from Zoho Inventory.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
per_pageintegernoResults per page, max 200 (default: 25)
statusstringnoFilter by status: draft, confirmed, void, open, invoiced, partially_invoiced, all

Example

-- List open sales orders
local result = app.integrations["zoho-inventory"].zoho_inventory_list_orders({
  page = 1,
  per_page = 25,
  status = "open"
})

for _, order in ipairs(result.salesorders or {}) do
  print(order.salesorder_number .. " — " .. order.customer_name .. " — $" .. order.total)
end

get_order

Get details of a specific sales order.

Parameters

NameTypeRequiredDescription
order_idstringyesThe Zoho Inventory sales order ID

Example

local result = app.integrations["zoho-inventory"].zoho_inventory_get_order({ order_id = "4815162342" })
local order = result.salesorder
print("Order: " .. order.salesorder_number)
print("Customer: " .. order.customer_name)
print("Total: $" .. order.total)
for _, line in ipairs(order.line_items or {}) do
  print("  " .. line.name .. " x" .. line.quantity .. " = $" .. line.item_total)
end

list_shipments

List shipments from Zoho Inventory.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
per_pageintegernoResults per page, max 200 (default: 25)

Example

local result = app.integrations["zoho-inventory"].zoho_inventory_list_shipments({ page = 1, per_page = 25 })

for _, shipment in ipairs(result.shipments or {}) do
  print(shipment.shipment_id .. " — " .. (shipment.status or "unknown"))
end

list_packages

List packages from Zoho Inventory.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default: 1)
per_pageintegernoResults per page, max 200 (default: 25)

Example

local result = app.integrations["zoho-inventory"].zoho_inventory_list_packages({ page = 1, per_page = 25 })

for _, pkg in ipairs(result.packages or {}) do
  print(pkg.package_id .. " — " .. (pkg.status or "unknown"))
end

get_current_user

Get the currently authenticated Zoho Inventory user.

Parameters

None.

Example

local result = app.integrations["zoho-inventory"].zoho_inventory_get_current_user({})
local user = result.user
print("Logged in as: " .. user.name .. " (" .. user.email .. ")")

Multi-Account Usage

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

-- Default account (always works)
app.integrations["zoho-inventory"].zoho_inventory_list_items({...})

-- Explicit default (portable across setups)
app.integrations["zoho-inventory"].default.zoho_inventory_list_items({...})

-- Named accounts
app.integrations["zoho-inventory"].warehouse_us.zoho_inventory_list_items({...})
app.integrations["zoho-inventory"].warehouse_eu.zoho_inventory_list_orders({...})

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

Raw agent markdown
# Zoho Inventory — Lua API Reference

## list_items

List inventory items (products) from Zoho Inventory.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page, max 200 (default: 25) |
| `status` | string | no | Filter by status: `active`, `inactive`, `all` |

### Examples

```lua
-- List first page of active items
local result = app.integrations["zoho-inventory"].zoho_inventory_list_items({
  page = 1,
  per_page = 25,
  status = "active"
})

for _, item in ipairs(result.items or {}) do
  print(item.name .. " — " .. item.sku .. " — stock: " .. (item.actual_available_stock or "0"))
end
```

```lua
-- Paginate through all items
local page = 1
repeat
  local result = app.integrations["zoho-inventory"].zoho_inventory_list_items({ page = page, per_page = 200 })
  for _, item in ipairs(result.items or {}) do
    print(item.item_id .. ": " .. item.name)
  end
  page = (result.page_context or {}).page + 1
until not result.items or #result.items == 0
```

---

## get_item

Get details of a specific inventory item.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `item_id` | string | yes | The Zoho Inventory item ID |

### Example

```lua
local result = app.integrations["zoho-inventory"].zoho_inventory_get_item({ item_id = "4815162342" })
local item = result.item
print(item.name .. " — " .. item.unit .. " — $" .. item.rate)
```

---

## list_orders

List sales orders from Zoho Inventory.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page, max 200 (default: 25) |
| `status` | string | no | Filter by status: `draft`, `confirmed`, `void`, `open`, `invoiced`, `partially_invoiced`, `all` |

### Example

```lua
-- List open sales orders
local result = app.integrations["zoho-inventory"].zoho_inventory_list_orders({
  page = 1,
  per_page = 25,
  status = "open"
})

for _, order in ipairs(result.salesorders or {}) do
  print(order.salesorder_number .. " — " .. order.customer_name .. " — $" .. order.total)
end
```

---

## get_order

Get details of a specific sales order.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `order_id` | string | yes | The Zoho Inventory sales order ID |

### Example

```lua
local result = app.integrations["zoho-inventory"].zoho_inventory_get_order({ order_id = "4815162342" })
local order = result.salesorder
print("Order: " .. order.salesorder_number)
print("Customer: " .. order.customer_name)
print("Total: $" .. order.total)
for _, line in ipairs(order.line_items or {}) do
  print("  " .. line.name .. " x" .. line.quantity .. " = $" .. line.item_total)
end
```

---

## list_shipments

List shipments from Zoho Inventory.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page, max 200 (default: 25) |

### Example

```lua
local result = app.integrations["zoho-inventory"].zoho_inventory_list_shipments({ page = 1, per_page = 25 })

for _, shipment in ipairs(result.shipments or {}) do
  print(shipment.shipment_id .. " — " .. (shipment.status or "unknown"))
end
```

---

## list_packages

List packages from Zoho Inventory.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page, max 200 (default: 25) |

### Example

```lua
local result = app.integrations["zoho-inventory"].zoho_inventory_list_packages({ page = 1, per_page = 25 })

for _, pkg in ipairs(result.packages or {}) do
  print(pkg.package_id .. " — " .. (pkg.status or "unknown"))
end
```

---

## get_current_user

Get the currently authenticated Zoho Inventory user.

### Parameters

None.

### Example

```lua
local result = app.integrations["zoho-inventory"].zoho_inventory_get_current_user({})
local user = result.user
print("Logged in as: " .. user.name .. " (" .. user.email .. ")")
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations["zoho-inventory"].zoho_inventory_list_items({...})

-- Explicit default (portable across setups)
app.integrations["zoho-inventory"].default.zoho_inventory_list_items({...})

-- Named accounts
app.integrations["zoho-inventory"].warehouse_us.zoho_inventory_list_items({...})
app.integrations["zoho-inventory"].warehouse_eu.zoho_inventory_list_orders({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.zoho_inventory.list_items({page = 1, per_page = 1, status = "example_status"})
print(result)

Functions

list_items Read

List inventory items (products) from Zoho Inventory. Supports pagination and optional filtering by status (active, inactive, all).

Lua path
app.integrations.zoho_inventory.list_items
Full name
zoho-inventory.zoho_inventory_list_items
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of items per page, max 200 (default: 25).
status string no Filter by item status: active, inactive, all.
get_item Read

Get detailed information about a specific inventory item (product) by its Zoho Inventory ID.

Lua path
app.integrations.zoho_inventory.get_item
Full name
zoho-inventory.zoho_inventory_get_item
ParameterTypeRequiredDescription
item_id string yes The Zoho Inventory item ID.
list_sales_orders Read

List sales orders from Zoho Inventory. Supports pagination and optional filtering by status (draft, confirmed, void, open, invoiced, partially_invoiced, all).

Lua path
app.integrations.zoho_inventory.list_sales_orders
Full name
zoho-inventory.zoho_inventory_list_orders
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of orders per page, max 200 (default: 25).
status string no Filter by order status: draft, confirmed, void, open, invoiced, partially_invoiced, all.
get_sales_order Read

Get detailed information about a specific sales order by its Zoho Inventory ID.

Lua path
app.integrations.zoho_inventory.get_sales_order
Full name
zoho-inventory.zoho_inventory_get_order
ParameterTypeRequiredDescription
order_id string yes The Zoho Inventory sales order ID.
list_shipments Read

List shipments from Zoho Inventory. Supports pagination to browse through shipment records.

Lua path
app.integrations.zoho_inventory.list_shipments
Full name
zoho-inventory.zoho_inventory_list_shipments
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of shipments per page, max 200 (default: 25).
list_packages Read

List packages from Zoho Inventory. Supports pagination to browse through package records.

Lua path
app.integrations.zoho_inventory.list_packages
Full name
zoho-inventory.zoho_inventory_list_packages
ParameterTypeRequiredDescription
page integer no Page number for pagination (default: 1).
per_page integer no Number of packages per page, max 200 (default: 25).
get_current_user Read

Get details of the currently authenticated Zoho Inventory user. Useful for verifying credentials and checking permissions.

Lua path
app.integrations.zoho_inventory.get_current_user
Full name
zoho-inventory.zoho_inventory_get_current_user
ParameterTypeRequiredDescription
No parameters.