KosmoKrator

productivity

Motion Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Bearer token auth

Lua Namespace

Agents call this integration through app.integrations.motion.*. Use lua_read_doc("integrations.motion") 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.

Motion — Lua API Reference

list_tasks

List tasks from Motion with optional filters.

Parameters

NameTypeRequiredDescription
statusstringnoFilter by task status (e.g., “Todo”, “In Progress”, “Done”)
projectIdstringnoFilter tasks by project ID
assigneeIdstringnoFilter tasks by assignee user ID
limitintegernoMax tasks per page (default: 20, max: 100)
cursorstringnoPagination cursor from a previous response

Examples

-- List all tasks
local result = app.integrations.motion.list_tasks({})

-- List todo tasks
local result = app.integrations.motion.list_tasks({ status = "Todo" })

-- List tasks in a project
local result = app.integrations.motion.list_tasks({ projectId = "proj_abc123" })

-- Paginate
local result = app.integrations.motion.list_tasks({ limit = 10, cursor = "next_page_cursor" })

get_task

Get details of a specific task.

Parameters

NameTypeRequiredDescription
taskIdstringyesThe unique task identifier

Example

local task = app.integrations.motion.get_task({ taskId = "task_abc123" })
print(task.name .. " — " .. task.status)

create_task

Create a new task in Motion. Motion auto-schedules based on priority and due date.

Parameters

NameTypeRequiredDescription
namestringyesTask title
projectIdstringnoProject to add the task to
assigneeIdstringnoUser ID to assign the task to
dueDatestringnoDue date in ISO 8601 (e.g., “2025-12-31”)
prioritystringnoPriority: “ASAP”, “HIGH”, “MEDIUM”, “LOW” (default: “MEDIUM”)
descriptionstringnoTask description (supports Markdown)

Examples

-- Simple task
local task = app.integrations.motion.create_task({
  name = "Review Q1 report"
})

-- Full task with all options
local task = app.integrations.motion.create_task({
  name = "Review Q1 report",
  projectId = "proj_abc123",
  assigneeId = "user_xyz789",
  dueDate = "2025-03-28",
  priority = "HIGH",
  description = "Review the Q1 financial report and provide feedback."
})

list_projects

List all projects in Motion.

Parameters

None.

Example

local result = app.integrations.motion.list_projects({})
for _, project in ipairs(result.projects or {}) do
  print(project.id .. ": " .. project.name)
end

get_project

Get details of a specific project.

Parameters

NameTypeRequiredDescription
projectIdstringyesThe unique project identifier

Example

local project = app.integrations.motion.get_project({ projectId = "proj_abc123" })
print(project.name .. " — " .. (project.description or "No description"))

list_schedules

List schedules within a date range.

Parameters

NameTypeRequiredDescription
startDatestringyesStart date in ISO 8601 (e.g., “2025-01-01”)
endDatestringyesEnd date in ISO 8601 (e.g., “2025-01-31”)

Example

local result = app.integrations.motion.list_schedules({
  startDate = "2025-01-01",
  endDate = "2025-01-31"
})
for _, entry in ipairs(result.schedules or {}) do
  print(entry.date .. ": " .. entry.type)
end

get_current_user

Get the profile of the currently authenticated user.

Parameters

None.

Example

local user = app.integrations.motion.get_current_user({})
print("Logged in as: " .. user.name .. " (" .. user.email .. ")")

Multi-Account Usage

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

-- Default account (always works)
app.integrations.motion.list_tasks({})

-- Explicit default (portable across setups)
app.integrations.motion.default.list_tasks({})

-- Named accounts
app.integrations.motion.work.list_tasks({})
app.integrations.motion.personal.list_tasks({})

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

Raw agent markdown
# Motion — Lua API Reference

## list_tasks

List tasks from Motion with optional filters.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `status` | string | no | Filter by task status (e.g., "Todo", "In Progress", "Done") |
| `projectId` | string | no | Filter tasks by project ID |
| `assigneeId` | string | no | Filter tasks by assignee user ID |
| `limit` | integer | no | Max tasks per page (default: 20, max: 100) |
| `cursor` | string | no | Pagination cursor from a previous response |

### Examples

```lua
-- List all tasks
local result = app.integrations.motion.list_tasks({})

-- List todo tasks
local result = app.integrations.motion.list_tasks({ status = "Todo" })

-- List tasks in a project
local result = app.integrations.motion.list_tasks({ projectId = "proj_abc123" })

-- Paginate
local result = app.integrations.motion.list_tasks({ limit = 10, cursor = "next_page_cursor" })
```

---

## get_task

Get details of a specific task.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `taskId` | string | yes | The unique task identifier |

### Example

```lua
local task = app.integrations.motion.get_task({ taskId = "task_abc123" })
print(task.name .. " — " .. task.status)
```

---

## create_task

