KosmoKrator

productivity

Resend Lua API for KosmoKrator Agents

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

10 functions 5 read 5 write API key auth

Lua Namespace

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

Resend — Lua API Reference

resend_send_email

Send an email via Resend.

Parameters

NameTypeRequiredDescription
tostringyesRecipient email address.
fromstringyesSender email address (must be a verified domain).
subjectstringyesEmail subject line.
htmlstringnoHTML body content.
textstringnoPlain-text body content.
ccarraynoCC recipient email addresses.
bccarraynoBCC recipient email addresses.
reply_toarraynoReply-to email addresses.
tagsarraynoTags to attach to the email. Each item should have "name" and "value" keys.
headersobjectnoCustom email headers (key-value pairs).

resend_get_email

Retrieve a single email by ID from Resend.

Parameters

NameTypeRequiredDescription
email_idstringyesThe ID of the email to retrieve.

resend_list_emails

List emails from Resend with pagination.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of emails to return (default 100, max 100).
tokenstringnoCursor token for pagination — use the token from the previous response to get the next page.

resend_create_api_key

Create a new API key in Resend.

Parameters

NameTypeRequiredDescription
namestringyesA descriptive name for the API key.
permissionstringnoPermission scope: "full_access" or "sending_access".
domain_idstringnoDomain ID to restrict the key to (only for sending_access).

resend_list_api_keys

List all API keys in Resend.

Parameters

No parameters required.

resend_create_domain

Create a new domain in Resend.

Parameters

NameTypeRequiredDescription
namestringyesDomain name (e.g. "example.com").
regionstringnoRegion for the domain: "us-east-1" or "eu-west-1".

resend_get_domain

Retrieve a single domain by ID from Resend.

Parameters

NameTypeRequiredDescription
domain_idstringyesThe ID of the domain to retrieve.

resend_list_domains

List all domains in Resend.

Parameters

No parameters required.

resend_verify_domain

Trigger domain verification in Resend.

Parameters

NameTypeRequiredDescription
domain_idstringyesThe ID of the domain to verify.

resend_create_contact

Create a contact in a Resend audience.

Parameters

NameTypeRequiredDescription
audience_idstringyesThe audience ID to add the contact to.
emailstringyesContact email address.
first_namestringnoContact first name.
last_namestringnoContact last name.
unsubscribedbooleannoWhether the contact is unsubscribed (default false).

Examples

Send an email

local result = app.integrations.resend.resend_send_email({
  to = "[email protected]",
  from = "[email protected]",
  subject = "Welcome to MyApp",
  html = "<h1>Hello!</h1><p>Welcome aboard.</p>",
  tags = {
    { name = "category", value = "welcome" }
  }
})
print("Email ID: " .. result.id)

Send a plain-text email with CC

local result = app.integrations.resend.resend_send_email({
  to = "[email protected]",
  from = "[email protected]",
  subject = "Meeting Notes",
  text = "Hi Alice,\n\nHere are the meeting notes from today...",
  cc = { "[email protected]" }
})

Create and verify a domain

local domain = app.integrations.resend.resend_create_domain({
  name = "myapp.com",
  region = "us-east-1"
})

-- After adding DNS records...
local result = app.integrations.resend.resend_verify_domain({
  domain_id = domain.id
})

Create a contact

local result = app.integrations.resend.resend_create_contact({
  audience_id = "aud_abc123",
  email = "[email protected]",
  first_name = "Jane",
  last_name = "Doe"
})

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.resend.work.function_name({...})
app.integrations.resend.personal.function_name({...})

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

Raw agent markdown
# Resend — Lua API Reference

## resend_send_email

Send an email via Resend.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `to` | string | yes | Recipient email address. |
| `from` | string | yes | Sender email address (must be a verified domain). |
| `subject` | string | yes | Email subject line. |
| `html` | string | no | HTML body content. |
| `text` | string | no | Plain-text body content. |
| `cc` | array | no | CC recipient email addresses. |
| `bcc` | array | no | BCC recipient email addresses. |
| `reply_to` | array | no | Reply-to email addresses. |
| `tags` | array | no | Tags to attach to the email. Each item should have `"name"` and `"value"` keys. |
| `headers` | object | no | Custom email headers (key-value pairs). |

## resend_get_email

Retrieve a single email by ID from Resend.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `email_id` | string | yes | The ID of the email to retrieve. |

## resend_list_emails

List emails from Resend with pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of emails to return (default 100, max 100). |
| `token` | string | no | Cursor token for pagination — use the token from the previous response to get the next page. |

## resend_create_api_key

Create a new API key in Resend.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | A descriptive name for the API key. |
| `permission` | string | no | Permission scope: `"full_access"` or `"sending_access"`. |
| `domain_id` | string | no | Domain ID to restrict the key to (only for `sending_access`). |

## resend_list_api_keys

List all API keys in Resend.

### Parameters

*No parameters required.*

## resend_create_domain

Create a new domain in Resend.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Domain name (e.g. `"example.com"`). |
| `region` | string | no | Region for the domain: `"us-east-1"` or `"eu-west-1"`. |

## resend_get_domain

Retrieve a single domain by ID from Resend.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `domain_id` | string | yes | The ID of the domain to retrieve. |

## resend_list_domains

List all domains in Resend.

### Parameters

*No parameters required.*

## resend_verify_domain

Trigger domain verification in Resend.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `domain_id` | string | yes | The ID of the domain to verify. |

## resend_create_contact

