KosmoKrator

productivity

Toggl Track Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API token auth

Lua Namespace

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

Toggl Track — Lua API Reference

list_time_entries

List time entries for the authenticated user. Supports filtering by date range, workspace, and project.

Parameters

NameTypeRequiredDescription
start_datestringnoStart date (ISO 8601, e.g., "2025-01-01T00:00:00Z")
end_datestringnoEnd date (ISO 8601, e.g., "2025-01-31T23:59:59Z")
workspace_idintegernoFilter by workspace ID
project_idintegernoFilter by project ID
limitintegernoMaximum number of entries to return

Examples

-- List recent time entries
local result = app.integrations["toggl-track"].list_time_entries({})
for _, entry in ipairs(result) do
  print(entry.description .. " (" .. entry.duration .. "s)")
end

-- Filter by date range
local result = app.integrations["toggl-track"].list_time_entries({
  start_date = "2025-01-01T00:00:00Z",
  end_date = "2025-01-31T23:59:59Z"
})

-- Filter by workspace and project
local result = app.integrations["toggl-track"].list_time_entries({
  workspace_id = 12345,
  project_id = 67890
})

get_time_entry

Get details of a specific time entry by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe time entry ID

Example

local entry = app.integrations["toggl-track"].get_time_entry({ id = 123456789 })
print(entry.description)
print("Duration: " .. entry.duration .. " seconds")
print("Project: " .. (entry.project_id or "none"))

create_time_entry

Create a new time entry in Toggl Track.

Parameters

NameTypeRequiredDescription
workspace_idintegeryesThe workspace ID
descriptionstringnoDescription of the time entry
durationintegernoDuration in seconds. Use -1 for a running timer.
startstringnoStart time (ISO 8601, e.g., "2025-01-15T09:00:00Z")
pidintegernoProject ID to assign
tagsarraynoList of tag names
billablebooleannoWhether the entry is billable (default: false)
created_withstringnoSource application name (default: “OpenCompany”)

Examples

-- Create a completed time entry (1 hour)
local entry = app.integrations["toggl-track"].create_time_entry({
  workspace_id = 12345,
  description = "Writing documentation",
  duration = 3600,
  start = "2025-01-15T09:00:00Z",
  pid = 67890,
  tags = { "docs", "client-work" },
  billable = true
})

-- Start a running timer
local entry = app.integrations["toggl-track"].create_time_entry({
  workspace_id = 12345,
  description = "Team meeting",
  duration = -1,
  start = "2025-01-15T14:00:00Z"
})

list_projects

List projects accessible to the authenticated user.

Parameters

NameTypeRequiredDescription
activebooleannoFilter by active status
workspace_idintegernoFilter by workspace ID

Examples

-- List all projects
local projects = app.integrations["toggl-track"].list_projects({})

-- List active projects in a specific workspace
local projects = app.integrations["toggl-track"].list_projects({
  active = true,
  workspace_id = 12345
})
for _, project in ipairs(projects) do
  print(project.name .. " (ID: " .. project.id .. ")")
end

get_project

Get details of a specific project by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe project ID

Example

local project = app.integrations["toggl-track"].get_project({ id = 67890 })
print(project.name)
print("Client: " .. (project.client_id or "none"))
print("Active: " .. tostring(project.active))

list_workspaces

List all workspaces accessible to the authenticated user.

Parameters

This tool takes no parameters.

Example

local workspaces = app.integrations["toggl-track"].list_workspaces({})
for _, ws in ipairs(workspaces) do
  print(ws.name .. " (ID: " .. ws.id .. ")")
end

get_current_user

Get the authenticated user’s profile.

Parameters

This tool takes no parameters.

Example

local user = app.integrations["toggl-track"].get_current_user({})
print("Name: " .. user.fullname)
print("Email: " .. user.email)
print("Default workspace: " .. user.default_workspace_id)

Multi-Account Usage

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