Create a new task in Motion. Motion auto-schedules based on priority and due date.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Task title |
| `projectId` | string | no | Project to add the task to |
| `assigneeId` | string | no | User ID to assign the task to |
| `dueDate` | string | no | Due date in ISO 8601 (e.g., "2025-12-31") |
| `priority` | string | no | Priority: "ASAP", "HIGH", "MEDIUM", "LOW" (default: "MEDIUM") |
| `description` | string | no | Task description (supports Markdown) |

### Examples

```lua
-- Simple task
local task = app.integrations.motion.create_task({
  name = "Review Q1 report"
})

-- Full task with all options
local task = app.integrations.motion.create_task({
  name = "Review Q1 report",
  projectId = "proj_abc123",
  assigneeId = "user_xyz789",
  dueDate = "2025-03-28",
  priority = "HIGH",
  description = "Review the Q1 financial report and provide feedback."
})
```

---

## list_projects

List all projects in Motion.

### Parameters

None.

### Example

```lua
local result = app.integrations.motion.list_projects({})
for _, project in ipairs(result.projects or {}) do
  print(project.id .. ": " .. project.name)
end
```

---

## get_project

Get details of a specific project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `projectId` | string | yes | The unique project identifier |

### Example

```lua
local project = app.integrations.motion.get_project({ projectId = "proj_abc123" })
print(project.name .. " — " .. (project.description or "No description"))
```

---

## list_schedules

List schedules within a date range.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `startDate` | string | yes | Start date in ISO 8601 (e.g., "2025-01-01") |
| `endDate` | string | yes | End date in ISO 8601 (e.g., "2025-01-31") |

### Example

```lua
local result = app.integrations.motion.list_schedules({
  startDate = "2025-01-01",
  endDate = "2025-01-31"
})
for _, entry in ipairs(result.schedules or {}) do
  print(entry.date .. ": " .. entry.type)
end
```

---

## get_current_user

Get the profile of the currently authenticated user.

### Parameters

None.

### Example

```lua
local user = app.integrations.motion.get_current_user({})
print("Logged in as: " .. user.name .. " (" .. user.email .. ")")
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.motion.list_tasks({})

-- Explicit default (portable across setups)
app.integrations.motion.default.list_tasks({})

-- Named accounts
app.integrations.motion.work.list_tasks({})
app.integrations.motion.personal.list_tasks({})
```

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

Metadata-Derived Lua Example

local result = app.integrations.motion.motion_list_tasks({
  status = "example_status",
  projectId = "example_projectId",
  assigneeId = "example_assigneeId",
  limit = 1,
  cursor = "example_cursor"
})
print(result)

Functions

motion_list_tasks

List tasks from Motion with optional filters. Filter by status, project, or assignee. Supports cursor-based pagination.

Operation
Read read
Full name
motion.motion_list_tasks
ParameterTypeRequiredDescription
status string no Filter by task status. Common values: "Todo", "In Progress", "Done".
projectId string no Filter tasks by project ID.
assigneeId string no Filter tasks by assignee user ID.
limit integer no Maximum number of tasks to return per page (default: 20, max: 100).
cursor string no Pagination cursor from a previous response to fetch the next page.

motion_get_task

Get details of a specific task in Motion by its ID. Returns the task name, description, status, assignee, due date, priority, and project.

Operation
Read read
Full name
motion.motion_get_task
ParameterTypeRequiredDescription
taskId string yes The unique identifier of the task.

motion_create_task

Create a new task in Motion. Requires a task name. Optionally specify a project, assignee, due date, priority, and description. Motion will auto-schedule the task based on priorities and deadlines.

Operation
Write write
Full name
motion.motion_create_task
ParameterTypeRequiredDescription
name string yes The title/name of the task.
projectId string no The ID of the project to add the task to.
assigneeId string no The user ID of the person to assign the task to.
dueDate string no Due date in ISO 8601 format (e.g., "2025-12-31"). Motion uses this for auto-scheduling.
priority string no Task priority: "ASAP", "HIGH", "MEDIUM", or "LOW". Defaults to "MEDIUM".
description string no Detailed description of the task. Supports Markdown.

motion_list_projects

List all projects in Motion. Returns project IDs, names, and other metadata. Use project IDs to filter tasks or create tasks in specific projects.

Operation
Read read
Full name
motion.motion_list_projects
ParameterTypeRequiredDescription
No parameters.

motion_get_project

Get details of a specific project in Motion by its ID. Returns the project name, description, status, and other metadata.

Operation
Read read
Full name
motion.motion_get_project
ParameterTypeRequiredDescription
projectId string yes The unique identifier of the project.

motion_list_schedules

List schedules from Motion within a date range. Returns scheduled tasks and events for the authenticated user.

Operation
Read read
Full name
motion.motion_list_schedules
ParameterTypeRequiredDescription
startDate string yes Start date in ISO 8601 format (e.g., "2025-01-01").
endDate string yes End date in ISO 8601 format (e.g., "2025-01-31").

motion_get_current_user

Get the profile of the currently authenticated Motion user. Returns user ID, name, email, and other account details.

Operation
Read read
Full name
motion.motion_get_current_user
ParameterTypeRequiredDescription
No parameters.