productivity
Hubstaff Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Hubstaff KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.hubstaff.*.
Use lua_read_doc("integrations.hubstaff") 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
Hubstaff workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.hubstaff.list_time_entries({startTime = "example_startTime", endTime = "example_endTime", userIds = "example_userIds", projectId = 1, limit = 1, page = 1}))' --json kosmo integrations:lua --eval 'print(docs.read("hubstaff"))' --json
kosmo integrations:lua --eval 'print(docs.read("hubstaff.list_time_entries"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local hubstaff = app.integrations.hubstaff
local result = hubstaff.list_time_entries({startTime = "example_startTime", endTime = "example_endTime", userIds = "example_userIds", projectId = 1, limit = 1, page = 1})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.hubstaff, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.hubstaff.default.* or app.integrations.hubstaff.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Hubstaff, 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.
Hubstaff — Lua API Reference
list_time_entries
List time entries with optional filters for date range, user, and project.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
startTime | string | no | Start of the date range (ISO 8601, e.g., "2026-04-01T00:00:00Z") |
endTime | string | no | End of the date range (ISO 8601, e.g., "2026-04-06T23:59:59Z") |
userIds | string | no | Comma-separated user IDs to filter by (e.g., "123,456") |
projectId | integer | no | Project ID to filter time entries by |
limit | integer | no | Max results per page (default: 50, max: 500) |
page | integer | no | Page number for pagination (starts at 1) |
Example
local result = app.integrations.hubstaff.list_time_entries({
startTime = "2026-04-01T00:00:00Z",
endTime = "2026-04-06T23:59:59Z",
limit = 50
})
for _, entry in ipairs(result.time_entries or {}) do
print(entry.id .. ": " .. entry.duration .. " seconds")
end
get_time_entry
Get details for a specific time entry by ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The time entry ID |
Example
local result = app.integrations.hubstaff.get_time_entry({ id = 12345 })
local entry = result.time_entry
print(entry.notes or "No notes")
create_time_entry
Create a new manual time entry for a project.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
project_id | integer | yes | The ID of the project to log time against |
date | string | yes | The date for the time entry (ISO 8601, e.g., "2026-04-06") |
duration | integer | yes | Duration in seconds (e.g., 3600 for 1 hour) |
notes | string | no | Notes describing the work performed |
Example
local result = app.integrations.hubstaff.create_time_entry({
project_id = 100,
date = "2026-04-06",
duration = 3600,
notes = "Code review and bug fixes"
})
print("Created time entry: " .. result.time_entry.id)
list_projects
List projects with optional status filter and pagination.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
status | string | no | Filter by status: "active" or "archived" |
limit | integer | no | Max results per page (default: 50) |
page | integer | no | Page number for pagination (starts at 1) |
Example
local result = app.integrations.hubstaff.list_projects({
status = "active",
limit = 50
})
for _, project in ipairs(result.projects or {}) do
print(project.id .. ": " .. project.name .. " (" .. project.status .. ")")
end
get_project
Get details for a specific project by ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The project ID |
Example
local result = app.integrations.hubstaff.get_project({ id = 100 })
local project = result.project
print(project.name .. " — " .. project.status)
list_organizations
List organizations the authenticated user belongs to.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Max results per page (default: 50) |
page | integer | no | Page number for pagination (starts at 1) |
Example
local result = app.integrations.hubstaff.list_organizations({ limit = 50 })
for _, org in ipairs(result.organizations or {}) do
print(org.id .. ": " .. org.name)
end
get_current_user
Get the profile of the currently authenticated user. Takes no parameters.
Example
local result = app.integrations.hubstaff.get_current_user({})
local user = result.user
print("Logged in as: " .. user.name .. " (" .. user.email .. ")")
Multi-Account Usage
If you have multiple Hubstaff accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.hubstaff.function_name({...})
-- Explicit default (portable across setups)
app.integrations.hubstaff.default.function_name({...})
-- Named accounts
app.integrations.hubstaff.work.function_name({...})
app.integrations.hubstaff.freelance.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Hubstaff — Lua API Reference
## list_time_entries
List time entries with optional filters for date range, user, and project.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `startTime` | string | no | Start of the date range (ISO 8601, e.g., `"2026-04-01T00:00:00Z"`) |
| `endTime` | string | no | End of the date range (ISO 8601, e.g., `"2026-04-06T23:59:59Z"`) |
| `userIds` | string | no | Comma-separated user IDs to filter by (e.g., `"123,456"`) |
| `projectId` | integer | no | Project ID to filter time entries by |
| `limit` | integer | no | Max results per page (default: 50, max: 500) |
| `page` | integer | no | Page number for pagination (starts at 1) |
### Example
```lua
local result = app.integrations.hubstaff.list_time_entries({
startTime = "2026-04-01T00:00:00Z",
endTime = "2026-04-06T23:59:59Z",
limit = 50
})
for _, entry in ipairs(result.time_entries or {}) do
print(entry.id .. ": " .. entry.duration .. " seconds")
end
```
---
## get_time_entry
Get details for a specific time entry by ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The time entry ID |
### Example
```lua
local result = app.integrations.hubstaff.get_time_entry({ id = 12345 })
local entry = result.time_entry
print(entry.notes or "No notes")
```
---
## create_time_entry
Create a new manual time entry for a project.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | integer | yes | The ID of the project to log time against |
| `date` | string | yes | The date for the time entry (ISO 8601, e.g., `"2026-04-06"`) |
| `duration` | integer | yes | Duration in seconds (e.g., 3600 for 1 hour) |
| `notes` | string | no | Notes describing the work performed |
### Example
```lua
local result = app.integrations.hubstaff.create_time_entry({
project_id = 100,
date = "2026-04-06",
duration = 3600,
notes = "Code review and bug fixes"
})
print("Created time entry: " .. result.time_entry.id)
```
---
## list_projects
List projects with optional status filter and pagination.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `status` | string | no | Filter by status: `"active"` or `"archived"` |
| `limit` | integer | no | Max results per page (default: 50) |
| `page` | integer | no | Page number for pagination (starts at 1) |
### Example
```lua
local result = app.integrations.hubstaff.list_projects({
status = "active",
limit = 50
})
for _, project in ipairs(result.projects or {}) do
print(project.id .. ": " .. project.name .. " (" .. project.status .. ")")
end
```
---
## get_project
Get details for a specific project by ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The project ID |
### Example
```lua
local result = app.integrations.hubstaff.get_project({ id = 100 })
local project = result.project
print(project.name .. " — " .. project.status)
```
---
## list_organizations
List organizations the authenticated user belongs to.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Max results per page (default: 50) |
| `page` | integer | no | Page number for pagination (starts at 1) |
### Example
```lua
local result = app.integrations.hubstaff.list_organizations({ limit = 50 })
for _, org in ipairs(result.organizations or {}) do
print(org.id .. ": " .. org.name)
end
```
---
## get_current_user
Get the profile of the currently authenticated user. Takes no parameters.
### Example
```lua
local result = app.integrations.hubstaff.get_current_user({})
local user = result.user
print("Logged in as: " .. user.name .. " (" .. user.email .. ")")
```
---
## Multi-Account Usage
If you have multiple Hubstaff accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.hubstaff.function_name({...})
-- Explicit default (portable across setups)
app.integrations.hubstaff.default.function_name({...})
-- Named accounts
app.integrations.hubstaff.work.function_name({...})
app.integrations.hubstaff.freelance.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.hubstaff.list_time_entries({startTime = "example_startTime", endTime = "example_endTime", userIds = "example_userIds", projectId = 1, limit = 1, page = 1})
print(result) Functions
list_time_entries Read
List time entries from Hubstaff. Supports filtering by date range, user IDs, and project ID. Returns tracked time entries with duration, notes, and associated project/user information.
- Lua path
app.integrations.hubstaff.list_time_entries- Full name
hubstaff.hubstaff_list_time_entries
| Parameter | Type | Required | Description |
|---|---|---|---|
startTime | string | no | Start of the date range (ISO 8601, e.g., "2026-04-01T00:00:00Z"). Required for most queries. |
endTime | string | no | End of the date range (ISO 8601, e.g., "2026-04-06T23:59:59Z"). Required for most queries. |
userIds | string | no | Comma-separated user IDs to filter by (e.g., "123,456"). |
projectId | integer | no | Project ID to filter time entries by. |
limit | integer | no | Maximum number of time entries to return per page (default: 50, max: 500). |
page | integer | no | Page number for pagination (starts at 1). |
get_time_entry Read
Get details for a specific Hubstaff time entry by its ID. Returns the full time entry record including duration, notes, project, and user information.
- Lua path
app.integrations.hubstaff.get_time_entry- Full name
hubstaff.hubstaff_get_time_entry
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The time entry ID. |
create_time_entry Write
Create a new manual time entry in Hubstaff. Requires a project ID, date, and duration. Optionally add notes to describe the work performed.
- Lua path
app.integrations.hubstaff.create_time_entry- Full name
hubstaff.hubstaff_create_time_entry
| Parameter | Type | Required | Description |
|---|---|---|---|
project_id | integer | yes | The ID of the project to log time against. |
date | string | yes | The date for the time entry (ISO 8601, e.g., "2026-04-06"). |
duration | integer | yes | Duration in seconds (e.g., 3600 for 1 hour). |
notes | string | no | Notes describing the work performed in this time entry. |
list_projects Read
List projects from Hubstaff. Optionally filter by status (active, archived). Supports pagination to browse through large numbers of projects.
- Lua path
app.integrations.hubstaff.list_projects- Full name
hubstaff.hubstaff_list_projects
| Parameter | Type | Required | Description |
|---|---|---|---|
status | string | no | Filter by project status: "active" or "archived". |
limit | integer | no | Maximum number of projects to return per page (default: 50). |
page | integer | no | Page number for pagination (starts at 1). |
get_project Read
Get details for a specific Hubstaff project by its ID. Returns project name, status, budget, and other metadata.
- Lua path
app.integrations.hubstaff.get_project- Full name
hubstaff.hubstaff_get_project
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The project ID. |
list_organizations Read
List organizations the authenticated user belongs to in Hubstaff. Returns organization names, IDs, and other metadata. Supports pagination.
- Lua path
app.integrations.hubstaff.list_organizations- Full name
hubstaff.hubstaff_list_organizations
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of organizations to return per page (default: 50). |
page | integer | no | Page number for pagination (starts at 1). |
get_current_user Read
Get the profile of the currently authenticated Hubstaff user. Returns name, email, timezone, and other account information.
- Lua path
app.integrations.hubstaff.get_current_user- Full name
hubstaff.hubstaff_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||