KosmoKrator

productivity

Cloudways Lua API for KosmoKrator Agents

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

7 functions 7 read 0 write Bearer token auth

Lua Namespace

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

Cloudways — Lua API Reference

list_servers

List all servers in the Cloudways account.

Parameters

None.

Example

local result = app.integrations.cloudways.list_servers({})

for _, server in ipairs(result.servers) do
  print(server.label .. " (" .. server.status .. ") - " .. server.server_ips[1])
end

get_server

Get details for a specific Cloudways server.

Parameters

NameTypeRequiredDescription
server_idintegeryesThe server ID to look up

Example

local result = app.integrations.cloudways.get_server({ server_id = 12345 })
local s = result.server
print(s.label .. " - " .. s.server_ips[1] .. " - " .. s.os)

list_apps

List all applications across all servers in the Cloudways account.

Parameters

None.

Example

local result = app.integrations.cloudways.list_apps({})

for _, app in ipairs(result.apps) do
  print(app.label .. " (" .. app.application .. ") on server " .. app.server_id)
end

get_app

Get details for a specific Cloudways application.

Parameters

NameTypeRequiredDescription
server_idintegeryesThe server ID the application belongs to
app_idintegeryesThe application ID to look up

Example

local result = app.integrations.cloudways.get_app({ server_id = 12345, app_id = 67890 })
local a = result.app
print(a.label .. " - " .. a.application .. " - " .. a.app_fqdn)

list_domains

List domains for a specific Cloudways application.

Parameters

NameTypeRequiredDescription
server_idintegeryesThe server ID the application belongs to
app_idintegeryesThe application ID to list domains for

Example

local result = app.integrations.cloudways.list_domains({ server_id = 12345, app_id = 67890 })

for _, domain in ipairs(result.domains) do
  print(domain.fqdn .. " - primary: " .. tostring(domain.is_primary))
end

list_projects

List all projects in the Cloudways account.

Parameters

None.

Example

local result = app.integrations.cloudways.list_projects({})

for _, project in ipairs(result.projects) do
  print(project.name .. " (ID: " .. project.id .. ")")
end

get_current_user

Get the current authenticated Cloudways account information.

Parameters

None.

Example

local result = app.integrations.cloudways.get_current_user({})
print("Account: " .. result.me.email .. " (" .. result.me.name .. ")")

Multi-Account Usage

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

-- Default account (always works)
app.integrations.cloudways.list_servers({})

-- Explicit default (portable across setups)
app.integrations.cloudways.default.list_servers({})

-- Named accounts
app.integrations.cloudways.production.list_servers({})
app.integrations.cloudways.staging.list_servers({})

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

Raw agent markdown
# Cloudways — Lua API Reference

## list_servers

List all servers in the Cloudways account.

### Parameters

None.

### Example

```lua
local result = app.integrations.cloudways.list_servers({})

for _, server in ipairs(result.servers) do
  print(server.label .. " (" .. server.status .. ") - " .. server.server_ips[1])
end
```

---

## get_server

Get details for a specific Cloudways server.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `server_id` | integer | yes | The server ID to look up |

### Example

```lua
local result = app.integrations.cloudways.get_server({ server_id = 12345 })
local s = result.server
print(s.label .. " - " .. s.server_ips[1] .. " - " .. s.os)
```

---

## list_apps

List all applications across all servers in the Cloudways account.

### Parameters

None.

### Example

```lua
local result = app.integrations.cloudways.list_apps({})

for _, app in ipairs(result.apps) do
  print(app.label .. " (" .. app.application .. ") on server " .. app.server_id)
end
```

---

## get_app

Get details for a specific Cloudways application.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `server_id` | integer | yes | The server ID the application belongs to |
| `app_id` | integer | yes | The application ID to look up |

### Example

```lua
local result = app.integrations.cloudways.get_app({ server_id = 12345, app_id = 67890 })
local a = result.app
print(a.label .. " - " .. a.application .. " - " .. a.app_fqdn)
```

---

## list_domains

List domains for a specific Cloudways application.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `server_id` | integer | yes | The server ID the application belongs to |
| `app_id` | integer | yes | The application ID to list domains for |

### Example

```lua
local result = app.integrations.cloudways.list_domains({ server_id = 12345, app_id = 67890 })

for _, domain in ipairs(result.domains) do
  print(domain.fqdn .. " - primary: " .. tostring(domain.is_primary))
end
```

---

## list_projects

List all projects in the Cloudways account.

### Parameters

None.

### Example

```lua
local result = app.integrations.cloudways.list_projects({})

for _, project in ipairs(result.projects) do
  print(project.name .. " (ID: " .. project.id .. ")")
end
```

---

## get_current_user

Get the current authenticated Cloudways account information.

### Parameters

None.

### Example

```lua
local result = app.integrations.cloudways.get_current_user({})
print("Account: " .. result.me.email .. " (" .. result.me.name .. ")")
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.cloudways.list_servers({})

-- Explicit default (portable across setups)
app.integrations.cloudways.default.list_servers({})

-- Named accounts
app.integrations.cloudways.production.list_servers({})
app.integrations.cloudways.staging.list_servers({})
```

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

Metadata-Derived Lua Example

local result = app.integrations.cloudways.cloudways_list_servers({})
print(result)

Functions

cloudways_list_servers

List all servers in the Cloudways account.

Operation
Read read
Full name
cloudways.cloudways_list_servers
ParameterTypeRequiredDescription
No parameters.

cloudways_get_server

Get details for a specific Cloudways server.

Operation
Read read
Full name
cloudways.cloudways_get_server
ParameterTypeRequiredDescription
server_id integer yes The server ID to look up.

cloudways_list_apps

List all applications across all servers in the Cloudways account.

Operation
Read read
Full name
cloudways.cloudways_list_apps
ParameterTypeRequiredDescription
No parameters.

cloudways_get_app

Get details for a specific Cloudways application.

Operation
Read read
Full name
cloudways.cloudways_get_app
ParameterTypeRequiredDescription
server_id integer yes The server ID the application belongs to.
app_id integer yes The application ID to look up.

cloudways_list_domains

List domains for a specific Cloudways application.

Operation
Read read
Full name
cloudways.cloudways_list_domains
ParameterTypeRequiredDescription
server_id integer yes The server ID the application belongs to.
app_id integer yes The application ID to list domains for.

cloudways_list_projects

List all projects in the Cloudways account.

Operation
Read read
Full name
cloudways.cloudways_list_projects
ParameterTypeRequiredDescription
No parameters.

cloudways_get_current_user

Get the current authenticated Cloudways account information.

Operation
Read read
Full name
cloudways.cloudways_get_current_user
ParameterTypeRequiredDescription
No parameters.