KosmoKrator

other

Recurly Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API key auth

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.

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 = "[email protected]",
  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 = "[email protected]",
  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.recurly_list_accounts({
  limit = 1,
  cursor = "example_cursor",
  email = "example_email",
  state = "example_state"
})
print(result)

Functions

recurly_list_accounts

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

Operation
Read read
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".

recurly_get_account

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

Operation
Read read
Full name
recurly.recurly_get_account
ParameterTypeRequiredDescription
id string yes The account ID or account code (e.g., "code-123" or a UUID).

recurly_create_account

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

Operation
Write write
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.

recurly_list_subscriptions

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

Operation
Read read
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".

recurly_get_subscription

Get details of a specific Recurly subscription by its UUID.

Operation
Read read
Full name
recurly.recurly_get_subscription
ParameterTypeRequiredDescription
id string yes The subscription UUID.

recurly_list_plans

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

Operation
Read read
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.

recurly_get_current_user

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

Operation
Read read
Full name
recurly.recurly_get_current_user
ParameterTypeRequiredDescription
No parameters.