KosmoKrator

productivity

Thinkific Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API key auth

Lua Namespace

Agents call this integration through app.integrations.thinkific.*. Use lua_read_doc("integrations.thinkific") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Thinkific — Lua API Reference

list_courses

List courses in your Thinkific site.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of courses per page (default: 25, max: 250)
pageintegernoPage number for pagination (default: 1)
querystringnoSearch term to filter courses by name

Examples

-- List first 50 courses
local result = app.integrations.thinkific.list_courses({
  limit = 50,
  page = 1
})

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

for _, course in ipairs(result.items) do
  print(course.id .. ": " .. course.name)
end

get_course

Get detailed information about a specific Thinkific course.

Parameters

NameTypeRequiredDescription
idintegeryesThe Thinkific course ID

Example

local course = app.integrations.thinkific.get_course({ id = 12345 })
print("Course: " .. course.name)
print("Description: " .. (course.description or "N/A"))
print("Status: " .. course.status)

create_course

Create a new course in Thinkific.

Parameters

NameTypeRequiredDescription
namestringyesThe course name
descriptionstringnoThe course description
course_card_subtitlestringnoSubtitle shown on the course card

Example

local course = app.integrations.thinkific.create_course({
  name = "Introduction to Lua",
  description = "Learn the basics of Lua programming"
})
print("Created course: " .. course.id)

list_enrollments

List enrollments in your Thinkific site.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of enrollments per page (default: 25, max: 250)
pageintegernoPage number for pagination (default: 1)
course_idintegernoFilter enrollments by course ID
user_idintegernoFilter enrollments by user ID

Examples

-- List all enrollments
local result = app.integrations.thinkific.list_enrollments({
  limit = 50,
  page = 1
})

-- Filter by course
local result = app.integrations.thinkific.list_enrollments({
  course_id = 12345
})

-- Filter by user
local result = app.integrations.thinkific.list_enrollments({
  user_id = 67890
})

for _, enrollment in ipairs(result.items) do
  print(enrollment.id .. ": Course " .. enrollment.course_id .. " - User " .. enrollment.user_id .. " - " .. tostring(enrollment.percentage_completed) .. "% complete")
end

get_enrollment

Get detailed information about a specific Thinkific enrollment.

Parameters

NameTypeRequiredDescription
idintegeryesThe Thinkific enrollment ID

Example

local enrollment = app.integrations.thinkific.get_enrollment({ id = 56789 })
print("Course ID: " .. enrollment.course_id)
print("User ID: " .. enrollment.user_id)
print("Progress: " .. tostring(enrollment.percentage_completed) .. "%")
print("Completed: " .. tostring(enrollment.completed))

list_users

List users in your Thinkific site.

Parameters

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

Examples

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

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

for _, user in ipairs(result.items) do
  print(user.id .. ": " .. user.first_name .. " " .. user.last_name .. " (" .. user.email .. ")")
end

get_current_user

Get the profile of the currently authenticated Thinkific user.

Parameters

None.

Example

local me = app.integrations.thinkific.get_current_user({})
print("Logged in as: " .. me.first_name .. " " .. me.last_name)
print("Email: " .. me.email)

Multi-Account Usage

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

-- Default account (always works)
app.integrations.thinkific.list_courses({...})

-- Explicit default (portable across setups)
app.integrations.thinkific.default.list_courses({...})

-- Named accounts
app.integrations.thinkific.production.list_courses({...})
app.integrations.thinkific.staging.list_courses({...})

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

Raw agent markdown
# Thinkific — Lua API Reference

## list_courses

List courses in your Thinkific site.

### Parameters

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

### Examples

```lua
-- List first 50 courses
local result = app.integrations.thinkific.list_courses({
  limit = 50,
  page = 1
})

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

for _, course in ipairs(result.items) do
  print(course.id .. ": " .. course.name)
end
```

---

## get_course

Get detailed information about a specific Thinkific course.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The Thinkific course ID |

### Example

```lua
local course = app.integrations.thinkific.get_course({ id = 12345 })
print("Course: " .. course.name)
print("Description: " .. (course.description or "N/A"))
print("Status: " .. course.status)
```

---

## create_course

Create a new course in Thinkific.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | The course name |
| `description` | string | no | The course description |
| `course_card_subtitle` | string | no | Subtitle shown on the course card |

### Example

```lua
local course = app.integrations.thinkific.create_course({
  name = "Introduction to Lua",
  description = "Learn the basics of Lua programming"
})
print("Created course: " .. course.id)
```

