KosmoKrator

data

Recurly Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.recurly.*. Use lua_read_doc("integrations.recurly") 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 Recurly workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.recurly.list_accounts({limit = 1, cursor = "example_cursor", email = "example_email", state = "example_state"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("recurly"))' --json
kosmo integrations:lua --eval 'print(docs.read("recurly.list_accounts"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local recurly = app.integrations.recurly
local result = recurly.list_accounts({limit = 1, cursor = "example_cursor", email = "example_email", state = "example_state"})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.recurly, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.recurly.default.* or app.integrations.recurly.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Recurly, use the narrower mcp:lua command.

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.

Recurly — Lua API Reference

recurly_list_accounts

List billing accounts from Recurly. Supports filtering by email and state, with cursor-based pagination.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of accounts to return (default: 20, max: 200).
cursorstringnoCursor for pagination — pass the value from a previous response to get the next page.
emailstringnoFilter accounts by email address.
statestringnoFilter by account state: "active", "closed", or "inactive".

Example

local result = app.integrations.recurly.list_accounts({
  limit = 10,
  state = "active"
})

for _, account in ipairs(result.data) do
  print(account.code .. ": " .. (account.email or "no email"))
end

recurly_get_account

Get details of a specific Recurly billing account by its ID or account code.

Parameters

NameTypeRequiredDescription
idstringyesThe account ID or account code (e.g., "code-123" or a UUID).

Example

local result = app.integrations.recurly.get_account({
  id = "code-123"
})

print("Account: " .. result.code)
print("Email: " .. (result.email or "N/A"))
print("State: " .. result.state)

recurly_create_account

Create a new billing account in Recurly with a unique account code, email, and name.

Parameters

NameTypeRequiredDescription
codestringyesA unique identifier for the account (e.g., "cust-001").
emailstringnoThe account email address.
first_namestringnoThe account holder’s first name.
last_namestringnoThe account holder’s last name.

Example

local result = app.integrations.recurly.create_account({
  code = "cust-001",
  email = "john@example.com",
  first_name = "John",
  last_name = "Doe"
})

print("Created account: " .. result.code)

recurly_list_subscriptions

List subscriptions from Recurly. Supports filtering by account and state, with cursor-based pagination.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of subscriptions to return (default: 20, max: 200).
cursorstringnoCursor for pagination — pass the value from a previous response to get the next page.
account_idstringnoFilter subscriptions by account ID or account code.
statestringnoFilter by subscription state: "active", "canceled", "expired", "future", "paused", or "trial".

Example

local result = app.integrations.recurly.list_subscriptions({
  limit = 10,
  state = "active"
})

for _, sub in ipairs(result.data) do
  print(sub.uuid .. " — " .. sub.state .. " — " .. (sub.plan and sub.plan.code or "no plan"))
end

Filter by account

local result = app.integrations.recurly.list_subscriptions({
  account_id = "code-123",
  state = "active"
})

recurly_get_subscription

Get details of a specific Recurly subscription by its UUID.

Parameters

NameTypeRequiredDescription
idstringyesThe subscription UUID.

Example

local result = app.integrations.recurly.get_subscription({
  id = "37c0a116-3b3a-4f57-bf32-45a1c8e0e6d8"
})

print("State: " .. result.state)
print("Plan: " .. (result.plan and result.plan.code or "N/A"))
print("Amount: " .. (result.unit_amount and tostring(result.unit_amount) or "N/A"))

recurly_list_plans

List billing plans from Recurly. Supports cursor-based pagination.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of plans to return (default: 20, max: 200).
cursorstringnoCursor for pagination — pass the value from a previous response to get the next page.

Example

local result = app.integrations.recurly.list_plans({
  limit = 50
})

for _, plan in ipairs(result.data) do
  print(plan.code .. ": " .. plan.name .. " — $" .. tostring(plan.currencies[1].unit_amount / 100))
end

recurly_get_current_user

Verify the Recurly API connection by fetching the first account. Useful as a health check.

Parameters

This tool takes no parameters.

Example

local result = app.integrations.recurly.get_current_user({})

if result.data and #result.data > 0 then
  print("Connected! First account: " .. result.data[1].code)
else
  print("Connected, but no accounts found.")
end

Multi-Account Usage

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

-- Default account (always works)
app.integrations.recurly.function_name({...})

-- Explicit default (portable across setups)
app.integrations.recurly.default.function_name({...})

-- Named accounts
app.integrations.recurly.production.function_name({...})
app.integrations.recurly.staging.function_name({...})

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

Raw agent markdown
# Recurly — Lua API Reference

## recurly_list_accounts

List billing accounts from Recurly. Supports filtering by email and state, with cursor-based pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of accounts to return (default: 20, max: 200). |
| `cursor` | string | no | Cursor for pagination — pass the value from a previous response to get the next page. |
| `email` | string | no | Filter accounts by email address. |
| `state` | string | no | Filter by account state: `"active"`, `"closed"`, or `"inactive"`. |

### Example

```lua
local result = app.integrations.recurly.list_accounts({
  limit = 10,
  state = "active"
})

for _, account in ipairs(result.data) do
  print(account.code .. ": " .. (account.email or "no email"))
end
```

---

## recurly_get_account

Get details of a specific Recurly billing account by its ID or account code.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The account ID or account code (e.g., `"code-123"` or a UUID). |

### Example

```lua
local result = app.integrations.recurly.get_account({
  id = "code-123"
})

print("Account: " .. result.code)
print("Email: " .. (result.email or "N/A"))
print("State: " .. result.state)
```

---

## recurly_create_account

Create a new billing account in Recurly with a unique account code, email, and name.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `code` | string | yes | A unique identifier for the account (e.g., `"cust-001"`). |
| `email` | string | no | The account email address. |
| `first_name` | string | no | The account holder's first name. |
| `last_name` | string | no | The account holder's last name. |

### Example

```lua
local result = app.integrations.recurly.create_account({
  code = "cust-001",
  email = "john@example.com",
  first_name = "John",
  last_name = "Doe"
})

print("Created account: " .. result.code)
```

---

## recurly_list_subscriptions

List subscriptions from Recurly. Supports filtering by account and state, with cursor-based pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of subscriptions to return (default: 20, max: 200). |
| `cursor` | string | no | Cursor for pagination — pass the value from a previous response to get the next page. |
| `account_id` | string | no | Filter subscriptions by account ID or account code. |
| `state` | string | no | Filter by subscription state: `"active"`, `"canceled"`, `"expired"`, `"future"`, `"paused"`, or `"trial"`. |

### Example

```lua
local result = app.integrations.recurly.list_subscriptions({
  limit = 10,
  state = "active"
})

for _, sub in ipairs(result.data) do
  print(sub.uuid .. " — " .. sub.state .. " — " .. (sub.plan and sub.plan.code or "no plan"))
end
```

### Filter by account

```lua
local result = app.integrations.recurly.list_subscriptions({
  account_id = "code-123",
  state = "active"
})
```

---

## recurly_get_subscription

Get details of a specific Recurly subscription by its UUID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The subscription UUID. |

### Example

```lua
local result = app.integrations.recurly.get_subscription({
  id = "37c0a116-3b3a-4f57-bf32-45a1c8e0e6d8"
})

print("State: " .. result.state)
print("Plan: " .. (result.plan and result.plan.code or "N/A"))
print("Amount: " .. (result.unit_amount and tostring(result.unit_amount) or "N/A"))
```

---

## recurly_list_plans

List billing plans from Recurly. Supports cursor-based pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of plans to return (default: 20, max: 200). |
| `cursor` | string | no | Cursor for pagination — pass the value from a previous response to get the next page. |

### Example

```lua
local result = app.integrations.recurly.list_plans({
  limit = 50
})

for _, plan in ipairs(result.data) do
  print(plan.code .. ": " .. plan.name .. " — $" .. tostring(plan.currencies[1].unit_amount / 100))
end
```

---

## recurly_get_current_user

Verify the Recurly API connection by fetching the first account. Useful as a health check.

### Parameters

This tool takes no parameters.

### Example

```lua
local result = app.integrations.recurly.get_current_user({})

if result.data and #result.data > 0 then
  print("Connected! First account: " .. result.data[1].code)
else
  print("Connected, but no accounts found.")
end
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.recurly.function_name({...})

-- Explicit default (portable across setups)
app.integrations.recurly.default.function_name({...})

-- Named accounts
app.integrations.recurly.production.function_name({...})
app.integrations.recurly.staging.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.recurly.list_accounts({limit = 1, cursor = "example_cursor", email = "example_email", state = "example_state"})
print(result)

Functions

list_accounts Read

List billing accounts from Recurly. Supports filtering by email and state, with cursor-based pagination.

Lua path
app.integrations.recurly.list_accounts
Full name
recurly.recurly_list_accounts
ParameterTypeRequiredDescription
limit integer no Maximum number of accounts to return (default: 20, max: 200).
cursor string no Cursor for pagination — pass the value from a previous response to get the next page.
email string no Filter accounts by email address.
state string no Filter by account state: "active", "closed", or "inactive".
get_account Read

Get details of a specific Recurly billing account by its ID or account code.

Lua path
app.integrations.recurly.get_account
Full name
recurly.recurly_get_account
ParameterTypeRequiredDescription
id string yes The account ID or account code (e.g., "code-123" or a UUID).
create_account Write

Create a new billing account in Recurly with a unique account code, email, and name.

Lua path
app.integrations.recurly.create_account
Full name
recurly.recurly_create_account
ParameterTypeRequiredDescription
code string yes A unique identifier for the account (e.g., "cust-001").
email string no The account email address.
first_name string no The account holder's first name.
last_name string no The account holder's last name.
list_subscriptions Read

List subscriptions from Recurly. Supports filtering by account and state, with cursor-based pagination.

Lua path
app.integrations.recurly.list_subscriptions
Full name
recurly.recurly_list_subscriptions
ParameterTypeRequiredDescription
limit integer no Maximum number of subscriptions to return (default: 20, max: 200).
cursor string no Cursor for pagination — pass the value from a previous response to get the next page.
account_id string no Filter subscriptions by account ID or account code.
state string no Filter by subscription state: "active", "canceled", "expired", "future", "paused", or "trial".
get_subscription Read

Get details of a specific Recurly subscription by its UUID.

Lua path
app.integrations.recurly.get_subscription
Full name
recurly.recurly_get_subscription
ParameterTypeRequiredDescription
id string yes The subscription UUID.
list_plans Read

List billing plans from Recurly. Supports cursor-based pagination.

Lua path
app.integrations.recurly.list_plans
Full name
recurly.recurly_list_plans
ParameterTypeRequiredDescription
limit integer no Maximum number of plans to return (default: 20, max: 200).
cursor string no Cursor for pagination — pass the value from a previous response to get the next page.
health_check Read

Verify the Recurly API connection by fetching the first account. Useful as a health check.

Lua path
app.integrations.recurly.health_check
Full name
recurly.recurly_get_current_user
ParameterTypeRequiredDescription
No parameters.