productivity
Cursor Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Cursor KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.cursor.*.
Use lua_read_doc("integrations.cursor") 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
Cursor workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.cursor.list_team_members({}))' --json kosmo integrations:lua --eval 'print(docs.read("cursor"))' --json
kosmo integrations:lua --eval 'print(docs.read("cursor.list_team_members"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local cursor = app.integrations.cursor
local result = cursor.list_team_members({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.cursor, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.cursor.default.* or app.integrations.cursor.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Cursor, 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.
Cursor - Lua API Reference
Namespace: app.integrations.cursor
This integration covers the documented Cursor Admin API at https://api.cursor.com. Cursor Admin API keys use Basic authentication with the API key as the username and an empty password.
list_team_members
List all Cursor team members.
local result = app.integrations.cursor.list_team_members({})
for _, member in ipairs(result.teamMembers or {}) do
print(member.name .. " (" .. member.email .. ") - " .. member.role)
end
get_daily_usage_data
Get daily usage data. Dates are epoch milliseconds.
| Name | Type | Required | Description |
|---|---|---|---|
start_date | integer | no | Start date as epoch milliseconds. |
end_date | integer | no | End date as epoch milliseconds. |
local usage = app.integrations.cursor.get_daily_usage_data({
start_date = 1748411762359,
end_date = 1751003762359
})
get_spend
Get current calendar month spending data with search, sorting, and pagination.
| Name | Type | Required | Description |
|---|---|---|---|
search_term | string | no | Search user names and emails. |
sort_by | string | no | amount, date, or user. |
sort_direction | string | no | asc or desc. |
page | integer | no | 1-indexed page number. |
page_size | integer | no | Results per page. |
local spend = app.integrations.cursor.get_spend({
search_term = "developer@example.test",
page = 1,
page_size = 25
})
get_usage_events
Get detailed usage events with filters.
| Name | Type | Required | Description |
|---|---|---|---|
start_date | integer | no | Start date as epoch milliseconds. |
end_date | integer | no | End date as epoch milliseconds. |
user_id | integer | no | Cursor user ID. |
email | string | no | Team member email address. |
page | integer | no | 1-indexed page number. |
page_size | integer | no | Results per page. |
set_user_spend_limit
Set a team member’s spend limit in whole dollars.
| Name | Type | Required | Description |
|---|---|---|---|
user_email | string | yes | Team member email address. |
spend_limit_dollars | integer | yes | Whole-dollar spend limit. Use 0 for a zero-dollar limit. |
list_repo_blocklists
List repository blocklists configured for the team.
local blocklists = app.integrations.cursor.list_repo_blocklists({})
upsert_repo_blocklists
Replace blocklist patterns for one or more repositories. Only the provided repositories are overwritten.
| Name | Type | Required | Description |
|---|---|---|---|
repos | array | yes | Repository objects with url and patterns. |
local result = app.integrations.cursor.upsert_repo_blocklists({
repos = {
{
url = "https://github.com/example/sensitive-repo",
patterns = {"*.env", "config/*", "secrets/**"}
}
}
})
delete_repo_blocklist
Delete a repository blocklist entry.
| Name | Type | Required | Description |
|---|---|---|---|
repo_id | string | yes | Repository blocklist ID. |
Multi-Account Usage
If you have multiple Cursor accounts configured, use account-specific namespaces:
app.integrations.cursor.list_team_members({})
app.integrations.cursor.default.list_team_members({})
app.integrations.cursor.work.list_team_members({})
All functions are identical across accounts; only credentials differ.
Raw agent markdown
# Cursor - Lua API Reference
Namespace: `app.integrations.cursor`
This integration covers the documented Cursor Admin API at `https://api.cursor.com`. Cursor Admin API keys use Basic authentication with the API key as the username and an empty password.
## list_team_members
List all Cursor team members.
```lua
local result = app.integrations.cursor.list_team_members({})
for _, member in ipairs(result.teamMembers or {}) do
print(member.name .. " (" .. member.email .. ") - " .. member.role)
end
```
## get_daily_usage_data
Get daily usage data. Dates are epoch milliseconds.
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `start_date` | integer | no | Start date as epoch milliseconds. |
| `end_date` | integer | no | End date as epoch milliseconds. |
```lua
local usage = app.integrations.cursor.get_daily_usage_data({
start_date = 1748411762359,
end_date = 1751003762359
})
```
## get_spend
Get current calendar month spending data with search, sorting, and pagination.
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `search_term` | string | no | Search user names and emails. |
| `sort_by` | string | no | `amount`, `date`, or `user`. |
| `sort_direction` | string | no | `asc` or `desc`. |
| `page` | integer | no | 1-indexed page number. |
| `page_size` | integer | no | Results per page. |
```lua
local spend = app.integrations.cursor.get_spend({
search_term = "developer@example.test",
page = 1,
page_size = 25
})
```
## get_usage_events
Get detailed usage events with filters.
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `start_date` | integer | no | Start date as epoch milliseconds. |
| `end_date` | integer | no | End date as epoch milliseconds. |
| `user_id` | integer | no | Cursor user ID. |
| `email` | string | no | Team member email address. |
| `page` | integer | no | 1-indexed page number. |
| `page_size` | integer | no | Results per page. |
## set_user_spend_limit
Set a team member's spend limit in whole dollars.
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `user_email` | string | yes | Team member email address. |
| `spend_limit_dollars` | integer | yes | Whole-dollar spend limit. Use `0` for a zero-dollar limit. |
## list_repo_blocklists
List repository blocklists configured for the team.
```lua
local blocklists = app.integrations.cursor.list_repo_blocklists({})
```
## upsert_repo_blocklists
Replace blocklist patterns for one or more repositories. Only the provided repositories are overwritten.
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `repos` | array | yes | Repository objects with `url` and `patterns`. |
```lua
local result = app.integrations.cursor.upsert_repo_blocklists({
repos = {
{
url = "https://github.com/example/sensitive-repo",
patterns = {"*.env", "config/*", "secrets/**"}
}
}
})
```
## delete_repo_blocklist
Delete a repository blocklist entry.
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `repo_id` | string | yes | Repository blocklist ID. |
## Multi-Account Usage
If you have multiple Cursor accounts configured, use account-specific namespaces:
```lua
app.integrations.cursor.list_team_members({})
app.integrations.cursor.default.list_team_members({})
app.integrations.cursor.work.list_team_members({})
```
All functions are identical across accounts; only credentials differ. local result = app.integrations.cursor.list_team_members({})
print(result) Functions
list_team_members Read
List all Cursor team members and their roles.
- Lua path
app.integrations.cursor.list_team_members- Full name
cursor.cursor_list_team_members
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_daily_usage_data Read
Get Cursor team daily usage data for a start and end date in epoch milliseconds.
- Lua path
app.integrations.cursor.get_daily_usage_data- Full name
cursor.cursor_get_daily_usage_data
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date | integer | no | Start date as epoch milliseconds. |
end_date | integer | no | End date as epoch milliseconds. |
get_spend Read
Get Cursor team spending data with optional search, sorting, and pagination.
- Lua path
app.integrations.cursor.get_spend- Full name
cursor.cursor_get_spend
| Parameter | Type | Required | Description |
|---|---|---|---|
search_term | string | no | Search user names and emails. |
sort_by | string | no | Sort by amount, date, or user. |
sort_direction | string | no | Sort direction: asc or desc. |
page | integer | no | Page number, 1-indexed. |
page_size | integer | no | Results per page. |
get_usage_events Read
Get detailed Cursor usage events filtered by date range, user ID, email, and pagination.
- Lua path
app.integrations.cursor.get_usage_events- Full name
cursor.cursor_get_usage_events
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date | integer | no | Start date as epoch milliseconds. |
end_date | integer | no | End date as epoch milliseconds. |
user_id | integer | no | Cursor user ID. |
email | string | no | Team member email address. |
page | integer | no | Page number, 1-indexed. |
page_size | integer | no | Results per page. |
set_user_spend_limit Write
Set a whole-dollar Cursor spending limit for a team member.
- Lua path
app.integrations.cursor.set_user_spend_limit- Full name
cursor.cursor_set_user_spend_limit
| Parameter | Type | Required | Description |
|---|---|---|---|
user_email | string | yes | Team member email address. |
spend_limit_dollars | integer | yes | Spend limit in whole dollars. Use 0 for a zero-dollar limit. |
list_repo_blocklists Read
List repository blocklists configured for the Cursor team.
- Lua path
app.integrations.cursor.list_repo_blocklists- Full name
cursor.cursor_list_repo_blocklists
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
upsert_repo_blocklists Write
Replace blocklist patterns for one or more Cursor team repositories.
- Lua path
app.integrations.cursor.upsert_repo_blocklists- Full name
cursor.cursor_upsert_repo_blocklists
| Parameter | Type | Required | Description |
|---|---|---|---|
repos | array | yes | Array of repository objects with url and patterns fields. |
delete_repo_blocklist Write
Delete a repository blocklist entry from the Cursor team settings.
- Lua path
app.integrations.cursor.delete_repo_blocklist- Full name
cursor.cursor_delete_repo_blocklist
| Parameter | Type | Required | Description |
|---|---|---|---|
repo_id | string | yes | Repository blocklist ID to delete. |