productivity
Teachable Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Teachable KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.teachable.*.
Use lua_read_doc("integrations.teachable") 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
Teachable workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.teachable.list_courses({page = 1, per_page = 1}))' --json kosmo integrations:lua --eval 'print(docs.read("teachable"))' --json
kosmo integrations:lua --eval 'print(docs.read("teachable.list_courses"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local teachable = app.integrations.teachable
local result = teachable.list_courses({page = 1, per_page = 1})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.teachable, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.teachable.default.* or app.integrations.teachable.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Teachable, 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.
Teachable — Lua API Reference
list_courses
List courses from your Teachable school.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1) |
per_page | integer | no | Results per page (default: 25, max: 100) |
Examples
local result = app.integrations.teachable.list_courses({
per_page = 10,
page = 1
})
for _, course in ipairs(result.data) do
print(course.name .. " — " .. course.id)
end
get_course
Get a single course by its ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
course_id | string | yes | The ID of the course to retrieve |
Examples
local result = app.integrations.teachable.get_course({
course_id = "12345"
})
print(result.data.name)
print(result.data.description)
list_users
List users from your Teachable school.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number (default: 1) |
per_page | integer | no | Results per page (default: 25, max: 100) |
Examples
local result = app.integrations.teachable.list_users({
per_page = 50,
page = 1
})
for _, user in ipairs(result.data) do
print(user.email .. " — " .. user.name)
end
get_user
Get a single user by their ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | yes | The ID of the user to retrieve |
Examples
local result = app.integrations.teachable.get_user({
user_id = "67890"
})
print(result.data.email)
print(result.data.name)
list_enrollments
List enrollments from your Teachable school.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | string | no | Filter enrollments by user ID |
course_id | string | no | Filter enrollments by course ID |
page | integer | no | Page number (default: 1) |
per_page | integer | no | Results per page (default: 25, max: 100) |
Examples
-- List all enrollments
local result = app.integrations.teachable.list_enrollments({
per_page = 25,
page = 1
})
-- Filter by course
local result = app.integrations.teachable.list_enrollments({
course_id = "12345"
})
-- Filter by user
local result = app.integrations.teachable.list_enrollments({
user_id = "67890"
})
for _, enrollment in ipairs(result.data) do
print(enrollment.user_id .. " enrolled in " .. enrollment.course_id)
end
get_enrollment
Get a single enrollment by its ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
enrollment_id | string | yes | The ID of the enrollment to retrieve |
Examples
local result = app.integrations.teachable.get_enrollment({
enrollment_id = "54321"
})
print(result.data.course_id)
print(result.data.user_id)
print(result.data.completed)
get_current_user
Verify your API key and get the current user profile.
Parameters
None.
Examples
local result = app.integrations.teachable.get_current_user({})
print(result.data.email)
print(result.data.name)
print(result.data.role)
Multi-Account Usage
If you have multiple Teachable accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.teachable.list_courses({})
-- Explicit default (portable across setups)
app.integrations.teachable.default.list_courses({})
-- Named accounts
app.integrations.teachable.school_a.list_courses({})
app.integrations.teachable.school_b.list_courses({})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Teachable — Lua API Reference
## list_courses
List courses from your Teachable school.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page (default: 25, max: 100) |
### Examples
```lua
local result = app.integrations.teachable.list_courses({
per_page = 10,
page = 1
})
for _, course in ipairs(result.data) do
print(course.name .. " — " .. course.id)
end
```
---
## get_course
Get a single course by its ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `course_id` | string | yes | The ID of the course to retrieve |
### Examples
```lua
local result = app.integrations.teachable.get_course({
course_id = "12345"
})
print(result.data.name)
print(result.data.description)
```
---
## list_users
List users from your Teachable school.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page (default: 25, max: 100) |
### Examples
```lua
local result = app.integrations.teachable.list_users({
per_page = 50,
page = 1
})
for _, user in ipairs(result.data) do
print(user.email .. " — " .. user.name)
end
```
---
## get_user
Get a single user by their ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `user_id` | string | yes | The ID of the user to retrieve |
### Examples
```lua
local result = app.integrations.teachable.get_user({
user_id = "67890"
})
print(result.data.email)
print(result.data.name)
```
---
## list_enrollments
List enrollments from your Teachable school.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `user_id` | string | no | Filter enrollments by user ID |
| `course_id` | string | no | Filter enrollments by course ID |
| `page` | integer | no | Page number (default: 1) |
| `per_page` | integer | no | Results per page (default: 25, max: 100) |
### Examples
```lua
-- List all enrollments
local result = app.integrations.teachable.list_enrollments({
per_page = 25,
page = 1
})
-- Filter by course
local result = app.integrations.teachable.list_enrollments({
course_id = "12345"
})
-- Filter by user
local result = app.integrations.teachable.list_enrollments({
user_id = "67890"
})
for _, enrollment in ipairs(result.data) do
print(enrollment.user_id .. " enrolled in " .. enrollment.course_id)
end
```
---
## get_enrollment
Get a single enrollment by its ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `enrollment_id` | string | yes | The ID of the enrollment to retrieve |
### Examples
```lua
local result = app.integrations.teachable.get_enrollment({
enrollment_id = "54321"
})
print(result.data.course_id)
print(result.data.user_id)
print(result.data.completed)
```
---
## get_current_user
Verify your API key and get the current user profile.
### Parameters
None.
### Examples
```lua
local result = app.integrations.teachable.get_current_user({})
print(result.data.email)
print(result.data.name)
print(result.data.role)
```
---
## Multi-Account Usage
If you have multiple Teachable accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.teachable.list_courses({})
-- Explicit default (portable across setups)
app.integrations.teachable.default.list_courses({})
-- Named accounts
app.integrations.teachable.school_a.list_courses({})
app.integrations.teachable.school_b.list_courses({})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.teachable.list_courses({page = 1, per_page = 1})
print(result) Functions
list_courses Read
List courses from your Teachable school. Paginate with page/per_page parameters.
- Lua path
app.integrations.teachable.list_courses- Full name
teachable.teachable_list_courses
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of courses per page (default: 25, max: 100). |
get_course Read
Get a single course from your Teachable school by its course ID.
- Lua path
app.integrations.teachable.get_course- Full name
teachable.teachable_get_course
| Parameter | Type | Required | Description |
|---|---|---|---|
course_id | string | yes | The ID of the course to retrieve. |
list_users Read
List users from your Teachable school. Paginate with page/per_page parameters.
- Lua path
app.integrations.teachable.list_users- Full name
teachable.teachable_list_users
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of users per page (default: 25, max: 100). |
get_user Read
Get a single user from your Teachable school by their user ID.
- Lua path
app.integrations.teachable.get_user- Full name
teachable.teachable_get_user
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | yes | The ID of the user to retrieve. |
list_enrollments Read
List enrollments from your Teachable school. Filter by user_id or course_id and paginate with page/per_page.
- Lua path
app.integrations.teachable.list_enrollments- Full name
teachable.teachable_list_enrollments
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | string | no | Filter enrollments by user ID. |
course_id | string | no | Filter enrollments by course ID. |
page | integer | no | Page number for pagination (default: 1). |
per_page | integer | no | Number of enrollments per page (default: 25, max: 100). |
get_enrollment Read
Get a single enrollment from your Teachable school by its enrollment ID.
- Lua path
app.integrations.teachable.get_enrollment- Full name
teachable.teachable_get_enrollment
| Parameter | Type | Required | Description |
|---|---|---|---|
enrollment_id | string | yes | The ID of the enrollment to retrieve. |
get_current_user Read
Verify your Teachable API key and get the current user profile. Use this to confirm the integration is working.
- Lua path
app.integrations.teachable.get_current_user- Full name
teachable.teachable_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||