Create a contact in a Resend audience.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `audience_id` | string | yes | The audience ID to add the contact to. |
| `email` | string | yes | Contact email address. |
| `first_name` | string | no | Contact first name. |
| `last_name` | string | no | Contact last name. |
| `unsubscribed` | boolean | no | Whether the contact is unsubscribed (default false). |

## Examples

### Send an email

```lua
local result = app.integrations.resend.resend_send_email({
  to = "[email protected]",
  from = "[email protected]",
  subject = "Welcome to MyApp",
  html = "<h1>Hello!</h1><p>Welcome aboard.</p>",
  tags = {
    { name = "category", value = "welcome" }
  }
})
print("Email ID: " .. result.id)
```

### Send a plain-text email with CC

```lua
local result = app.integrations.resend.resend_send_email({
  to = "[email protected]",
  from = "[email protected]",
  subject = "Meeting Notes",
  text = "Hi Alice,\n\nHere are the meeting notes from today...",
  cc = { "[email protected]" }
})
```

### Create and verify a domain

```lua
local domain = app.integrations.resend.resend_create_domain({
  name = "myapp.com",
  region = "us-east-1"
})

-- After adding DNS records...
local result = app.integrations.resend.resend_verify_domain({
  domain_id = domain.id
})
```

### Create a contact

```lua
local result = app.integrations.resend.resend_create_contact({
  audience_id = "aud_abc123",
  email = "[email protected]",
  first_name = "Jane",
  last_name = "Doe"
})
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.resend.work.function_name({...})
app.integrations.resend.personal.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.resend.resend_send_email({
  to = "example_to",
  from = "example_from",
  subject = "example_subject",
  html = "example_html",
  text = "example_text",
  cc = "example_cc",
  bcc = "example_bcc",
  reply_to = "example_reply_to"
})
print(result)

Functions

resend_send_email

Send an email through Resend. Supports HTML and plain-text content, CC, BCC, reply-to, tags for categorization, and custom email headers. Returns the sent email object including its ID.

Operation
Write write
Full name
resend.resend_send_email
ParameterTypeRequiredDescription
to string yes Recipient email address.
from string yes Sender email address (must be a verified domain).
subject string yes Email subject line.
html string no HTML body content.
text string no Plain-text body content.
cc array no CC recipient email addresses.
bcc array no BCC recipient email addresses.
reply_to array no Reply-to email addresses.
tags array no Tags to attach to the email. Each item should have "name" and "value" keys.
headers object no Custom email headers (key-value pairs).

resend_get_email

Retrieve a single email by its ID from Resend. Returns the email object including sender, recipient, subject, created_at, and delivery status.

Operation
Read read
Full name
resend.resend_get_email
ParameterTypeRequiredDescription
email_id string yes The ID of the email to retrieve.

resend_list_emails

List emails from Resend. Supports pagination with a limit and cursor token. Returns an array of email objects and a pagination token for the next page.

Operation
Read read
Full name
resend.resend_list_emails
ParameterTypeRequiredDescription
limit integer no Maximum number of emails to return (default 100, max 100).
token string no Cursor token for pagination — use the token from the previous response to get the next page.

resend_create_api_key

Create a new API key in Resend. You can set a permission scope (full_access or sending_access) and optionally restrict the key to a specific domain. Returns the created API key object including the key value.

Operation
Write write
Full name
resend.resend_create_api_key
ParameterTypeRequiredDescription
name string yes A descriptive name for the API key.
permission string no Permission scope: "full_access" or "sending_access".
domain_id string no Domain ID to restrict the key to (only for sending_access).

resend_list_api_keys

List all API keys in the Resend account. Returns an array of API key objects with their names, permissions, and creation dates. The actual key values are not returned for security reasons.

Operation
Read read
Full name
resend.resend_list_api_keys
ParameterTypeRequiredDescription
No parameters.

resend_create_domain

Create a new domain in Resend. You can optionally specify a region for the domain (us-east-1 or eu-west-1). Returns the created domain object including DNS records that need to be configured.

Operation
Write write
Full name
resend.resend_create_domain
ParameterTypeRequiredDescription
name string yes Domain name (e.g. "example.com").
region string no Region for the domain: "us-east-1" or "eu-west-1".

resend_get_domain

Retrieve a single domain by its ID from Resend. Returns the domain object including verification status and DNS records.

Operation
Read read
Full name
resend.resend_get_domain
ParameterTypeRequiredDescription
domain_id string yes The ID of the domain to retrieve.

resend_list_domains

List all domains in the Resend account. Returns an array of domain objects including their names, verification status, and regions.

Operation
Read read
Full name
resend.resend_list_domains
ParameterTypeRequiredDescription
No parameters.

resend_verify_domain

Trigger verification for a domain in Resend. This checks the DNS records for the domain and updates its verification status. Returns the domain object with the updated status.

Operation
Write write
Full name
resend.resend_verify_domain
ParameterTypeRequiredDescription
domain_id string yes The ID of the domain to verify.

resend_create_contact

Create a contact in a Resend audience. Requires the audience ID and the contact's email address. Optionally provide first name, last name, and unsubscribed status. Returns the created contact object.

Operation
Write write
Full name
resend.resend_create_contact
ParameterTypeRequiredDescription
audience_id string yes The audience ID to add the contact to.
email string yes Contact email address.
first_name string no Contact first name.
last_name string no Contact last name.
unsubscribed boolean no Whether the contact is unsubscribed (default false).