data
Splitwise Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Splitwise KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.splitwise.*.
Use lua_read_doc("integrations.splitwise") 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
Splitwise workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.splitwise.list_expenses({group_id = 1, friend_id = 1, dated_after = "example_dated_after", dated_before = "example_dated_before", limit = 1, offset = 1}))' --json kosmo integrations:lua --eval 'print(docs.read("splitwise"))' --json
kosmo integrations:lua --eval 'print(docs.read("splitwise.list_expenses"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local splitwise = app.integrations.splitwise
local result = splitwise.list_expenses({group_id = 1, friend_id = 1, dated_after = "example_dated_after", dated_before = "example_dated_before", limit = 1, offset = 1})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.splitwise, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.splitwise.default.* or app.integrations.splitwise.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Splitwise, 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.
Splitwise — Lua API Reference
list_expenses
List shared expenses for the current user with optional filters.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
group_id | integer | no | Filter expenses by group ID |
friend_id | integer | no | Filter expenses by friend ID |
dated_after | string | no | Only expenses after this date (ISO 8601, e.g., "2025-01-01") |
dated_before | string | no | Only expenses before this date (ISO 8601, e.g., "2025-12-31") |
limit | integer | no | Number of expenses to return (default: 20) |
offset | integer | no | Offset for pagination (default: 0) |
Examples
-- List recent expenses
local result = app.integrations.splitwise.list_expenses({})
for _, expense in ipairs(result.expenses) do
print(expense.description .. ": $" .. expense.cost)
end
-- Filter by group and date range
local result = app.integrations.splitwise.list_expenses({
group_id = 12345,
dated_after = "2025-01-01",
dated_before = "2025-03-31",
limit = 50
})
get_expense
Get detailed information about a specific expense.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The expense ID to retrieve |
Examples
local result = app.integrations.splitwise.get_expense({ id = 98765 })
local expense = result.expense
print(expense.description .. " — $" .. expense.cost)
for _, user in ipairs(expense.users) do
print(" " .. user.user.first_name .. " owes: $" .. user.owed_share)
end
create_expense
Create a new shared expense in Splitwise.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cost | string | yes | Total cost of the expense (e.g., "45.50") |
description | string | yes | Description of the expense |
users | array | yes | Array of users sharing the expense. Each user needs user_id (integer) and optionally owed_share (string). If owed_share is omitted, cost is split equally. |
group_id | integer | no | Group ID to assign the expense to |
currency_code | string | no | Three-letter currency code (e.g., "USD", "EUR") |
date | string | no | Date in ISO 8601 format (e.g., "2025-01-15") |
category_id | integer | no | Category ID (e.g., 18 = Food, 9 = Entertainment) |
details | string | no | Additional notes about the expense |
Examples
-- Split equally between two users
local result = app.integrations.splitwise.create_expense({
cost = "60.00",
description = "Dinner at Italian restaurant",
users = {
{ user_id = 11111 },
{ user_id = 22222 }
},
currency_code = "USD"
})
print("Created expense ID: " .. result.expenses[1].id)
-- Custom split amounts
local result = app.integrations.splitwise.create_expense({
cost = "100.00",
description = "Hotel room",
users = {
{ user_id = 11111, owed_share = "60.00" },
{ user_id = 22222, owed_share = "40.00" }
},
group_id = 12345,
category_id = 13
})
-- Expense in a group with date
local result = app.integrations.splitwise.create_expense({
cost = "25.50",
description = "Lunch",
users = {
{ user_id = 11111 },
{ user_id = 22222 },
{ user_id = 33333 }
},
group_id = 12345,
date = "2025-03-15",
currency_code = "EUR"
})
list_groups
List all groups the current user belongs to.
Parameters
None.
Examples
local result = app.integrations.splitwise.list_groups({})
for _, group in ipairs(result.groups) do
print(group.name .. " (" .. #group.members .. " members)")
end
get_group
Get detailed information about a specific group, including members and balances.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The group ID to retrieve |
Examples
local result = app.integrations.splitwise.get_group({ id = 12345 })
local group = result.group
print("Group: " .. group.name)
for _, member in ipairs(group.members) do
print(" " .. member.first_name .. " — balance: $" .. member.balance)
end
list_friends
List all friends with current balance information.
Parameters
None.
Examples
local result = app.integrations.splitwise.list_friends({})
for _, friend in ipairs(result.friends) do
local balance = friend.balance[1] and friend.balance[1].amount or "0.00"
print(friend.first_name .. " " .. friend.last_name .. " — balance: $" .. balance)
end
get_current_user
Get the authenticated user’s profile information.
Parameters
None.
Examples
local result = app.integrations.splitwise.get_current_user({})
local user = result.user
print("Logged in as: " .. user.first_name .. " " .. user.last_name)
print("Email: " .. user.email)
print("Default currency: " .. user.default_currency)
Multi-Account Usage
If you have multiple Splitwise accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.splitwise.list_expenses({...})
-- Explicit default (portable across setups)
app.integrations.splitwise.default.list_expenses({...})
-- Named accounts
app.integrations.splitwise.work.list_expenses({...})
app.integrations.splitwise.personal.list_expenses({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Splitwise — Lua API Reference
## list_expenses
List shared expenses for the current user with optional filters.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `group_id` | integer | no | Filter expenses by group ID |
| `friend_id` | integer | no | Filter expenses by friend ID |
| `dated_after` | string | no | Only expenses after this date (ISO 8601, e.g., `"2025-01-01"`) |
| `dated_before` | string | no | Only expenses before this date (ISO 8601, e.g., `"2025-12-31"`) |
| `limit` | integer | no | Number of expenses to return (default: 20) |
| `offset` | integer | no | Offset for pagination (default: 0) |
### Examples
```lua
-- List recent expenses
local result = app.integrations.splitwise.list_expenses({})
for _, expense in ipairs(result.expenses) do
print(expense.description .. ": $" .. expense.cost)
end
-- Filter by group and date range
local result = app.integrations.splitwise.list_expenses({
group_id = 12345,
dated_after = "2025-01-01",
dated_before = "2025-03-31",
limit = 50
})
```
---
## get_expense
Get detailed information about a specific expense.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The expense ID to retrieve |
### Examples
```lua
local result = app.integrations.splitwise.get_expense({ id = 98765 })
local expense = result.expense
print(expense.description .. " — $" .. expense.cost)
for _, user in ipairs(expense.users) do
print(" " .. user.user.first_name .. " owes: $" .. user.owed_share)
end
```
---
## create_expense
Create a new shared expense in Splitwise.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `cost` | string | yes | Total cost of the expense (e.g., `"45.50"`) |
| `description` | string | yes | Description of the expense |
| `users` | array | yes | Array of users sharing the expense. Each user needs `user_id` (integer) and optionally `owed_share` (string). If `owed_share` is omitted, cost is split equally. |
| `group_id` | integer | no | Group ID to assign the expense to |
| `currency_code` | string | no | Three-letter currency code (e.g., `"USD"`, `"EUR"`) |
| `date` | string | no | Date in ISO 8601 format (e.g., `"2025-01-15"`) |
| `category_id` | integer | no | Category ID (e.g., 18 = Food, 9 = Entertainment) |
| `details` | string | no | Additional notes about the expense |
### Examples
```lua
-- Split equally between two users
local result = app.integrations.splitwise.create_expense({
cost = "60.00",
description = "Dinner at Italian restaurant",
users = {
{ user_id = 11111 },
{ user_id = 22222 }
},
currency_code = "USD"
})
print("Created expense ID: " .. result.expenses[1].id)
-- Custom split amounts
local result = app.integrations.splitwise.create_expense({
cost = "100.00",
description = "Hotel room",
users = {
{ user_id = 11111, owed_share = "60.00" },
{ user_id = 22222, owed_share = "40.00" }
},
group_id = 12345,
category_id = 13
})
-- Expense in a group with date
local result = app.integrations.splitwise.create_expense({
cost = "25.50",
description = "Lunch",
users = {
{ user_id = 11111 },
{ user_id = 22222 },
{ user_id = 33333 }
},
group_id = 12345,
date = "2025-03-15",
currency_code = "EUR"
})
```
---
## list_groups
List all groups the current user belongs to.
### Parameters
None.
### Examples
```lua
local result = app.integrations.splitwise.list_groups({})
for _, group in ipairs(result.groups) do
print(group.name .. " (" .. #group.members .. " members)")
end
```
---
## get_group
Get detailed information about a specific group, including members and balances.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The group ID to retrieve |
### Examples
```lua
local result = app.integrations.splitwise.get_group({ id = 12345 })
local group = result.group
print("Group: " .. group.name)
for _, member in ipairs(group.members) do
print(" " .. member.first_name .. " — balance: $" .. member.balance)
end
```
---
## list_friends
List all friends with current balance information.
### Parameters
None.
### Examples
```lua
local result = app.integrations.splitwise.list_friends({})
for _, friend in ipairs(result.friends) do
local balance = friend.balance[1] and friend.balance[1].amount or "0.00"
print(friend.first_name .. " " .. friend.last_name .. " — balance: $" .. balance)
end
```
---
## get_current_user
Get the authenticated user's profile information.
### Parameters
None.
### Examples
```lua
local result = app.integrations.splitwise.get_current_user({})
local user = result.user
print("Logged in as: " .. user.first_name .. " " .. user.last_name)
print("Email: " .. user.email)
print("Default currency: " .. user.default_currency)
```
---
## Multi-Account Usage
If you have multiple Splitwise accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.splitwise.list_expenses({...})
-- Explicit default (portable across setups)
app.integrations.splitwise.default.list_expenses({...})
-- Named accounts
app.integrations.splitwise.work.list_expenses({...})
app.integrations.splitwise.personal.list_expenses({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.splitwise.list_expenses({group_id = 1, friend_id = 1, dated_after = "example_dated_after", dated_before = "example_dated_before", limit = 1, offset = 1})
print(result) Functions
list_expenses Read
List shared expenses from Splitwise. Optionally filter by group, friend, or date range. Returns expense details including cost, description, category, and split information.
- Lua path
app.integrations.splitwise.list_expenses- Full name
splitwise.splitwise_list_expenses
| Parameter | Type | Required | Description |
|---|---|---|---|
group_id | integer | no | Filter expenses by group ID. |
friend_id | integer | no | Filter expenses by friend ID. |
dated_after | string | no | Only expenses after this date (ISO 8601, e.g., "2025-01-01"). |
dated_before | string | no | Only expenses before this date (ISO 8601, e.g., "2025-12-31"). |
limit | integer | no | Number of expenses to return (default: 20, max: 10000). |
offset | integer | no | Offset for pagination (default: 0). |
get_expense Read
Get detailed information about a specific expense in Splitwise, including cost, description, category, date, and how it was split among users.
- Lua path
app.integrations.splitwise.get_expense- Full name
splitwise.splitwise_get_expense
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The expense ID to retrieve. |
create_expense Write
Create a new shared expense in Splitwise. Specify the total cost, description, and users involved. The expense will be split equally unless custom owed_share amounts are provided per user.
- Lua path
app.integrations.splitwise.create_expense- Full name
splitwise.splitwise_create_expense
| Parameter | Type | Required | Description |
|---|---|---|---|
cost | string | yes | Total cost of the expense (e.g., "45.50"). |
description | string | yes | Description of the expense (e.g., "Dinner at Italian restaurant"). |
users | array | yes | Array of users sharing the expense. Each user should have "user_id" (integer) and optionally "owed_share" (string, e.g., "22.75"). If owed_share is omitted, cost is split equally. |
group_id | integer | no | Group ID to assign the expense to. |
currency_code | string | no | Three-letter currency code (e.g., "USD", "EUR"). Defaults to the user's default currency. |
date | string | no | Date of the expense in ISO 8601 format (e.g., "2025-01-15"). Defaults to today. |
category_id | integer | no | Category ID for the expense (e.g., 18 for "Food", 9 for "Entertainment"). |
details | string | no | Additional notes or details about the expense. |
list_groups Read
List all groups the current user belongs to in Splitwise. Returns group names, member information, and balance summaries.
- Lua path
app.integrations.splitwise.list_groups- Full name
splitwise.splitwise_list_groups
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_group Read
Get detailed information about a specific group in Splitwise, including all members and their current balances.
- Lua path
app.integrations.splitwise.get_group- Full name
splitwise.splitwise_get_group
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The group ID to retrieve. |
list_friends Read
List all friends on Splitwise with their current balance information. Shows how much you owe or are owed by each friend.
- Lua path
app.integrations.splitwise.list_friends- Full name
splitwise.splitwise_list_friends
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_current_user Read
Get the authenticated Splitwise user's profile, including name, email, default currency, and account settings.
- Lua path
app.integrations.splitwise.get_current_user- Full name
splitwise.splitwise_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||