-- Default account (always works)
app.integrations["toggl-track"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["toggl-track"].default.function_name({...})

-- Named accounts
app.integrations["toggl-track"].work.function_name({...})
app.integrations["toggl-track"].personal.function_name({...})

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

Raw agent markdown
# Toggl Track — Lua API Reference

## list_time_entries

List time entries for the authenticated user. Supports filtering by date range, workspace, and project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `start_date` | string | no | Start date (ISO 8601, e.g., `"2025-01-01T00:00:00Z"`) |
| `end_date` | string | no | End date (ISO 8601, e.g., `"2025-01-31T23:59:59Z"`) |
| `workspace_id` | integer | no | Filter by workspace ID |
| `project_id` | integer | no | Filter by project ID |
| `limit` | integer | no | Maximum number of entries to return |

### Examples

```lua
-- List recent time entries
local result = app.integrations["toggl-track"].list_time_entries({})
for _, entry in ipairs(result) do
  print(entry.description .. " (" .. entry.duration .. "s)")
end

-- Filter by date range
local result = app.integrations["toggl-track"].list_time_entries({
  start_date = "2025-01-01T00:00:00Z",
  end_date = "2025-01-31T23:59:59Z"
})

-- Filter by workspace and project
local result = app.integrations["toggl-track"].list_time_entries({
  workspace_id = 12345,
  project_id = 67890
})
```

---

## get_time_entry

Get details of a specific time entry by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The time entry ID |

### Example

```lua
local entry = app.integrations["toggl-track"].get_time_entry({ id = 123456789 })
print(entry.description)
print("Duration: " .. entry.duration .. " seconds")
print("Project: " .. (entry.project_id or "none"))
```

---

## create_time_entry

Create a new time entry in Toggl Track.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `workspace_id` | integer | yes | The workspace ID |
| `description` | string | no | Description of the time entry |
| `duration` | integer | no | Duration in seconds. Use `-1` for a running timer. |
| `start` | string | no | Start time (ISO 8601, e.g., `"2025-01-15T09:00:00Z"`) |
| `pid` | integer | no | Project ID to assign |
| `tags` | array | no | List of tag names |
| `billable` | boolean | no | Whether the entry is billable (default: false) |
| `created_with` | string | no | Source application name (default: "OpenCompany") |

### Examples

```lua
-- Create a completed time entry (1 hour)
local entry = app.integrations["toggl-track"].create_time_entry({
  workspace_id = 12345,
  description = "Writing documentation",
  duration = 3600,
  start = "2025-01-15T09:00:00Z",
  pid = 67890,
  tags = { "docs", "client-work" },
  billable = true
})

-- Start a running timer
local entry = app.integrations["toggl-track"].create_time_entry({
  workspace_id = 12345,
  description = "Team meeting",
  duration = -1,
  start = "2025-01-15T14:00:00Z"
})
```

---

## list_projects

List projects accessible to the authenticated user.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `active` | boolean | no | Filter by active status |
| `workspace_id` | integer | no | Filter by workspace ID |

### Examples

```lua
-- List all projects
local projects = app.integrations["toggl-track"].list_projects({})

-- List active projects in a specific workspace
local projects = app.integrations["toggl-track"].list_projects({
  active = true,
  workspace_id = 12345
})
for _, project in ipairs(projects) do
  print(project.name .. " (ID: " .. project.id .. ")")
end
```

---

## get_project

Get details of a specific project by ID.

### Parameters

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

### Example

```lua
local project = app.integrations["toggl-track"].get_project({ id = 67890 })
print(project.name)
print("Client: " .. (project.client_id or "none"))
print("Active: " .. tostring(project.active))
```

---

## list_workspaces

List all workspaces accessible to the authenticated user.

### Parameters

This tool takes no parameters.

### Example

```lua
local workspaces = app.integrations["toggl-track"].list_workspaces({})
for _, ws in ipairs(workspaces) do
  print(ws.name .. " (ID: " .. ws.id .. ")")
end
```

---

## get_current_user

Get the authenticated user's profile.

### Parameters

This tool takes no parameters.

### Example

```lua
local user = app.integrations["toggl-track"].get_current_user({})
print("Name: " .. user.fullname)
print("Email: " .. user.email)
print("Default workspace: " .. user.default_workspace_id)
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations["toggl-track"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["toggl-track"].default.function_name({...})

-- Named accounts
app.integrations["toggl-track"].work.function_name({...})
app.integrations["toggl-track"].personal.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.toggl_track.toggl_list_time_entries({
  start_date = "example_start_date",
  end_date = "example_end_date",
  workspace_id = 1,
  project_id = 1,
  limit = 1
})
print(result)

Functions

toggl_list_time_entries

List time entries from Toggl Track. Filter by date range, workspace, or project. Returns recent time entries by default.

Operation
Read read
Full name
toggl-track.toggl_list_time_entries
ParameterTypeRequiredDescription
start_date string no Start date for the range (ISO 8601, e.g., "2025-01-01T00:00:00Z").
end_date string no End date for the range (ISO 8601, e.g., "2025-01-31T23:59:59Z").
workspace_id integer no Filter by workspace ID.
project_id integer no Filter by project ID.
limit integer no Maximum number of time entries to return.

toggl_get_time_entry

Get detailed information about a specific Toggl Track time entry by its ID.

Operation
Read read
Full name
toggl-track.toggl_get_time_entry
ParameterTypeRequiredDescription
id integer yes The time entry ID.

toggl_create_time_entry

Create a new time entry in Toggl Track. Provide a description, workspace, start time, and duration. Optionally assign to a project, add tags, or mark as billable.

Operation
Write write
Full name
toggl-track.toggl_create_time_entry
ParameterTypeRequiredDescription
workspace_id integer yes The workspace ID where the time entry will be created.
description string no Description of the time entry (e.g., "Writing documentation").
duration integer no Duration in seconds. Use a negative value (e.g., -1) to start a running timer.
start string no Start time in ISO 8601 format (e.g., "2025-01-15T09:00:00Z"). Required for completed entries.
pid integer no Project ID to assign the time entry to.
tags array no List of tag names to apply (e.g., ["billing", "client-work"]).
billable boolean no Whether the time entry is billable (default: false).
created_with string no Name of the application that created the entry (default: "OpenCompany").

toggl_list_projects

List projects from Toggl Track. Optionally filter by workspace or active status.

Operation
Read read
Full name
toggl-track.toggl_list_projects
ParameterTypeRequiredDescription
active boolean no Filter by active status. true for active projects only, false for archived.
workspace_id integer no Filter by workspace ID.

toggl_get_project

Get detailed information about a specific Toggl Track project by its ID.

Operation
Read read
Full name
toggl-track.toggl_get_project
ParameterTypeRequiredDescription
id integer yes The project ID.

toggl_list_workspaces

List all Toggl Track workspaces accessible to the authenticated user. Returns workspace IDs and names needed for other operations.

Operation
Read read
Full name
toggl-track.toggl_list_workspaces
ParameterTypeRequiredDescription
No parameters.

toggl_get_current_user

Get the authenticated Toggl Track user profile, including email, name, default workspace, and time zone.

Operation
Read read
Full name
toggl-track.toggl_get_current_user
ParameterTypeRequiredDescription
No parameters.