data
Zoho Invoice Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Zoho Invoice KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.zoho_invoice.*.
Use lua_read_doc("integrations.zoho-invoice") 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 Invoice workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.zoho_invoice.zohoinvoice_list({status = "example_status", customer_id = "example_customer_id", date_start = "example_date_start", date_end = "example_date_end", page = 1, per_page = 1, sort_column = "example_sort_column", sort_order = "example_sort_order"}))' --json kosmo integrations:lua --eval 'print(docs.read("zoho-invoice"))' --json
kosmo integrations:lua --eval 'print(docs.read("zoho-invoice.zohoinvoice_list"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local zoho_invoice = app.integrations.zoho_invoice
local result = zoho_invoice.zohoinvoice_list({status = "example_status", customer_id = "example_customer_id", date_start = "example_date_start", date_end = "example_date_end", page = 1, per_page = 1, sort_column = "example_sort_column", sort_order = "example_sort_order"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.zoho_invoice, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.zoho_invoice.default.* or app.integrations.zoho_invoice.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Zoho Invoice, use the narrower 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 Invoice — Lua API Reference
Common Workflows
Create an invoice for a customer
-- Step 1: Find the customer
local contacts = app.integrations["zoho-invoice"].zohoinvoice_list_contacts({
search_text = "Acme Corp"
})
local customer_id = contacts.contacts[1].contact_id
-- Step 2: Find items to add
local items = app.integrations["zoho-invoice"].zohoinvoice_list_items({
search_text = "Consulting"
})
local item_id = items.items[1].item_id
-- Step 3: Create the invoice
local invoice = app.integrations["zoho-invoice"].zohoinvoice_create_invoice({
customer_id = customer_id,
line_items = {
{
item_id = item_id,
quantity = 10
}
},
date = "2025-01-15",
due_date = "2025-02-15",
notes = "Thank you for your business!"
})
print("Invoice created: " .. invoice.invoice.invoice_id)
print("Total: " .. invoice.invoice.total)
List overdue invoices
local result = app.integrations["zoho-invoice"].zohoinvoice_list_invoices({
status = "overdue",
sort_column = "date",
sort_order = "ascending"
})
for _, inv in ipairs(result.invoices) do
print(inv.invoice_number .. " - " .. inv.customer_name .. " - " .. inv.balance)
end
Get payments for a date range
local payments = app.integrations["zoho-invoice"].zohoinvoice_list_payments({
date_start = "2025-01-01",
date_end = "2025-01-31"
})
local total = 0
for _, payment in ipairs(payments.payments) do
total = total + tonumber(payment.amount)
print(payment.date .. " - " .. payment.customer_name .. " - " .. payment.amount)
end
print("Total received: " .. total)
Check your connection
local user = app.integrations["zoho-invoice"].zohoinvoice_get_current_user({})
print("Connected as: " .. user.user.name .. " (" .. user.user.email .. ")")
Invoice Statuses
| Status | Description |
|---|---|
draft | Invoice is in draft state |
sent | Invoice has been sent to the customer |
overdue | Payment is past the due date |
paid | Invoice has been fully paid |
void | Invoice has been voided |
partially_paid | Invoice has been partially paid |
Contact Types
| Type | Description |
|---|---|
customer | Customer contacts |
vendor | Vendor contacts |
Item Types
| Type | Description |
|---|---|
goods | Physical products |
service | Service items |
Line Item Format
When creating invoices, each line item should include:
{
item_id = "1234567890", -- Required: use item_id from list_items, or provide name + rate
quantity = 1, -- Quantity (default: 1)
rate = 100.00, -- Override rate (optional if item_id has a default rate)
description = "Custom description" -- Optional override
}
Alternatively, create line items without an existing item:
{
name = "Custom Service",
description = "One-time custom work",
rate = 150.00,
quantity = 5
}
Pagination
All list endpoints support page and per_page parameters:
local result = app.integrations["zoho-invoice"].zohoinvoice_list_invoices({
page = 2,
per_page = 50
})
Multi-Account Usage
If you have multiple Zoho Invoice accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations["zoho-invoice"].zohoinvoice_list_invoices({})
-- Explicit default (portable across setups)
app.integrations["zoho-invoice"].default.zohoinvoice_list_invoices({})
-- Named accounts
app.integrations["zoho-invoice"].work.zohoinvoice_list_invoices({})
app.integrations["zoho-invoice"].personal.zohoinvoice_list_invoices({})
All functions are identical across accounts — only the credentials differ.
Notes
- The Organization ID is required for most API calls. Set it in the integration settings.
- Date formats use ISO 8601 (YYYY-MM-DD).
- The base URL varies by region — make sure to configure the correct one for your Zoho account.
- Rate limits: 100 requests per minute per organization.
Raw agent markdown
# Zoho Invoice — Lua API Reference
## Common Workflows
### Create an invoice for a customer
```lua
-- Step 1: Find the customer
local contacts = app.integrations["zoho-invoice"].zohoinvoice_list_contacts({
search_text = "Acme Corp"
})
local customer_id = contacts.contacts[1].contact_id
-- Step 2: Find items to add
local items = app.integrations["zoho-invoice"].zohoinvoice_list_items({
search_text = "Consulting"
})
local item_id = items.items[1].item_id
-- Step 3: Create the invoice
local invoice = app.integrations["zoho-invoice"].zohoinvoice_create_invoice({
customer_id = customer_id,
line_items = {
{
item_id = item_id,
quantity = 10
}
},
date = "2025-01-15",
due_date = "2025-02-15",
notes = "Thank you for your business!"
})
print("Invoice created: " .. invoice.invoice.invoice_id)
print("Total: " .. invoice.invoice.total)
```
### List overdue invoices
```lua
local result = app.integrations["zoho-invoice"].zohoinvoice_list_invoices({
status = "overdue",
sort_column = "date",
sort_order = "ascending"
})
for _, inv in ipairs(result.invoices) do
print(inv.invoice_number .. " - " .. inv.customer_name .. " - " .. inv.balance)
end
```
### Get payments for a date range
```lua
local payments = app.integrations["zoho-invoice"].zohoinvoice_list_payments({
date_start = "2025-01-01",
date_end = "2025-01-31"
})
local total = 0
for _, payment in ipairs(payments.payments) do
total = total + tonumber(payment.amount)
print(payment.date .. " - " .. payment.customer_name .. " - " .. payment.amount)
end
print("Total received: " .. total)
```
### Check your connection
```lua
local user = app.integrations["zoho-invoice"].zohoinvoice_get_current_user({})
print("Connected as: " .. user.user.name .. " (" .. user.user.email .. ")")
```
## Invoice Statuses
| Status | Description |
|--------|-------------|
| `draft` | Invoice is in draft state |
| `sent` | Invoice has been sent to the customer |
| `overdue` | Payment is past the due date |
| `paid` | Invoice has been fully paid |
| `void` | Invoice has been voided |
| `partially_paid` | Invoice has been partially paid |
## Contact Types
| Type | Description |
|------|-------------|
| `customer` | Customer contacts |
| `vendor` | Vendor contacts |
## Item Types
| Type | Description |
|------|-------------|
| `goods` | Physical products |
| `service` | Service items |
## Line Item Format
When creating invoices, each line item should include:
```lua
{
item_id = "1234567890", -- Required: use item_id from list_items, or provide name + rate
quantity = 1, -- Quantity (default: 1)
rate = 100.00, -- Override rate (optional if item_id has a default rate)
description = "Custom description" -- Optional override
}
```
Alternatively, create line items without an existing item:
```lua
{
name = "Custom Service",
description = "One-time custom work",
rate = 150.00,
quantity = 5
}
```
## Pagination
All list endpoints support `page` and `per_page` parameters:
```lua
local result = app.integrations["zoho-invoice"].zohoinvoice_list_invoices({
page = 2,
per_page = 50
})
```
## Multi-Account Usage
If you have multiple Zoho Invoice accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations["zoho-invoice"].zohoinvoice_list_invoices({})
-- Explicit default (portable across setups)
app.integrations["zoho-invoice"].default.zohoinvoice_list_invoices({})
-- Named accounts
app.integrations["zoho-invoice"].work.zohoinvoice_list_invoices({})
app.integrations["zoho-invoice"].personal.zohoinvoice_list_invoices({})
```
All functions are identical across accounts — only the credentials differ.
## Notes
- The Organization ID is required for most API calls. Set it in the integration settings.
- Date formats use ISO 8601 (YYYY-MM-DD).
- The base URL varies by region — make sure to configure the correct one for your Zoho account.
- Rate limits: 100 requests per minute per organization. local result = app.integrations.zoho_invoice.zohoinvoice_list({status = "example_status", customer_id = "example_customer_id", date_start = "example_date_start", date_end = "example_date_end", page = 1, per_page = 1, sort_column = "example_sort_column", sort_order = "example_sort_order"})
print(result) Functions
zohoinvoice_list Read
List invoices from Zoho Invoice. Supports filtering by status (draft, sent, overdue, paid, void, partially_paid), customer, and date range.
- Lua path
app.integrations.zoho_invoice.zohoinvoice_list- Full name
zoho-invoice.zohoinvoice_list_invoices
| Parameter | Type | Required | Description |
|---|---|---|---|
status | string | no | Filter by invoice status: draft, sent, overdue, paid, void, partially_paid. |
customer_id | string | no | Filter invoices for a specific customer by their contact ID. |
date_start | string | no | Start date for filtering (ISO 8601, e.g., "2025-01-01"). |
date_end | string | no | End date for filtering (ISO 8601, e.g., "2025-12-31"). |
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of invoices per page (default: 25, max: 200). |
sort_column | string | no | Column to sort by: date, total, balance, created_time. |
sort_order | string | no | Sort direction: ascending or descending. |
zohoinvoice_get Read
Get full details of a single invoice by its ID, including line items, totals, payments, and notes.
- Lua path
app.integrations.zoho_invoice.zohoinvoice_get- Full name
zoho-invoice.zohoinvoice_get_invoice
| Parameter | Type | Required | Description |
|---|---|---|---|
invoice_id | string | yes | The unique ID of the invoice. |
zohoinvoice_create Write
Create a new invoice in Zoho Invoice. Requires at minimum a customer_id and one line item. Returns the created invoice with its ID and total.
- Lua path
app.integrations.zoho_invoice.zohoinvoice_create- Full name
zoho-invoice.zohoinvoice_create_invoice
| Parameter | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | The contact ID of the customer to invoice. |
line_items | array | yes | Array of line items. Each item should have "item_id" or "name" and "rate" and "quantity". |
invoice_number | string | no | Custom invoice number (auto-generated if omitted). |
date | string | no | Invoice date (ISO 8601, e.g., "2025-01-15"). Defaults to today. |
due_date | string | no | Payment due date (ISO 8601, e.g., "2025-02-15"). |
notes | string | no | Notes to display on the invoice. |
terms | string | no | Terms and conditions for the invoice. |
reference_number | string | no | Reference number for internal tracking. |
zohoinvoice_list_contacts Read
List contacts (customers and vendors) from Zoho Invoice. Supports filtering by type (customer or vendor) and pagination.
- Lua path
app.integrations.zoho_invoice.zohoinvoice_list_contacts- Full name
zoho-invoice.zohoinvoice_list_contacts
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | no | Filter by contact type. |
status | string | no | Filter by status: active, inactive, draft, or archived. |
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of contacts per page (default: 25, max: 200). |
search_text | string | no | Search contacts by name or email. |
zohoinvoice_list_items Read
List items (products and services) from Zoho Invoice. Use item IDs when creating invoices with line items.
- Lua path
app.integrations.zoho_invoice.zohoinvoice_list_items- Full name
zoho-invoice.zohoinvoice_list_items
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | no | Filter by item type. |
status | string | no | Filter by status: active or inactive. |
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of items per page (default: 25, max: 200). |
search_text | string | no | Search items by name or description. |
zohoinvoice_list_payments Read
List payments received in Zoho Invoice. Supports filtering by customer, date range, and payment mode.
- Lua path
app.integrations.zoho_invoice.zohoinvoice_list_payments- Full name
zoho-invoice.zohoinvoice_list_payments
| Parameter | Type | Required | Description |
|---|---|---|---|
customer_id | string | no | Filter payments for a specific customer by their contact ID. |
date_start | string | no | Start date for filtering (ISO 8601, e.g., "2025-01-01"). |
date_end | string | no | End date for filtering (ISO 8601, e.g., "2025-12-31"). |
payment_mode | string | no | Filter by payment mode: cash, check, bank_transfer, credit_card, etc. |
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of payments per page (default: 25, max: 200). |
zohoinvoice_get_current_user Read
Get the authenticated user's profile from Zoho Invoice, including name, email, and role.
- Lua path
app.integrations.zoho_invoice.zohoinvoice_get_current_user- Full name
zoho-invoice.zohoinvoice_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||