data
Netsuite Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Netsuite KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.netsuite.*.
Use lua_read_doc("integrations.netsuite") 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
Netsuite workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.netsuite.list_customers({limit = 1, offset = 1}))' --json kosmo integrations:lua --eval 'print(docs.read("netsuite"))' --json
kosmo integrations:lua --eval 'print(docs.read("netsuite.list_customers"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local netsuite = app.integrations.netsuite
local result = netsuite.list_customers({limit = 1, offset = 1})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.netsuite, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.netsuite.default.* or app.integrations.netsuite.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Netsuite, 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.
NetSuite ERP — Lua API Reference
list_customers
List customers from NetSuite ERP.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of customers to return (default: 50, max: 1000) |
offset | integer | no | Zero-based offset for pagination |
Example
local result = app.integrations.netsuite.list_customers({
limit = 10,
offset = 0
})
for _, customer in ipairs(result.items) do
print(customer.id .. ": " .. (customer.companyname or customer.entityid))
end
get_customer
Get detailed information for a single customer.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | yes | The internal ID of the customer in NetSuite |
Example
local result = app.integrations.netsuite.get_customer({
id = "12345"
})
print("Company: " .. result.companyname)
print("Email: " .. (result.email or "N/A"))
print("Phone: " .. (result.phone or "N/A"))
create_customer
Create a new customer in NetSuite.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
companyname | string | no* | Company name (required for company customers) |
firstname | string | no* | First name (required for individual customers) |
lastname | string | no* | Last name (required for individual customers) |
email | string | no | Primary email address |
phone | string | no | Primary phone number |
subsidiary | string | no | Subsidiary internal ID (required for OneWorld accounts) |
entitystatus | string | no | Customer status reference |
currency | string | no | Currency internal ID |
terms | string | no | Payment terms reference |
addressbook | array | no | Array of address objects |
*Either companyname or lastname is required.
Example
local result = app.integrations.netsuite.create_customer({
companyname = "Acme Corp",
email = "billing@acme.com",
phone = "+1-555-0123",
currency = "1",
terms = "2"
})
print("Created customer: " .. result.id)
list_invoices
List invoices from NetSuite ERP.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of invoices to return (default: 50, max: 1000) |
offset | integer | no | Zero-based offset for pagination |
Example
local result = app.integrations.netsuite.list_invoices({
limit = 20,
offset = 0
})
for _, invoice in ipairs(result.items) do
print(invoice.tranid .. ": $" .. (invoice.amountremaining or invoice.total))
end
list_sales_orders
List sales orders from NetSuite ERP.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of sales orders to return (default: 50, max: 1000) |
offset | integer | no | Zero-based offset for pagination |
Example
local result = app.integrations.netsuite.list_sales_orders({
limit = 20,
offset = 0
})
for _, order in ipairs(result.items) do
print(order.tranid .. ": " .. (order.status or "Unknown"))
end
list_items
List items (products and services) from NetSuite ERP.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of items to return (default: 50, max: 1000) |
offset | integer | no | Zero-based offset for pagination |
Example
local result = app.integrations.netsuite.list_items({
limit = 50,
offset = 0
})
for _, item in ipairs(result.items) do
print(item.itemid .. ": " .. (item.displayname or item.description or ""))
end
get_current_user
Get the authenticated NetSuite user’s profile.
Parameters
None.
Example
local result = app.integrations.netsuite.get_current_user({})
print("User: " .. (result.name or result.email))
print("Role: " .. (result.role or "N/A"))
Multi-Account Usage
If you have multiple NetSuite accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.netsuite.list_customers({limit = 10})
-- Explicit default (portable across setups)
app.integrations.netsuite.default.list_customers({limit = 10})
-- Named accounts
app.integrations.netsuite.production.list_customers({limit = 10})
app.integrations.netsuite.sandbox.list_customers({limit = 10})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# NetSuite ERP — Lua API Reference
## list_customers
List customers from NetSuite ERP.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of customers to return (default: 50, max: 1000) |
| `offset` | integer | no | Zero-based offset for pagination |
### Example
```lua
local result = app.integrations.netsuite.list_customers({
limit = 10,
offset = 0
})
for _, customer in ipairs(result.items) do
print(customer.id .. ": " .. (customer.companyname or customer.entityid))
end
```
---
## get_customer
Get detailed information for a single customer.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The internal ID of the customer in NetSuite |
### Example
```lua
local result = app.integrations.netsuite.get_customer({
id = "12345"
})
print("Company: " .. result.companyname)
print("Email: " .. (result.email or "N/A"))
print("Phone: " .. (result.phone or "N/A"))
```
---
## create_customer
Create a new customer in NetSuite.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `companyname` | string | no* | Company name (required for company customers) |
| `firstname` | string | no* | First name (required for individual customers) |
| `lastname` | string | no* | Last name (required for individual customers) |
| `email` | string | no | Primary email address |
| `phone` | string | no | Primary phone number |
| `subsidiary` | string | no | Subsidiary internal ID (required for OneWorld accounts) |
| `entitystatus` | string | no | Customer status reference |
| `currency` | string | no | Currency internal ID |
| `terms` | string | no | Payment terms reference |
| `addressbook` | array | no | Array of address objects |
*Either `companyname` or `lastname` is required.
### Example
```lua
local result = app.integrations.netsuite.create_customer({
companyname = "Acme Corp",
email = "billing@acme.com",
phone = "+1-555-0123",
currency = "1",
terms = "2"
})
print("Created customer: " .. result.id)
```
---
## list_invoices
List invoices from NetSuite ERP.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of invoices to return (default: 50, max: 1000) |
| `offset` | integer | no | Zero-based offset for pagination |
### Example
```lua
local result = app.integrations.netsuite.list_invoices({
limit = 20,
offset = 0
})
for _, invoice in ipairs(result.items) do
print(invoice.tranid .. ": $" .. (invoice.amountremaining or invoice.total))
end
```
---
## list_sales_orders
List sales orders from NetSuite ERP.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of sales orders to return (default: 50, max: 1000) |
| `offset` | integer | no | Zero-based offset for pagination |
### Example
```lua
local result = app.integrations.netsuite.list_sales_orders({
limit = 20,
offset = 0
})
for _, order in ipairs(result.items) do
print(order.tranid .. ": " .. (order.status or "Unknown"))
end
```
---
## list_items
List items (products and services) from NetSuite ERP.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of items to return (default: 50, max: 1000) |
| `offset` | integer | no | Zero-based offset for pagination |
### Example
```lua
local result = app.integrations.netsuite.list_items({
limit = 50,
offset = 0
})
for _, item in ipairs(result.items) do
print(item.itemid .. ": " .. (item.displayname or item.description or ""))
end
```
---
## get_current_user
Get the authenticated NetSuite user's profile.
### Parameters
None.
### Example
```lua
local result = app.integrations.netsuite.get_current_user({})
print("User: " .. (result.name or result.email))
print("Role: " .. (result.role or "N/A"))
```
---
## Multi-Account Usage
If you have multiple NetSuite accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.netsuite.list_customers({limit = 10})
-- Explicit default (portable across setups)
app.integrations.netsuite.default.list_customers({limit = 10})
-- Named accounts
app.integrations.netsuite.production.list_customers({limit = 10})
app.integrations.netsuite.sandbox.list_customers({limit = 10})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.netsuite.list_customers({limit = 1, offset = 1})
print(result) Functions
list_customers Read
List customers from NetSuite ERP. Returns customer records with names, IDs, and basic details. Use limit and offset for pagination.
- Lua path
app.integrations.netsuite.list_customers- Full name
netsuite.netsuite_list_customers
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of customers to return (default: 50, max: 1000). |
offset | integer | no | Zero-based offset for pagination. |
get_customer Read
Get detailed information for a single NetSuite customer by internal ID. Returns full customer record including contact details, addresses, and financial information.
- Lua path
app.integrations.netsuite.get_customer- Full name
netsuite.netsuite_get_customer
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | yes | The internal ID of the customer in NetSuite. |
create_customer Write
Create a new customer in NetSuite ERP. Provide at minimum the company name or first/last name. Additional fields like email, phone, subsidiary, and address can be included.
- Lua path
app.integrations.netsuite.create_customer- Full name
netsuite.netsuite_create_customer
| Parameter | Type | Required | Description |
|---|---|---|---|
companyname | string | no | Company name for the customer (required for company customers). |
firstname | string | no | First name (required for individual customers). |
lastname | string | no | Last name (required for individual customers). |
email | string | no | Primary email address. |
phone | string | no | Primary phone number. |
subsidiary | string | no | Subsidiary internal ID or ref (required for OneWorld accounts). |
entitystatus | string | no | Customer status (e.g., "CUSTOMER-Closed", "CUSTOMER-Lost"). |
currency | string | no | Currency internal ID or ref (e.g., "1" for USD). |
terms | string | no | Payment terms internal ID or ref. |
addressbook | array | no | Array of address objects with addr1, city, state, zip, country fields. |
list_invoices Read
List invoices from NetSuite ERP. Returns invoice records with amounts, statuses, customer references, and dates. Use limit and offset for pagination.
- Lua path
app.integrations.netsuite.list_invoices- Full name
netsuite.netsuite_list_invoices
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of invoices to return (default: 50, max: 1000). |
offset | integer | no | Zero-based offset for pagination. |
list_sales_orders Read
List sales orders from NetSuite ERP. Returns sales order records with order details, line items, customer references, and statuses. Use limit and offset for pagination.
- Lua path
app.integrations.netsuite.list_sales_orders- Full name
netsuite.netsuite_list_sales_orders
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of sales orders to return (default: 50, max: 1000). |
offset | integer | no | Zero-based offset for pagination. |
list_items Read
List items (products and services) from NetSuite ERP. Returns item records with names, IDs, types, and pricing. Use limit and offset for pagination.
- Lua path
app.integrations.netsuite.list_items- Full name
netsuite.netsuite_list_items
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of items to return (default: 50, max: 1000). |
offset | integer | no | Zero-based offset for pagination. |
get_current_user Read
Get the profile of the currently authenticated NetSuite user. Returns user details like name, email, role, and subsidiary.
- Lua path
app.integrations.netsuite.get_current_user- Full name
netsuite.netsuite_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||