KosmoKrator

productivity

Resend Lua API for KosmoKrator Agents

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

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.

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 Resend workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.resend.email({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("resend"))' --json
kosmo integrations:lua --eval 'print(docs.read("resend.email"))' --json

Workflow file

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

workflow.lua
local resend = app.integrations.resend
local result = resend.email({})

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.resend, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.resend.default.* or app.integrations.resend.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Resend, 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.

Resend - Lua API Reference

Namespace: app.integrations.resend

This package exposes 83 generated tools from Resend’s official OpenAPI document at https://raw.githubusercontent.com/resend/resend-openapi/main/resend.yaml. Requests use Authorization: Bearer <api_key> against https://api.resend.com by default.

Common Operations

local sent = app.integrations.resend.send_email({
  from = "noreply@example.com",
  to = { "recipient@example.com" },
  subject = "Welcome",
  html = "<p>Hello</p>"
})

local domains = app.integrations.resend.list_domains({})
local contact = app.integrations.resend.create_contact({
  email = "jane@example.com",
  first_name = "Jane",
  last_name = "Doe",
  audience_id = "aud_123"
})

Generated Tool Shape

Tool names follow Resend’s official paths and summaries, normalized to snake_case with a resend_ prefix in metadata and exposed without the prefix in Lua. Existing common names such as send_email, get_email, list_emails, create_domain, list_domains, verify_domain, create_api_key, list_api_keys, and create_contact are preserved.

Path parameters with a single id accept id for convenience. Specific aliases such as email_id, domain_id, api_key_id, webhook_id, automation_id, contact_id, and segment_id are also accepted when the upstream path needs them.

Request bodies can be passed as body = { ... }. Generated tools also collect loose arguments that are not path, query, or header parameters into the JSON body.

Coverage Notes

The generated catalog covers emails, batch emails, scheduled email cancellation, sent and received attachments, domains, API keys, templates, audiences, contacts, broadcasts, webhooks, segments, topics, contact properties, logs, automations, and events.

Multi-Account Usage

app.integrations.resend.send_email({ from = "noreply@example.com", to = { "a@example.com" }, subject = "Hi", text = "Hello" })
app.integrations.resend.production.list_domains({})
app.integrations.resend.marketing.list_broadcasts({})

All functions are identical across accounts; only the resolved credentials differ.

Raw agent markdown
# Resend - Lua API Reference

Namespace: `app.integrations.resend`

This package exposes 83 generated tools from Resend's official OpenAPI document at `https://raw.githubusercontent.com/resend/resend-openapi/main/resend.yaml`. Requests use `Authorization: Bearer <api_key>` against `https://api.resend.com` by default.

## Common Operations

```lua
local sent = app.integrations.resend.send_email({
  from = "noreply@example.com",
  to = { "recipient@example.com" },
  subject = "Welcome",
  html = "<p>Hello</p>"
})

local domains = app.integrations.resend.list_domains({})
local contact = app.integrations.resend.create_contact({
  email = "jane@example.com",
  first_name = "Jane",
  last_name = "Doe",
  audience_id = "aud_123"
})
```

## Generated Tool Shape

Tool names follow Resend's official paths and summaries, normalized to snake_case with a `resend_` prefix in metadata and exposed without the prefix in Lua. Existing common names such as `send_email`, `get_email`, `list_emails`, `create_domain`, `list_domains`, `verify_domain`, `create_api_key`, `list_api_keys`, and `create_contact` are preserved.

Path parameters with a single id accept `id` for convenience. Specific aliases such as `email_id`, `domain_id`, `api_key_id`, `webhook_id`, `automation_id`, `contact_id`, and `segment_id` are also accepted when the upstream path needs them.

Request bodies can be passed as `body = { ... }`. Generated tools also collect loose arguments that are not path, query, or header parameters into the JSON body.

## Coverage Notes

The generated catalog covers emails, batch emails, scheduled email cancellation, sent and received attachments, domains, API keys, templates, audiences, contacts, broadcasts, webhooks, segments, topics, contact properties, logs, automations, and events.

## Multi-Account Usage

```lua
app.integrations.resend.send_email({ from = "noreply@example.com", to = { "a@example.com" }, subject = "Hi", text = "Hello" })
app.integrations.resend.production.list_domains({})
app.integrations.resend.marketing.list_broadcasts({})
```

All functions are identical across accounts; only the resolved credentials differ.
Metadata-derived Lua example
local result = app.integrations.resend.email({})
print(result)

Functions

email Write

Send an email

Lua path
app.integrations.resend.email
Full name
resend.resend_send_email
ParameterTypeRequiredDescription
No parameters.
retrieve_list_emails Read

Retrieve a list of emails

Lua path
app.integrations.resend.retrieve_list_emails
Full name
resend.resend_list_emails
ParameterTypeRequiredDescription
No parameters.
retrieve_single_email Read

Retrieve a single email

Lua path
app.integrations.resend.retrieve_single_email
Full name
resend.resend_get_email
ParameterTypeRequiredDescription
No parameters.
update_single_email Write

Update a single email

Lua path
app.integrations.resend.update_single_email
Full name
resend.resend_update_emails
ParameterTypeRequiredDescription
No parameters.
cancel_schedule_mail Write

Cancel the schedule of the e-mail.

Lua path
app.integrations.resend.cancel_schedule_mail
Full name
resend.resend_cancel_email
ParameterTypeRequiredDescription
No parameters.
trigger_up_100_batch_emails_at_once Write

Trigger up to 100 batch emails at once.

Lua path
app.integrations.resend.trigger_up_100_batch_emails_at_once
Full name
resend.resend_send_batch_emails
ParameterTypeRequiredDescription
No parameters.
retrieve_list_attachments_sent_email Read

Retrieve a list of attachments for a sent email

Lua path
app.integrations.resend.retrieve_list_attachments_sent_email
Full name
resend.resend_list_attachments
ParameterTypeRequiredDescription
No parameters.
retrieve_single_attachment_sent_email Read

Retrieve a single attachment for a sent email

Lua path
app.integrations.resend.retrieve_single_attachment_sent_email
Full name
resend.resend_get_attachments
ParameterTypeRequiredDescription
No parameters.
retrieve_list_received_emails Read

Retrieve a list of received emails

Lua path
app.integrations.resend.retrieve_list_received_emails
Full name
resend.resend_list_receiving
ParameterTypeRequiredDescription
No parameters.
retrieve_single_received_email Read

Retrieve a single received email

Lua path
app.integrations.resend.retrieve_single_received_email
Full name
resend.resend_get_receiving
ParameterTypeRequiredDescription
No parameters.
retrieve_list_attachments_received_email Read

Retrieve a list of attachments for a received email

Lua path
app.integrations.resend.retrieve_list_attachments_received_email
Full name
resend.resend_list_attachments_receiving_email_id_attachments
ParameterTypeRequiredDescription
No parameters.
retrieve_single_attachment_received_email Read

Retrieve a single attachment for a received email

Lua path
app.integrations.resend.retrieve_single_attachment_received_email
Full name
resend.resend_get_attachments_email_id_attachments_attachment_id
ParameterTypeRequiredDescription
No parameters.
create_new_domain Write

Create a new domain

Lua path
app.integrations.resend.create_new_domain
Full name
resend.resend_create_domain
ParameterTypeRequiredDescription
No parameters.
retrieve_list_domains Read

Retrieve a list of domains

Lua path
app.integrations.resend.retrieve_list_domains
Full name
resend.resend_list_domains
ParameterTypeRequiredDescription
No parameters.
retrieve_single_domain Read

Retrieve a single domain

Lua path
app.integrations.resend.retrieve_single_domain
Full name
resend.resend_get_domain
ParameterTypeRequiredDescription
No parameters.
update_existing_domain Write

Update an existing domain

Lua path
app.integrations.resend.update_existing_domain
Full name
resend.resend_update_domains
ParameterTypeRequiredDescription
No parameters.
remove_existing_domain Write

Remove an existing domain

Lua path
app.integrations.resend.remove_existing_domain
Full name
resend.resend_delete_domains
ParameterTypeRequiredDescription
No parameters.
verify_existing_domain Write

Triggers verification of the domain's DNS records including DKIM, SPF, and the tracking CNAME if a tracking subdomain is configured.

Lua path
app.integrations.resend.verify_existing_domain
Full name
resend.resend_verify_domain
ParameterTypeRequiredDescription
No parameters.
create_new_api_key Write

Create a new API key

Lua path
app.integrations.resend.create_new_api_key
Full name
resend.resend_create_api_key
ParameterTypeRequiredDescription
No parameters.
retrieve_list_api_keys Read

Retrieve a list of API keys

Lua path
app.integrations.resend.retrieve_list_api_keys
Full name
resend.resend_list_api_keys
ParameterTypeRequiredDescription
No parameters.
remove_existing_api_key Write

Remove an existing API key

Lua path
app.integrations.resend.remove_existing_api_key
Full name
resend.resend_delete_api_keys
ParameterTypeRequiredDescription
No parameters.
create_template Write

Create a template

Lua path
app.integrations.resend.create_template
Full name
resend.resend_create_templates
ParameterTypeRequiredDescription
No parameters.
retrieve_list_templates Read

Retrieve a list of templates

Lua path
app.integrations.resend.retrieve_list_templates
Full name
resend.resend_list_templates
ParameterTypeRequiredDescription
No parameters.
retrieve_single_template Read

Retrieve a single template

Lua path
app.integrations.resend.retrieve_single_template
Full name
resend.resend_get_templates
ParameterTypeRequiredDescription
No parameters.
update_existing_template Write

Update an existing template

Lua path
app.integrations.resend.update_existing_template
Full name
resend.resend_update_templates
ParameterTypeRequiredDescription
No parameters.
remove_existing_template Write

Remove an existing template

Lua path
app.integrations.resend.remove_existing_template
Full name
resend.resend_delete_templates
ParameterTypeRequiredDescription
No parameters.
publish_template Write

Publish a template

Lua path
app.integrations.resend.publish_template
Full name
resend.resend_publish_template
ParameterTypeRequiredDescription
No parameters.
duplicate_template Write

Duplicate a template

Lua path
app.integrations.resend.duplicate_template
Full name
resend.resend_duplicate_template
ParameterTypeRequiredDescription
No parameters.
create_list_contacts Write

Deprecated: Use Segments instead. These endpoints still work, but will be removed in the future.

Lua path
app.integrations.resend.create_list_contacts
Full name
resend.resend_create_audiences
ParameterTypeRequiredDescription
No parameters.
retrieve_list_audiences Read

Deprecated: Use Segments instead. These endpoints still work, but will be removed in the future.

Lua path
app.integrations.resend.retrieve_list_audiences
Full name
resend.resend_list_audiences
ParameterTypeRequiredDescription
No parameters.
remove_existing_audience Write

Deprecated: Use Segments instead. These endpoints still work, but will be removed in the future.

Lua path
app.integrations.resend.remove_existing_audience
Full name
resend.resend_delete_audiences
ParameterTypeRequiredDescription
No parameters.
retrieve_single_audience Read

Deprecated: Use Segments instead. These endpoints still work, but will be removed in the future.

Lua path
app.integrations.resend.retrieve_single_audience
Full name
resend.resend_get_audiences
ParameterTypeRequiredDescription
No parameters.
create_new_contact Write

Create a new contact

Lua path
app.integrations.resend.create_new_contact
Full name
resend.resend_create_contact
ParameterTypeRequiredDescription
No parameters.
retrieve_list_contacts Read

Retrieve a list of contacts

Lua path
app.integrations.resend.retrieve_list_contacts
Full name
resend.resend_list_contacts
ParameterTypeRequiredDescription
No parameters.
retrieve_single_contact_by_id_or_email Read

Retrieve a single contact by ID or email

Lua path
app.integrations.resend.retrieve_single_contact_by_id_or_email
Full name
resend.resend_get_contacts
ParameterTypeRequiredDescription
No parameters.
update_single_contact_by_id_or_email Write

Update a single contact by ID or email

Lua path
app.integrations.resend.update_single_contact_by_id_or_email
Full name
resend.resend_update_contacts
ParameterTypeRequiredDescription
No parameters.
remove_existing_contact_by_id_or_email Write

Remove an existing contact by ID or email

Lua path
app.integrations.resend.remove_existing_contact_by_id_or_email
Full name
resend.resend_delete_contacts
ParameterTypeRequiredDescription
No parameters.
create_broadcast Write

Create a broadcast

Lua path
app.integrations.resend.create_broadcast
Full name
resend.resend_create_broadcasts
ParameterTypeRequiredDescription
No parameters.
retrieve_list_broadcasts Read

Retrieve a list of broadcasts

Lua path
app.integrations.resend.retrieve_list_broadcasts
Full name
resend.resend_list_broadcasts
ParameterTypeRequiredDescription
No parameters.
remove_existing_broadcast_that_is_draft_status Write

Remove an existing broadcast that is in the draft status

Lua path
app.integrations.resend.remove_existing_broadcast_that_is_draft_status
Full name
resend.resend_delete_broadcasts
ParameterTypeRequiredDescription
No parameters.
retrieve_single_broadcast Read

Retrieve a single broadcast

Lua path
app.integrations.resend.retrieve_single_broadcast
Full name
resend.resend_get_broadcasts
ParameterTypeRequiredDescription
No parameters.
update_existing_broadcast Write

Update an existing broadcast

Lua path
app.integrations.resend.update_existing_broadcast
Full name
resend.resend_update_broadcasts
ParameterTypeRequiredDescription
No parameters.
or_schedule_broadcast Write

Send or schedule a broadcast

Lua path
app.integrations.resend.or_schedule_broadcast
Full name
resend.resend_send_broadcasts
ParameterTypeRequiredDescription
No parameters.
create_new_webhook Write

Create a new webhook

Lua path
app.integrations.resend.create_new_webhook
Full name
resend.resend_create_webhooks
ParameterTypeRequiredDescription
No parameters.
retrieve_list_webhooks Read

Retrieve a list of webhooks

Lua path
app.integrations.resend.retrieve_list_webhooks
Full name
resend.resend_list_webhooks
ParameterTypeRequiredDescription
No parameters.
retrieve_single_webhook Read

Retrieve a single webhook

Lua path
app.integrations.resend.retrieve_single_webhook
Full name
resend.resend_get_webhooks
ParameterTypeRequiredDescription
No parameters.
update_existing_webhook Write

Update an existing webhook

Lua path
app.integrations.resend.update_existing_webhook
Full name
resend.resend_update_webhooks
ParameterTypeRequiredDescription
No parameters.
remove_existing_webhook Write

Remove an existing webhook

Lua path
app.integrations.resend.remove_existing_webhook
Full name
resend.resend_delete_webhooks
ParameterTypeRequiredDescription
No parameters.
create_new_segment Write

Create a new segment

Lua path
app.integrations.resend.create_new_segment
Full name
resend.resend_create_segments
ParameterTypeRequiredDescription
No parameters.
retrieve_list_segments Read

Retrieve a list of segments

Lua path
app.integrations.resend.retrieve_list_segments
Full name
resend.resend_list_segments
ParameterTypeRequiredDescription
No parameters.
retrieve_single_segment Read

Retrieve a single segment

Lua path
app.integrations.resend.retrieve_single_segment
Full name
resend.resend_get_segments
ParameterTypeRequiredDescription
No parameters.
remove_existing_segment Write

Remove an existing segment

Lua path
app.integrations.resend.remove_existing_segment
Full name
resend.resend_delete_segments
ParameterTypeRequiredDescription
No parameters.
create_new_topic Write

Create a new topic

Lua path
app.integrations.resend.create_new_topic
Full name
resend.resend_create_topics
ParameterTypeRequiredDescription
No parameters.
retrieve_list_topics Read

Retrieve a list of topics

Lua path
app.integrations.resend.retrieve_list_topics
Full name
resend.resend_list_topics
ParameterTypeRequiredDescription
No parameters.
retrieve_single_topic Read

Retrieve a single topic

Lua path
app.integrations.resend.retrieve_single_topic
Full name
resend.resend_get_topics
ParameterTypeRequiredDescription
No parameters.
update_existing_topic Write

Update an existing topic

Lua path
app.integrations.resend.update_existing_topic
Full name
resend.resend_update_topics
ParameterTypeRequiredDescription
No parameters.
remove_existing_topic Write

Remove an existing topic

Lua path
app.integrations.resend.remove_existing_topic
Full name
resend.resend_delete_topics
ParameterTypeRequiredDescription
No parameters.
create_new_contact_property Write

Create a new contact property

Lua path
app.integrations.resend.create_new_contact_property
Full name
resend.resend_create_contact_properties
ParameterTypeRequiredDescription
No parameters.
retrieve_list_contact_properties Read

Retrieve a list of contact properties

Lua path
app.integrations.resend.retrieve_list_contact_properties
Full name
resend.resend_list_contact_properties
ParameterTypeRequiredDescription
No parameters.
retrieve_single_contact_property Read

Retrieve a single contact property

Lua path
app.integrations.resend.retrieve_single_contact_property
Full name
resend.resend_get_contact_properties
ParameterTypeRequiredDescription
No parameters.
update_existing_contact_property Write

Update an existing contact property

Lua path
app.integrations.resend.update_existing_contact_property
Full name
resend.resend_update_contact_properties
ParameterTypeRequiredDescription
No parameters.
remove_existing_contact_property Write

Remove an existing contact property

Lua path
app.integrations.resend.remove_existing_contact_property
Full name
resend.resend_delete_contact_properties
ParameterTypeRequiredDescription
No parameters.
retrieve_list_segments_contact Read

Retrieve a list of segments for a contact

Lua path
app.integrations.resend.retrieve_list_segments_contact
Full name
resend.resend_list_segments_contacts_contact_id_segments
ParameterTypeRequiredDescription
No parameters.
add_contact_segment Write

Add a contact to a segment

Lua path
app.integrations.resend.add_contact_segment
Full name
resend.resend_create_segments_contact_id_segments_segment_id
ParameterTypeRequiredDescription
No parameters.
remove_contact_from_segment Write

Remove a contact from a segment

Lua path
app.integrations.resend.remove_contact_from_segment
Full name
resend.resend_delete_segments_contact_id_segments_segment_id
ParameterTypeRequiredDescription
No parameters.
retrieve_topics_contact Read

Retrieve topics for a contact

Lua path
app.integrations.resend.retrieve_topics_contact
Full name
resend.resend_get_topics_contacts_contact_id_topics
ParameterTypeRequiredDescription
No parameters.
update_topics_contact Write

Update topics for a contact

Lua path
app.integrations.resend.update_topics_contact
Full name
resend.resend_update_topics_contacts_contact_id_topics
ParameterTypeRequiredDescription
No parameters.
retrieve_list_logs Read

Retrieve a list of logs

Lua path
app.integrations.resend.retrieve_list_logs
Full name
resend.resend_list_logs
ParameterTypeRequiredDescription
No parameters.
retrieve_single_log Read

Retrieve a single log

Lua path
app.integrations.resend.retrieve_single_log
Full name
resend.resend_get_logs
ParameterTypeRequiredDescription
No parameters.
create_automation Write

Create an automation

Lua path
app.integrations.resend.create_automation
Full name
resend.resend_create_automations
ParameterTypeRequiredDescription
No parameters.
retrieve_list_automations Read

Retrieve a list of automations

Lua path
app.integrations.resend.retrieve_list_automations
Full name
resend.resend_list_automations
ParameterTypeRequiredDescription
No parameters.
retrieve_single_automation Read

Retrieve a single automation

Lua path
app.integrations.resend.retrieve_single_automation
Full name
resend.resend_get_automations
ParameterTypeRequiredDescription
No parameters.
update_automation Write

Update an automation

Lua path
app.integrations.resend.update_automation
Full name
resend.resend_update_automations
ParameterTypeRequiredDescription
No parameters.
delete_automation Write

Delete an automation

Lua path
app.integrations.resend.delete_automation
Full name
resend.resend_delete_automations
ParameterTypeRequiredDescription
No parameters.
stop_automation Write

Stop an automation

Lua path
app.integrations.resend.stop_automation
Full name
resend.resend_stop_automations
ParameterTypeRequiredDescription
No parameters.
retrieve_list_automation_runs Read

Retrieve a list of automation runs

Lua path
app.integrations.resend.retrieve_list_automation_runs
Full name
resend.resend_list_runs
ParameterTypeRequiredDescription
No parameters.
retrieve_single_automation_run Read

Retrieve a single automation run

Lua path
app.integrations.resend.retrieve_single_automation_run
Full name
resend.resend_get_runs
ParameterTypeRequiredDescription
No parameters.
create_event Write

Create an event

Lua path
app.integrations.resend.create_event
Full name
resend.resend_create_events
ParameterTypeRequiredDescription
No parameters.
retrieve_list_events Read

Retrieve a list of events

Lua path
app.integrations.resend.retrieve_list_events
Full name
resend.resend_list_events
ParameterTypeRequiredDescription
No parameters.
event Write

Send an event

Lua path
app.integrations.resend.event
Full name
resend.resend_send_events
ParameterTypeRequiredDescription
No parameters.
retrieve_single_event Read

Retrieve a single event

Lua path
app.integrations.resend.retrieve_single_event
Full name
resend.resend_get_events
ParameterTypeRequiredDescription
No parameters.
update_event Write

Update an event

Lua path
app.integrations.resend.update_event
Full name
resend.resend_update_events
ParameterTypeRequiredDescription
No parameters.
delete_event Write

Delete an event

Lua path
app.integrations.resend.delete_event
Full name
resend.resend_delete_events
ParameterTypeRequiredDescription
No parameters.