---

## list_enrollments

List enrollments in your Thinkific site.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of enrollments per page (default: 25, max: 250) |
| `page` | integer | no | Page number for pagination (default: 1) |
| `course_id` | integer | no | Filter enrollments by course ID |
| `user_id` | integer | no | Filter enrollments by user ID |

### Examples

```lua
-- List all enrollments
local result = app.integrations.thinkific.list_enrollments({
  limit = 50,
  page = 1
})

-- Filter by course
local result = app.integrations.thinkific.list_enrollments({
  course_id = 12345
})

-- Filter by user
local result = app.integrations.thinkific.list_enrollments({
  user_id = 67890
})

for _, enrollment in ipairs(result.items) do
  print(enrollment.id .. ": Course " .. enrollment.course_id .. " - User " .. enrollment.user_id .. " - " .. tostring(enrollment.percentage_completed) .. "% complete")
end
```

---

## get_enrollment

Get detailed information about a specific Thinkific enrollment.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The Thinkific enrollment ID |

### Example

```lua
local enrollment = app.integrations.thinkific.get_enrollment({ id = 56789 })
print("Course ID: " .. enrollment.course_id)
print("User ID: " .. enrollment.user_id)
print("Progress: " .. tostring(enrollment.percentage_completed) .. "%")
print("Completed: " .. tostring(enrollment.completed))
```

---

## list_users

List users in your Thinkific site.

### Parameters

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

### Examples

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

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

for _, user in ipairs(result.items) do
  print(user.id .. ": " .. user.first_name .. " " .. user.last_name .. " (" .. user.email .. ")")
end
```

---

## get_current_user

Get the profile of the currently authenticated Thinkific user.

### Parameters

None.

### Example

```lua
local me = app.integrations.thinkific.get_current_user({})
print("Logged in as: " .. me.first_name .. " " .. me.last_name)
print("Email: " .. me.email)
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.thinkific.list_courses({...})

-- Explicit default (portable across setups)
app.integrations.thinkific.default.list_courses({...})

-- Named accounts
app.integrations.thinkific.production.list_courses({...})
app.integrations.thinkific.staging.list_courses({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.thinkific.thinkific_list_courses({
  limit = 1,
  page = 1,
  query = "example_query"
})
print(result)

Functions

thinkific_list_courses

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

Operation
Read read
Full name
thinkific.thinkific_list_courses
ParameterTypeRequiredDescription
limit integer no Number of courses to return per page (default: 25, max: 250).
page integer no Page number for pagination (default: 1).
query string no Search term to filter courses by name.

thinkific_get_course

Get detailed information about a specific Thinkific course by its ID, including chapters, description, and pricing.

Operation
Read read
Full name
thinkific.thinkific_get_course
ParameterTypeRequiredDescription
id integer yes The Thinkific course ID.

thinkific_create_course

Create a new course in Thinkific. Requires a course name. Optionally include a description and additional course settings.

Operation
Write write
Full name
thinkific.thinkific_create_course
ParameterTypeRequiredDescription
name string yes The course name.
description string no The course description.
course_card_subtitle string no Subtitle shown on the course card.

thinkific_list_enrollments

List enrollments in your Thinkific site. Returns enrollment IDs, user info, course details, progress, and completion status. Supports pagination and filtering by course or user.

Operation
Read read
Full name
thinkific.thinkific_list_enrollments
ParameterTypeRequiredDescription
limit integer no Number of enrollments to return per page (default: 25, max: 250).
page integer no Page number for pagination (default: 1).
course_id integer no Filter enrollments by course ID.
user_id integer no Filter enrollments by user ID.

thinkific_get_enrollment

Get detailed information about a specific Thinkific enrollment by its ID, including progress percentage, completion status, and associated course and user details.

Operation
Read read
Full name
thinkific.thinkific_get_enrollment
ParameterTypeRequiredDescription
id integer yes The Thinkific enrollment ID.

thinkific_list_users

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

Operation
Read read
Full name
thinkific.thinkific_list_users
ParameterTypeRequiredDescription
limit integer no Number of users to return per page (default: 25, max: 250).
page integer no Page number for pagination (default: 1).
query string no Search term to filter users by name or email.

thinkific_get_current_user

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

Operation
Read read
Full name
thinkific.thinkific_get_current_user
ParameterTypeRequiredDescription
No parameters.