KosmoKrator

productivity

Litmos Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.litmos.list_users({limit = 1, page = 1, search = "example_search"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("litmos"))' --json
kosmo integrations:lua --eval 'print(docs.read("litmos.list_users"))' --json

Workflow file

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

workflow.lua
local litmos = app.integrations.litmos
local result = litmos.list_users({limit = 1, page = 1, search = "example_search"})

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

MCP-only Lua

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

Litmos LMS — Lua API Reference

list_users

List users in your Litmos organization.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of users per page (default: 100, max: 1000)
pageintegernoPage number for pagination (default: 1)
searchstringnoSearch term to filter users by name or email

Examples

-- List first 50 users
local result = app.integrations.litmos.list_users({
  limit = 50,
  page = 1
})

-- Search for a user
local result = app.integrations.litmos.list_users({
  search = "john"
})

for _, user in ipairs(result) do
  print(user.Id .. ": " .. user.FirstName .. " " .. user.LastName .. " (" .. user.Email .. ")")
end

get_user

Get detailed information about a specific Litmos user.

Parameters

NameTypeRequiredDescription
idstringyesThe Litmos user ID

Example

local user = app.integrations.litmos.get_user({ id = "abc123" })
print(user.FirstName .. " " .. user.LastName)
print("Email: " .. user.Email)
print("Status: " .. user.Active)

create_user

Create a new user in Litmos.

Parameters

NameTypeRequiredDescription
FirstNamestringyesThe user’s first name
LastNamestringyesThe user’s last name
EmailstringyesThe user’s email address
UserNamestringyesThe user’s login username

Example

local user = app.integrations.litmos.create_user({
  FirstName = "Jane",
  LastName = "Doe",
  Email = "jane@example.com",
  UserName = "janedoe"
})
print("Created user: " .. user.Id)

list_courses

List courses in your Litmos organization.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of courses per page (default: 100, max: 1000)
pageintegernoPage number for pagination (default: 1)
searchstringnoSearch term to filter courses by name

Examples

-- List all courses
local result = app.integrations.litmos.list_courses({
  limit = 100,
  page = 1
})

-- Search for a course
local result = app.integrations.litmos.list_courses({
  search = "onboarding"
})

for _, course in ipairs(result) do
  print(course.Id .. ": " .. course.Name)
end

get_course

Get detailed information about a specific Litmos course.

Parameters

NameTypeRequiredDescription
idstringyesThe Litmos course ID

Example

local course = app.integrations.litmos.get_course({ id = "course-456" })
print("Course: " .. course.Name)
print("Description: " .. (course.Description or "N/A"))
print("Active: " .. tostring(course.Active))

list_teams

List teams in your Litmos organization.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of teams per page (default: 100, max: 1000)
pageintegernoPage number for pagination (default: 1)

Example

local result = app.integrations.litmos.list_teams({
  limit = 50,
  page = 1
})

for _, team in ipairs(result) do
  print(team.Id .. ": " .. team.Name)
end

get_current_user

Get the profile of the currently authenticated Litmos user.

Parameters

None.

Example

local me = app.integrations.litmos.get_current_user({})
print("Logged in as: " .. me.FirstName .. " " .. me.LastName)
print("Email: " .. me.Email)

Multi-Account Usage

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

-- Default account (always works)
app.integrations.litmos.list_users({...})

-- Explicit default (portable across setups)
app.integrations.litmos.default.list_users({...})

-- Named accounts
app.integrations.litmos.production.list_users({...})
app.integrations.litmos.staging.list_users({...})

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

Raw agent markdown
# Litmos LMS — Lua API Reference

## list_users

List users in your Litmos organization.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of users per page (default: 100, max: 1000) |
| `page` | integer | no | Page number for pagination (default: 1) |
| `search` | string | no | Search term to filter users by name or email |

### Examples

```lua
-- List first 50 users
local result = app.integrations.litmos.list_users({
  limit = 50,
  page = 1
})

-- Search for a user
local result = app.integrations.litmos.list_users({
  search = "john"
})

for _, user in ipairs(result) do
  print(user.Id .. ": " .. user.FirstName .. " " .. user.LastName .. " (" .. user.Email .. ")")
end
```

---

## get_user

Get detailed information about a specific Litmos user.

### Parameters

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

### Example

```lua
local user = app.integrations.litmos.get_user({ id = "abc123" })
print(user.FirstName .. " " .. user.LastName)
print("Email: " .. user.Email)
print("Status: " .. user.Active)
```

---

## create_user

Create a new user in Litmos.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `FirstName` | string | yes | The user's first name |
| `LastName` | string | yes | The user's last name |
| `Email` | string | yes | The user's email address |
| `UserName` | string | yes | The user's login username |

### Example

```lua
local user = app.integrations.litmos.create_user({
  FirstName = "Jane",
  LastName = "Doe",
  Email = "jane@example.com",
  UserName = "janedoe"
})
print("Created user: " .. user.Id)
```

---

## list_courses

List courses in your Litmos organization.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of courses per page (default: 100, max: 1000) |
| `page` | integer | no | Page number for pagination (default: 1) |
| `search` | string | no | Search term to filter courses by name |

### Examples

```lua
-- List all courses
local result = app.integrations.litmos.list_courses({
  limit = 100,
  page = 1
})

-- Search for a course
local result = app.integrations.litmos.list_courses({
  search = "onboarding"
})

for _, course in ipairs(result) do
  print(course.Id .. ": " .. course.Name)
end
```

---

## get_course

Get detailed information about a specific Litmos course.

### Parameters

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

### Example

```lua
local course = app.integrations.litmos.get_course({ id = "course-456" })
print("Course: " .. course.Name)
print("Description: " .. (course.Description or "N/A"))
print("Active: " .. tostring(course.Active))
```

---

## list_teams

List teams in your Litmos organization.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of teams per page (default: 100, max: 1000) |
| `page` | integer | no | Page number for pagination (default: 1) |

### Example

```lua
local result = app.integrations.litmos.list_teams({
  limit = 50,
  page = 1
})

for _, team in ipairs(result) do
  print(team.Id .. ": " .. team.Name)
end
```

---

## get_current_user

Get the profile of the currently authenticated Litmos user.

### Parameters

None.

### Example

```lua
local me = app.integrations.litmos.get_current_user({})
print("Logged in as: " .. me.FirstName .. " " .. me.LastName)
print("Email: " .. me.Email)
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.litmos.list_users({...})

-- Explicit default (portable across setups)
app.integrations.litmos.default.list_users({...})

-- Named accounts
app.integrations.litmos.production.list_users({...})
app.integrations.litmos.staging.list_users({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.litmos.list_users({limit = 1, page = 1, search = "example_search"})
print(result)

Functions

list_users Read

List users in your Litmos organization. Returns user IDs, names, emails, and status. Supports pagination and search.

Lua path
app.integrations.litmos.list_users
Full name
litmos.litmos_list_users
ParameterTypeRequiredDescription
limit integer no Number of users to return per page (default: 100, max: 1000).
page integer no Page number for pagination (default: 1).
search string no Search term to filter users by name or email.
get_user Read

Get detailed information about a specific Litmos user by their ID, including profile data, course assignments, and team memberships.

Lua path
app.integrations.litmos.get_user
Full name
litmos.litmos_get_user
ParameterTypeRequiredDescription
id string yes The Litmos user ID.
create_user Write

Create a new user in Litmos. Requires a first name, last name, email address, and username for login.

Lua path
app.integrations.litmos.create_user
Full name
litmos.litmos_create_user
ParameterTypeRequiredDescription
FirstName string yes The user's first name.
LastName string yes The user's last name.
Email string yes The user's email address.
UserName string yes The user's login username.
list_courses Read

List courses in your Litmos organization. Returns course IDs, names, descriptions, and status. Supports pagination and search.

Lua path
app.integrations.litmos.list_courses
Full name
litmos.litmos_list_courses
ParameterTypeRequiredDescription
limit integer no Number of courses to return per page (default: 100, max: 1000).
page integer no Page number for pagination (default: 1).
search string no Search term to filter courses by name.
get_course Read

Get detailed information about a specific Litmos course by its ID, including modules, description, and completion settings.

Lua path
app.integrations.litmos.get_course
Full name
litmos.litmos_get_course
ParameterTypeRequiredDescription
id string yes The Litmos course ID.
list_teams Read

List teams in your Litmos organization. Returns team IDs, names, and description. Supports pagination.

Lua path
app.integrations.litmos.list_teams
Full name
litmos.litmos_list_teams
ParameterTypeRequiredDescription
limit integer no Number of teams to return per page (default: 100, max: 1000).
page integer no Page number for pagination (default: 1).
get_current_user Read

Get the profile of the currently authenticated Litmos user. Useful for verifying API credentials and identifying the connected account.

Lua path
app.integrations.litmos.get_current_user
Full name
litmos.litmos_get_current_user
ParameterTypeRequiredDescription
No parameters.