KosmoKrator

marketing

Autopilot Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API key auth

Lua Namespace

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

Autopilot — Lua API Reference

list_contacts

List contacts in your Autopilot account.

Parameters

NameTypeRequiredDescription
limitintegernoNumber of contacts to return (default: 50, max: 100)
bookmarkstringnoPagination bookmark from a previous response

Example

local result = app.integrations["autopilot"].list_contacts({
  limit = 50
})

for _, contact in ipairs(result.contacts) do
  print(contact.Email .. " - " .. (contact.FirstName or ""))
end

get_contact

Get detailed information about a specific Autopilot contact.

Parameters

NameTypeRequiredDescription
contact_idstringyesThe contact ID or email address

Example

local result = app.integrations["autopilot"].get_contact({
  contact_id = "[email protected]"
})

print("Name: " .. (result.FirstName or "") .. " " .. (result.LastName or ""))
print("Email: " .. result.Email)

create_contact

Create or update a contact in Autopilot.

Parameters

NameTypeRequiredDescription
emailstringyesThe contact’s email address
first_namestringnoThe contact’s first name
last_namestringnoThe contact’s last name
phonestringnoThe contact’s phone number
titlestringnoThe contact’s job title
companystringnoThe contact’s company name
custom_fieldsobjectnoCustom field key-value pairs

Example

local result = app.integrations["autopilot"].create_contact({
  email = "[email protected]",
  first_name = "John",
  last_name = "Doe",
  company = "Acme Inc"
})

print(result.message)

list_lists

List all lists in your Autopilot account.

Parameters

None.

Example

local result = app.integrations["autopilot"].list_lists()

for _, list in ipairs(result.lists) do
  print(list.Title .. " (" .. list.list_id .. ")")
end

get_list

Get detailed information about a specific Autopilot list.

Parameters

NameTypeRequiredDescription
list_idstringyesThe list ID

Example

local result = app.integrations["autopilot"].get_list({
  list_id = "abc123"
})

print("List: " .. result.Title)

list_journeys

List all journeys in your Autopilot account.

Parameters

None.

Example

local result = app.integrations["autopilot"].list_journeys()

for _, journey in ipairs(result.journeys) do
  print(journey.Name .. " (" .. journey.journey_id .. ")")
end

get_current_user

Get the authenticated user’s Autopilot account details.

Parameters

None.

Example

local result = app.integrations["autopilot"].get_current_user()

print("Account connected successfully")

Multi-Account Usage

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

-- Default account (always works)
app.integrations["autopilot"].list_contacts({})

-- Explicit default (portable across setups)
app.integrations["autopilot"].default.list_contacts({})

-- Named accounts
app.integrations["autopilot"].marketing.list_contacts({})
app.integrations["autopilot"].sales.list_contacts({})

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

Raw agent markdown
# Autopilot — Lua API Reference

## list_contacts

List contacts in your Autopilot account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Number of contacts to return (default: 50, max: 100) |
| `bookmark` | string | no | Pagination bookmark from a previous response |

### Example

```lua
local result = app.integrations["autopilot"].list_contacts({
  limit = 50
})

for _, contact in ipairs(result.contacts) do
  print(contact.Email .. " - " .. (contact.FirstName or ""))
end
```

---

## get_contact

Get detailed information about a specific Autopilot contact.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `contact_id` | string | yes | The contact ID or email address |

### Example

```lua
local result = app.integrations["autopilot"].get_contact({
  contact_id = "[email protected]"
})

print("Name: " .. (result.FirstName or "") .. " " .. (result.LastName or ""))
print("Email: " .. result.Email)
```

---

## create_contact

Create or update a contact in Autopilot.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `email` | string | yes | The contact's email address |
| `first_name` | string | no | The contact's first name |
| `last_name` | string | no | The contact's last name |
| `phone` | string | no | The contact's phone number |
| `title` | string | no | The contact's job title |
| `company` | string | no | The contact's company name |
| `custom_fields` | object | no | Custom field key-value pairs |

### Example

```lua
local result = app.integrations["autopilot"].create_contact({
  email = "[email protected]",
  first_name = "John",
  last_name = "Doe",
  company = "Acme Inc"
})

print(result.message)
```

---

## list_lists

List all lists in your Autopilot account.

### Parameters

None.

### Example

```lua
local result = app.integrations["autopilot"].list_lists()

for _, list in ipairs(result.lists) do
  print(list.Title .. " (" .. list.list_id .. ")")
end
```

---

## get_list

Get detailed information about a specific Autopilot list.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `list_id` | string | yes | The list ID |

### Example

```lua
local result = app.integrations["autopilot"].get_list({
  list_id = "abc123"
})

print("List: " .. result.Title)
```

---

## list_journeys

List all journeys in your Autopilot account.

### Parameters

None.

### Example

```lua
local result = app.integrations["autopilot"].list_journeys()

for _, journey in ipairs(result.journeys) do
  print(journey.Name .. " (" .. journey.journey_id .. ")")
end
```

---

## get_current_user

Get the authenticated user's Autopilot account details.

### Parameters

None.

### Example

```lua
local result = app.integrations["autopilot"].get_current_user()

print("Account connected successfully")
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations["autopilot"].list_contacts({})

-- Explicit default (portable across setups)
app.integrations["autopilot"].default.list_contacts({})

-- Named accounts
app.integrations["autopilot"].marketing.list_contacts({})
app.integrations["autopilot"].sales.list_contacts({})
```

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

Metadata-Derived Lua Example

local result = app.integrations.autopilot.autopilot_list_contacts({
  limit = 1,
  bookmark = "example_bookmark"
})
print(result)

Functions

autopilot_list_contacts

List contacts in your Autopilot account. Returns contact IDs, emails, and names.

Operation
Read read
Full name
autopilot.autopilot_list_contacts
ParameterTypeRequiredDescription
limit integer no Number of contacts to return (default: 50, max: 100).
bookmark string no Pagination bookmark from a previous response.

autopilot_get_contact

Get detailed information about a specific Autopilot contact by ID or email address.

Operation
Read read
Full name
autopilot.autopilot_get_contact
ParameterTypeRequiredDescription
contact_id string yes The contact ID or email address.

autopilot_create_contact

Create or update a contact in Autopilot. Requires an email address; other fields are optional.

Operation
Write write
Full name
autopilot.autopilot_create_contact
ParameterTypeRequiredDescription
email string yes The contact's email address.
first_name string no The contact's first name.
last_name string no The contact's last name.
phone string no The contact's phone number.
title string no The contact's job title.
company string no The contact's company name.
custom_fields object no Custom field key-value pairs for the contact.

autopilot_list_lists

List all lists in your Autopilot account. Returns list IDs and titles.

Operation
Read read
Full name
autopilot.autopilot_list_lists
ParameterTypeRequiredDescription
No parameters.

autopilot_get_list

Get detailed information about a specific Autopilot list, including contacts.

Operation
Read read
Full name
autopilot.autopilot_get_list
ParameterTypeRequiredDescription
list_id string yes The list ID.

autopilot_list_journeys

List all journeys in your Autopilot account. Returns journey IDs and names.

Operation
Read read
Full name
autopilot.autopilot_list_journeys
ParameterTypeRequiredDescription
No parameters.

autopilot_get_current_user

Get the authenticated user's Autopilot account details.

Operation
Read read
Full name
autopilot.autopilot_get_current_user
ParameterTypeRequiredDescription
No parameters.