productivity
Harvest Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Harvest KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.harvest.*.
Use lua_read_doc("integrations.harvest") 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
Harvest workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.harvest.list_time_entries({user_id = 1, client_id = 1, project_id = 1, is_billed = true, is_running = true, from = "example_from", to = "example_to", page = 1}))' --json kosmo integrations:lua --eval 'print(docs.read("harvest"))' --json
kosmo integrations:lua --eval 'print(docs.read("harvest.list_time_entries"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local harvest = app.integrations.harvest
local result = harvest.list_time_entries({user_id = 1, client_id = 1, project_id = 1, is_billed = true, is_running = true, from = "example_from", to = "example_to", page = 1})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.harvest, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.harvest.default.* or app.integrations.harvest.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Harvest, 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.
Client for the Harvest REST API v2 — Lua API Reference
harvest_create_time_entry
Create a new Harvest time entry for a project and task..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
project_id | integer | yes | Project ID to log time against. |
task_id | integer | yes | Task ID to associate with the entry. |
spent_date | string | yes | Date the time was spent (YYYY-MM-DD). |
hours | number | no | Number of hours logged (e.g. 1.5). |
notes | string | no | Notes describing the time entry. |
timer_started_at | string | no | ISO 8601 timestamp when the timer was started. |
Example
local result = app.integrations.harvest.harvest_create_time_entry({
project_id = 0
task_id = 0
spent_date = ""
})
harvest_delete_time_entry
Delete a Harvest time entry by its ID..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The time entry ID to delete. |
Example
local result = app.integrations.harvest.harvest_delete_time_entry({
id = 0
})
harvest_get_current_user
Get the currently authenticated Harvest user profile..
Example
local result = app.integrations.harvest.harvest_get_current_user({
})
harvest_get_project
Get a single Harvest project by its ID..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The project ID. |
Example
local result = app.integrations.harvest.harvest_get_project({
id = 0
})
harvest_get_time_entry
Get a single Harvest time entry by its ID..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The time entry ID. |
Example
local result = app.integrations.harvest.harvest_get_time_entry({
id = 0
})
harvest_get_user
Get a single Harvest user by their ID..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The user ID. |
Example
local result = app.integrations.harvest.harvest_get_user({
id = 0
})
harvest_list_clients
List Harvest clients with optional active status filter..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
is_active | boolean | no | Filter to active clients only. |
page | integer | no | Page number (default: 1). |
Example
local result = app.integrations.harvest.harvest_list_clients({
is_active = true
page = 0
})
harvest_list_projects
List Harvest projects with optional filters for client and active status..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
client_id | integer | no | Filter by client ID. |
is_active | boolean | no | Filter to active projects only. |
page | integer | no | Page number (default: 1). |
per_page | integer | no | Results per page (default: 100). |
Example
local result = app.integrations.harvest.harvest_list_projects({
client_id = 0
is_active = true
page = 0
})
harvest_list_tasks
List Harvest tasks with optional active status filter..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
is_active | boolean | no | Filter to active tasks only. |
page | integer | no | Page number (default: 1). |
Example
local result = app.integrations.harvest.harvest_list_tasks({
is_active = true
page = 0
})
harvest_list_time_entries
List Harvest time entries with optional filters for user, client, project, and date range..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
user_id | integer | no | Filter by user ID. |
client_id | integer | no | Filter by client ID. |
project_id | integer | no | Filter by project ID. |
is_billed | boolean | no | Filter by billed status (true/false). |
is_running | boolean | no | Filter to only running timers. |
from | string | no | Start date filter (YYYY-MM-DD). |
to | string | no | End date filter (YYYY-MM-DD). |
page | integer | no | Page number (default: 1). |
per_page | integer | no | Results per page (default: 100, max: 2000). |
Example
local result = app.integrations.harvest.harvest_list_time_entries({
user_id = 0
client_id = 0
project_id = 0
})
harvest_list_users
List Harvest users with optional active status filter..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
is_active | boolean | no | Filter to active users only. |
page | integer | no | Page number (default: 1). |
per_page | integer | no | Results per page (default: 100). |
Example
local result = app.integrations.harvest.harvest_list_users({
is_active = true
page = 0
per_page = 0
})
harvest_update_time_entry
Update an existing Harvest time entry (hours, notes, or spent_date)..
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The time entry ID to update. |
hours | number | no | Updated number of hours (e.g. 2.5). |
notes | string | no | Updated notes for the time entry. |
spent_date | string | no | Updated spent date (YYYY-MM-DD). |
Example
local result = app.integrations.harvest.harvest_update_time_entry({
id = 0
hours = 0
notes = ""
})
Multi-Account Usage
If you have multiple harvest accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.harvest.function_name({...})
-- Explicit default (portable across setups)
app.integrations.harvest.default.function_name({...})
-- Named accounts
app.integrations.harvest.work.function_name({...})
app.integrations.harvest.personal.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Client for the Harvest REST API v2 — Lua API Reference
## harvest_create_time_entry
Create a new Harvest time entry for a project and task..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | integer | yes | Project ID to log time against. |
| `task_id` | integer | yes | Task ID to associate with the entry. |
| `spent_date` | string | yes | Date the time was spent (YYYY-MM-DD). |
| `hours` | number | no | Number of hours logged (e.g. 1.5). |
| `notes` | string | no | Notes describing the time entry. |
| `timer_started_at` | string | no | ISO 8601 timestamp when the timer was started. |
### Example
```lua
local result = app.integrations.harvest.harvest_create_time_entry({
project_id = 0
task_id = 0
spent_date = ""
})
```
## harvest_delete_time_entry
Delete a Harvest time entry by its ID..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The time entry ID to delete. |
### Example
```lua
local result = app.integrations.harvest.harvest_delete_time_entry({
id = 0
})
```
## harvest_get_current_user
Get the currently authenticated Harvest user profile..
### Example
```lua
local result = app.integrations.harvest.harvest_get_current_user({
})
```
## harvest_get_project
Get a single Harvest project by its ID..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The project ID. |
### Example
```lua
local result = app.integrations.harvest.harvest_get_project({
id = 0
})
```
## harvest_get_time_entry
Get a single Harvest time entry by its ID..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The time entry ID. |
### Example
```lua
local result = app.integrations.harvest.harvest_get_time_entry({
id = 0
})
```
## harvest_get_user
Get a single Harvest user by their ID..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The user ID. |
### Example
```lua
local result = app.integrations.harvest.harvest_get_user({
id = 0
})
```
## harvest_list_clients
List Harvest clients with optional active status filter..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `is_active` | boolean | no | Filter to active clients only. |
| `page` | integer | no | Page number (default: 1). |
### Example
```lua
local result = app.integrations.harvest.harvest_list_clients({
is_active = true
page = 0
})
```
## harvest_list_projects
List Harvest projects with optional filters for client and active status..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `client_id` | integer | no | Filter by client ID. |
| `is_active` | boolean | no | Filter to active projects only. |
| `page` | integer | no | Page number (default: 1). |
| `per_page` | integer | no | Results per page (default: 100). |
### Example
```lua
local result = app.integrations.harvest.harvest_list_projects({
client_id = 0
is_active = true
page = 0
})
```
## harvest_list_tasks
List Harvest tasks with optional active status filter..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `is_active` | boolean | no | Filter to active tasks only. |
| `page` | integer | no | Page number (default: 1). |
### Example
```lua
local result = app.integrations.harvest.harvest_list_tasks({
is_active = true
page = 0
})
```
## harvest_list_time_entries
List Harvest time entries with optional filters for user, client, project, and date range..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `user_id` | integer | no | Filter by user ID. |
| `client_id` | integer | no | Filter by client ID. |
| `project_id` | integer | no | Filter by project ID. |
| `is_billed` | boolean | no | Filter by billed status (true/false). |
| `is_running` | boolean | no | Filter to only running timers. |
| `from` | string | no | Start date filter (YYYY-MM-DD). |
| `to` | string | no | End date filter (YYYY-MM-DD). |
| `page` | integer | no | Page number (default: 1). |
| `per_page` | integer | no | Results per page (default: 100, max: 2000). |
### Example
```lua
local result = app.integrations.harvest.harvest_list_time_entries({
user_id = 0
client_id = 0
project_id = 0
})
```
## harvest_list_users
List Harvest users with optional active status filter..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `is_active` | boolean | no | Filter to active users only. |
| `page` | integer | no | Page number (default: 1). |
| `per_page` | integer | no | Results per page (default: 100). |
### Example
```lua
local result = app.integrations.harvest.harvest_list_users({
is_active = true
page = 0
per_page = 0
})
```
## harvest_update_time_entry
Update an existing Harvest time entry (hours, notes, or spent_date)..
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The time entry ID to update. |
| `hours` | number | no | Updated number of hours (e.g. 2.5). |
| `notes` | string | no | Updated notes for the time entry. |
| `spent_date` | string | no | Updated spent date (YYYY-MM-DD). |
### Example
```lua
local result = app.integrations.harvest.harvest_update_time_entry({
id = 0
hours = 0
notes = ""
})
```
---
## Multi-Account Usage
If you have multiple harvest accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.harvest.function_name({...})
-- Explicit default (portable across setups)
app.integrations.harvest.default.function_name({...})
-- Named accounts
app.integrations.harvest.work.function_name({...})
app.integrations.harvest.personal.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.harvest.list_time_entries({user_id = 1, client_id = 1, project_id = 1, is_billed = true, is_running = true, from = "example_from", to = "example_to", page = 1})
print(result) Functions
list_time_entries Read
List Harvest time entries with optional filters for user, client, project, and date range.
- Lua path
app.integrations.harvest.list_time_entries- Full name
harvest.harvest_list_time_entries
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | integer | no | Filter by user ID. |
client_id | integer | no | Filter by client ID. |
project_id | integer | no | Filter by project ID. |
is_billed | boolean | no | Filter by billed status (true/false). |
is_running | boolean | no | Filter to only running timers. |
from | string | no | Start date filter (YYYY-MM-DD). |
to | string | no | End date filter (YYYY-MM-DD). |
page | integer | no | Page number (default: 1). |
per_page | integer | no | Results per page (default: 100, max: 2000). |
create_time_entry Write
Create a new Harvest time entry for a project and task.
- Lua path
app.integrations.harvest.create_time_entry- Full name
harvest.harvest_create_time_entry
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | integer | yes | Project ID to log time against. |
task_id | integer | yes | Task ID to associate with the entry. |
spent_date | string | yes | Date the time was spent (YYYY-MM-DD). |
hours | number | no | Number of hours logged (e.g. 1.5). |
notes | string | no | Notes describing the time entry. |
timer_started_at | string | no | ISO 8601 timestamp when the timer was started. |
get_time_entry Read
Get a single Harvest time entry by its ID.
- Lua path
app.integrations.harvest.get_time_entry- Full name
harvest.harvest_get_time_entry
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The time entry ID. |
update_time_entry Write
Update an existing Harvest time entry (hours, notes, or spent_date).
- Lua path
app.integrations.harvest.update_time_entry- Full name
harvest.harvest_update_time_entry
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The time entry ID to update. |
hours | number | no | Updated number of hours (e.g. 2.5). |
notes | string | no | Updated notes for the time entry. |
spent_date | string | no | Updated spent date (YYYY-MM-DD). |
delete_time_entry Write
Delete a Harvest time entry by its ID.
- Lua path
app.integrations.harvest.delete_time_entry- Full name
harvest.harvest_delete_time_entry
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The time entry ID to delete. |
list_projects Read
List Harvest projects with optional filters for client and active status.
- Lua path
app.integrations.harvest.list_projects- Full name
harvest.harvest_list_projects
| Parameter | Type | Required | Description |
|---|---|---|---|
client_id | integer | no | Filter by client ID. |
is_active | boolean | no | Filter to active projects only. |
page | integer | no | Page number (default: 1). |
per_page | integer | no | Results per page (default: 100). |
get_project Read
Get a single Harvest project by its ID.
- Lua path
app.integrations.harvest.get_project- Full name
harvest.harvest_get_project
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The project ID. |
list_clients Read
List Harvest clients with optional active status filter.
- Lua path
app.integrations.harvest.list_clients- Full name
harvest.harvest_list_clients
| Parameter | Type | Required | Description |
|---|---|---|---|
is_active | boolean | no | Filter to active clients only. |
page | integer | no | Page number (default: 1). |
list_tasks Read
List Harvest tasks with optional active status filter.
- Lua path
app.integrations.harvest.list_tasks- Full name
harvest.harvest_list_tasks
| Parameter | Type | Required | Description |
|---|---|---|---|
is_active | boolean | no | Filter to active tasks only. |
page | integer | no | Page number (default: 1). |
list_users Read
List Harvest users with optional active status filter.
- Lua path
app.integrations.harvest.list_users- Full name
harvest.harvest_list_users
| Parameter | Type | Required | Description |
|---|---|---|---|
is_active | boolean | no | Filter to active users only. |
page | integer | no | Page number (default: 1). |
per_page | integer | no | Results per page (default: 100). |
get_user Read
Get a single Harvest user by their ID.
- Lua path
app.integrations.harvest.get_user- Full name
harvest.harvest_get_user
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The user ID. |
get_current_user Read
Get the currently authenticated Harvest user profile.
- Lua path
app.integrations.harvest.get_current_user- Full name
harvest.harvest_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||