KosmoKrator

productivity

Hunter Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.hunter.domain_search({domain = "example_domain", limit = 1, offset = 1, type = "example_type"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("hunter"))' --json
kosmo integrations:lua --eval 'print(docs.read("hunter.domain_search"))' --json

Workflow file

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

workflow.lua
local hunter = app.integrations.hunter
local result = hunter.domain_search({domain = "example_domain", limit = 1, offset = 1, type = "example_type"})

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

MCP-only Lua

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

Hunter.io — Lua API Reference

Search for professional email addresses associated with a domain.

Parameters

NameTypeRequiredDescription
domainstringyesThe domain to search (e.g., "example.com")
limitintegernoMaximum number of results (default: 10, max: 100)
offsetintegernoNumber of results to skip for pagination
typestringnoFilter by email type: "personal" or "generic"

Example

local result = app.integrations.hunter.domain_search({
  domain = "example.com",
  limit = 20
})

for _, email in ipairs(result.data.emails) do
  print(email.value .. " - " .. (email.first_name or "") .. " " .. (email.last_name or ""))
end

email_finder

Find the most likely email address for a person based on their name and company domain.

Parameters

NameTypeRequiredDescription
domainstringyesThe company domain (e.g., "example.com")
first_namestringnoThe person’s first name
last_namestringnoThe person’s last name

Example

local result = app.integrations.hunter.email_finder({
  domain = "example.com",
  first_name = "John",
  last_name = "Doe"
})

print("Email: " .. result.data.email)
print("Confidence: " .. result.data.score .. "%")

email_verifier

Verify the deliverability of an email address.

Parameters

NameTypeRequiredDescription
emailstringyesThe email address to verify

Example

local result = app.integrations.hunter.email_verifier({
  email = "john@example.com"
})

print("Result: " .. result.data.result) -- deliverable, undeliverable, risky, unknown
print("Confidence: " .. result.data.score .. "%")

email_count

Get the number of email addresses found for a domain. This endpoint does not consume API credits.

Parameters

NameTypeRequiredDescription
domainstringyesThe domain to count emails for

Example

local result = app.integrations.hunter.email_count({
  domain = "example.com"
})

print("Total emails: " .. result.data.total)
print("Personal: " .. result.data.personal)
print("Generic: " .. result.data.generic)

list_leads

List leads stored in your Hunter.io account.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of leads to return (default: 20, max: 100)
offsetintegernoNumber of leads to skip for pagination

Example

local result = app.integrations.hunter.list_leads({
  limit = 50,
  offset = 0
})

for _, lead in ipairs(result.data.leads) do
  print(lead.id .. ": " .. lead.email .. " - " .. (lead.first_name or "") .. " " .. (lead.last_name or ""))
end

get_lead

Retrieve a single lead by its ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe lead ID

Example

local result = app.integrations.hunter.get_lead({
  id = 12345
})

print("Email: " .. result.data.email)
print("Name: " .. (result.data.first_name or "") .. " " .. (result.data.last_name or ""))

create_lead

Create a new lead in Hunter.io.

Parameters

NameTypeRequiredDescription
emailstringyesThe lead’s email address
first_namestringnoThe lead’s first name
last_namestringnoThe lead’s last name
list_idintegernoID of the lead list to add this lead to

Example

local result = app.integrations.hunter.create_lead({
  email = "john@example.com",
  first_name = "John",
  last_name = "Doe",
  list_id = 42
})

print("Created lead: " .. result.data.id)

get_current_user

Get account information and API usage for the authenticated Hunter.io user.

Parameters

None.

Example

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

print("Account: " .. result.data.email)
print("Plan: " .. result.data.plan_name)
print("Requests used: " .. result.data.usage.requests.used .. " / " .. result.data.usage.requests.limit)

Multi-Account Usage

If you have multiple Hunter.io accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.hunter.domain_search({domain = "example.com"})

-- Explicit default (portable across setups)
app.integrations.hunter.default.domain_search({domain = "example.com"})

-- Named accounts
app.integrations.hunter.work.domain_search({domain = "example.com"})
app.integrations.hunter.personal.domain_search({domain = "example.com"})

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

Raw agent markdown
# Hunter.io — Lua API Reference

## domain_search

Search for professional email addresses associated with a domain.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `domain` | string | yes | The domain to search (e.g., `"example.com"`) |
| `limit` | integer | no | Maximum number of results (default: 10, max: 100) |
| `offset` | integer | no | Number of results to skip for pagination |
| `type` | string | no | Filter by email type: `"personal"` or `"generic"` |

### Example

```lua
local result = app.integrations.hunter.domain_search({
  domain = "example.com",
  limit = 20
})

for _, email in ipairs(result.data.emails) do
  print(email.value .. " - " .. (email.first_name or "") .. " " .. (email.last_name or ""))
end
```

---

## email_finder

Find the most likely email address for a person based on their name and company domain.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `domain` | string | yes | The company domain (e.g., `"example.com"`) |
| `first_name` | string | no | The person's first name |
| `last_name` | string | no | The person's last name |

### Example

```lua
local result = app.integrations.hunter.email_finder({
  domain = "example.com",
  first_name = "John",
  last_name = "Doe"
})

print("Email: " .. result.data.email)
print("Confidence: " .. result.data.score .. "%")
```

---

## email_verifier

Verify the deliverability of an email address.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `email` | string | yes | The email address to verify |

### Example

```lua
local result = app.integrations.hunter.email_verifier({
  email = "john@example.com"
})

print("Result: " .. result.data.result) -- deliverable, undeliverable, risky, unknown
print("Confidence: " .. result.data.score .. "%")
```

---

## email_count

Get the number of email addresses found for a domain. This endpoint does not consume API credits.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `domain` | string | yes | The domain to count emails for |

### Example

```lua
local result = app.integrations.hunter.email_count({
  domain = "example.com"
})

print("Total emails: " .. result.data.total)
print("Personal: " .. result.data.personal)
print("Generic: " .. result.data.generic)
```

---

## list_leads

List leads stored in your Hunter.io account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of leads to return (default: 20, max: 100) |
| `offset` | integer | no | Number of leads to skip for pagination |

### Example

```lua
local result = app.integrations.hunter.list_leads({
  limit = 50,
  offset = 0
})

for _, lead in ipairs(result.data.leads) do
  print(lead.id .. ": " .. lead.email .. " - " .. (lead.first_name or "") .. " " .. (lead.last_name or ""))
end
```

---

## get_lead

Retrieve a single lead by its ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The lead ID |

### Example

```lua
local result = app.integrations.hunter.get_lead({
  id = 12345
})

print("Email: " .. result.data.email)
print("Name: " .. (result.data.first_name or "") .. " " .. (result.data.last_name or ""))
```

---

## create_lead

Create a new lead in Hunter.io.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `email` | string | yes | The lead's email address |
| `first_name` | string | no | The lead's first name |
| `last_name` | string | no | The lead's last name |
| `list_id` | integer | no | ID of the lead list to add this lead to |

### Example

```lua
local result = app.integrations.hunter.create_lead({
  email = "john@example.com",
  first_name = "John",
  last_name = "Doe",
  list_id = 42
})

print("Created lead: " .. result.data.id)
```

---

## get_current_user

Get account information and API usage for the authenticated Hunter.io user.

### Parameters

None.

### Example

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

print("Account: " .. result.data.email)
print("Plan: " .. result.data.plan_name)
print("Requests used: " .. result.data.usage.requests.used .. " / " .. result.data.usage.requests.limit)
```

---

## Multi-Account Usage

If you have multiple Hunter.io accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.hunter.domain_search({domain = "example.com"})

-- Explicit default (portable across setups)
app.integrations.hunter.default.domain_search({domain = "example.com"})

-- Named accounts
app.integrations.hunter.work.domain_search({domain = "example.com"})
app.integrations.hunter.personal.domain_search({domain = "example.com"})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.hunter.domain_search({domain = "example_domain", limit = 1, offset = 1, type = "example_type"})
print(result)

Functions

email_finder Read

Find the most likely professional email address for a person based on their name and company domain. Returns the email with a confidence score and sources where the email was found.

Lua path
app.integrations.hunter.email_finder
Full name
hunter.hunter_email_finder
ParameterTypeRequiredDescription
domain string yes The company domain (e.g., "example.com").
first_name string no The person's first name.
last_name string no The person's last name.
email_verifier Read

Verify the deliverability of an email address. Checks whether the email is valid, the mailbox exists, and accepts mail. Returns a result status (deliverable, undeliverable, risky, or unknown) along with confidence scores and SMTP details.

Lua path
app.integrations.hunter.email_verifier
Full name
hunter.hunter_email_verifier
ParameterTypeRequiredDescription
email string yes The email address to verify.
email_count Read

Get the total number of email addresses Hunter.io has found for a domain. Returns counts broken down by email type (personal, generic) and department. This endpoint does not consume API credits.

Lua path
app.integrations.hunter.email_count
Full name
hunter.hunter_email_count
ParameterTypeRequiredDescription
domain string yes The domain to count emails for (e.g., "example.com").
list_leads Read

List leads stored in your Hunter.io account. Supports pagination with limit and offset parameters. Returns lead details including email, name, and associated lists.

Lua path
app.integrations.hunter.list_leads
Full name
hunter.hunter_list_leads
ParameterTypeRequiredDescription
limit integer no Maximum number of leads to return (default: 20, max: 100).
offset integer no Number of leads to skip for pagination.
get_lead Read

Retrieve detailed information about a single lead by its ID. Returns the lead's email address, name, company, and any associated lists or custom fields.

Lua path
app.integrations.hunter.get_lead
Full name
hunter.hunter_get_lead
ParameterTypeRequiredDescription
id integer yes The lead ID.
create_lead Write

Create a new lead in Hunter.io. Requires an email address. Optionally include first name, last name, and a list ID to add the lead to a specific lead list. Returns the created lead object with its ID.

Lua path
app.integrations.hunter.create_lead
Full name
hunter.hunter_create_lead
ParameterTypeRequiredDescription
email string yes The lead's email address.
first_name string no The lead's first name.
last_name string no The lead's last name.
list_id integer no ID of the lead list to add this lead to.
get_current_user Read

Get information about the authenticated Hunter.io account, including the user's name, email, plan details, and API usage (requests made and remaining). Useful for verifying the API key works and checking usage limits.

Lua path
app.integrations.hunter.get_current_user
Full name
hunter.hunter_get_current_user
ParameterTypeRequiredDescription
No parameters.