KosmoKrator

productivity

Hubstaff Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Bearer token auth

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.

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

NameTypeRequiredDescription
startTimestringnoStart of the date range (ISO 8601, e.g., "2026-04-01T00:00:00Z")
endTimestringnoEnd of the date range (ISO 8601, e.g., "2026-04-06T23:59:59Z")
userIdsstringnoComma-separated user IDs to filter by (e.g., "123,456")
projectIdintegernoProject ID to filter time entries by
limitintegernoMax results per page (default: 50, max: 500)
pageintegernoPage 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

NameTypeRequiredDescription
idintegeryesThe 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

NameTypeRequiredDescription
project_idintegeryesThe ID of the project to log time against
datestringyesThe date for the time entry (ISO 8601, e.g., "2026-04-06")
durationintegeryesDuration in seconds (e.g., 3600 for 1 hour)
notesstringnoNotes 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

NameTypeRequiredDescription
statusstringnoFilter by status: "active" or "archived"
limitintegernoMax results per page (default: 50)
pageintegernoPage 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

NameTypeRequiredDescription
idintegeryesThe 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

NameTypeRequiredDescription
limitintegernoMax results per page (default: 50)
pageintegernoPage 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.

Metadata-Derived Lua Example

local result = app.integrations.hubstaff.hubstaff_list_time_entries({
  startTime = "example_startTime",
  endTime = "example_endTime",
  userIds = "example_userIds",
  projectId = 1,
  limit = 1,
  page = 1
})
print(result)

Functions

hubstaff_list_time_entries

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.

Operation
Read read
Full name
hubstaff.hubstaff_list_time_entries
ParameterTypeRequiredDescription
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).

hubstaff_get_time_entry

Get details for a specific Hubstaff time entry by its ID. Returns the full time entry record including duration, notes, project, and user information.

Operation
Read read
Full name
hubstaff.hubstaff_get_time_entry
ParameterTypeRequiredDescription
id integer yes The time entry ID.

hubstaff_create_time_entry

Create a new manual time entry in Hubstaff. Requires a project ID, date, and duration. Optionally add notes to describe the work performed.

Operation
Write write
Full name
hubstaff.hubstaff_create_time_entry
ParameterTypeRequiredDescription
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.

hubstaff_list_projects

List projects from Hubstaff. Optionally filter by status (active, archived). Supports pagination to browse through large numbers of projects.

Operation
Read read
Full name
hubstaff.hubstaff_list_projects
ParameterTypeRequiredDescription
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).

hubstaff_get_project

Get details for a specific Hubstaff project by its ID. Returns project name, status, budget, and other metadata.

Operation
Read read
Full name
hubstaff.hubstaff_get_project
ParameterTypeRequiredDescription
id integer yes The project ID.

hubstaff_list_organizations

List organizations the authenticated user belongs to in Hubstaff. Returns organization names, IDs, and other metadata. Supports pagination.

Operation
Read read
Full name
hubstaff.hubstaff_list_organizations
ParameterTypeRequiredDescription
limit integer no Maximum number of organizations to return per page (default: 50).
page integer no Page number for pagination (starts at 1).

hubstaff_get_current_user

Get the profile of the currently authenticated Hubstaff user. Returns name, email, timezone, and other account information.

Operation
Read read
Full name
hubstaff.hubstaff_get_current_user
ParameterTypeRequiredDescription
No parameters.