KosmoKrator

crm

Copper CRM Lua API for KosmoKrator Agents

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

13 functions 8 read 5 write API key auth

Lua Namespace

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

Copper CRM — Lua API Reference

copper_list_contacts

Search and list contacts in Copper CRM.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of contacts per page (default: 25, max: 200)
sort_bystringnoField to sort by (e.g., "name", "created_at")

Examples

local result = app.integrations.copper.copper_list_contacts({
  page_size = 50,
  sort_by = "name"
})

for _, contact in ipairs(result) do
  print(contact.name .. " (ID: " .. contact.id .. ")")
end

copper_get_contact

Get details of a specific contact by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe Copper contact ID

Examples

local contact = app.integrations.copper.copper_get_contact({
  id = 12345
})

print(contact.name)
print(contact.emails[1].email)

copper_create_contact

Create a new contact in Copper CRM.

Parameters

NameTypeRequiredDescription
namestringyesFull name of the contact
emailstringnoEmail address

Examples

local contact = app.integrations.copper.copper_create_contact({
  name = "Jane Smith",
  email = "[email protected]"
})

print("Created contact ID: " .. contact.id)

copper_update_contact

Update an existing contact in Copper CRM.

Parameters

NameTypeRequiredDescription
idintegeryesThe Copper contact ID to update
namestringnoUpdated full name
emailstringnoUpdated email address

Examples

local contact = app.integrations.copper.copper_update_contact({
  id = 12345,
  name = "Jane Smith-Jones"
})

print("Updated: " .. contact.name)

copper_delete_contact

Delete a contact from Copper CRM. This action cannot be undone.

Parameters

NameTypeRequiredDescription
idintegeryesThe Copper contact ID to delete

Examples

app.integrations.copper.copper_delete_contact({
  id = 12345
})

copper_list_companies

Search and list companies in Copper CRM.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of companies per page (default: 25, max: 200)
sort_bystringnoField to sort by (e.g., "name", "created_at")

Examples

local result = app.integrations.copper.copper_list_companies({
  page_size = 50
})

for _, company in ipairs(result) do
  print(company.name .. " (ID: " .. company.id .. ")")
end

copper_get_company

Get details of a specific company by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe Copper company ID

Examples

local company = app.integrations.copper.copper_get_company({
  id = 67890
})

print(company.name)

copper_create_company

Create a new company in Copper CRM.

Parameters

NameTypeRequiredDescription
namestringyesCompany name

Examples

local company = app.integrations.copper.copper_create_company({
  name = "Acme Corp"
})

print("Created company ID: " .. company.id)

copper_list_opportunities

Search and list opportunities (deals) in Copper CRM.

Parameters

NameTypeRequiredDescription
page_sizeintegernoNumber of opportunities per page (default: 25, max: 200)
sort_bystringnoField to sort by (e.g., "name", "created_at")

Examples

local result = app.integrations.copper.copper_list_opportunities({
  page_size = 50
})

for _, opp in ipairs(result) do
  print(opp.name .. " — $" .. (opp.monetary_value or 0))
end

copper_get_opportunity

Get details of a specific opportunity by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe Copper opportunity ID

Examples

local opp = app.integrations.copper.copper_get_opportunity({
  id = 54321
})

print(opp.name)
print("Value: $" .. (opp.monetary_value or 0))

copper_create_opportunity

Create a new opportunity (deal) in Copper CRM.

Parameters

NameTypeRequiredDescription
namestringyesOpportunity name
pipeline_idintegeryesID of the pipeline — use copper_list_pipelines to find available IDs

Examples

-- First, get available pipelines
local pipelines = app.integrations.copper.copper_list_pipelines({})

-- Create an opportunity in the first pipeline
local opp = app.integrations.copper.copper_create_opportunity({
  name = "New Deal",
  pipeline_id = pipelines[1].id
})

print("Created opportunity ID: " .. opp.id)

copper_list_pipelines

List all sales pipelines in Copper CRM. Each pipeline contains stages that opportunities move through.

Parameters

This function takes no parameters.

Examples

local pipelines = app.integrations.copper.copper_list_pipelines({})

for _, pipeline in ipairs(pipelines) do
  print("Pipeline: " .. pipeline.name .. " (ID: " .. pipeline.id .. ")")
  for _, stage in ipairs(pipeline.stages or {}) do
    print("  Stage: " .. stage.name .. " (ID: " .. stage.id .. ")")
  end
end

copper_get_current_user

Get the currently authenticated Copper CRM user. Useful for verifying the connection and account context.

Parameters

This function takes no parameters.

Examples

local user = app.integrations.copper.copper_get_current_user({})

print("Logged in as: " .. (user.first_name or "") .. " " .. (user.last_name or ""))
print("Email: " .. user.email)

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.copper.production.function_name({...})
app.integrations.copper.staging.function_name({...})

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

Raw agent markdown
# Copper CRM — Lua API Reference

## copper_list_contacts

Search and list contacts in Copper CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of contacts per page (default: 25, max: 200) |
| `sort_by` | string | no | Field to sort by (e.g., `"name"`, `"created_at"`) |

### Examples

```lua
local result = app.integrations.copper.copper_list_contacts({
  page_size = 50,
  sort_by = "name"
})

for _, contact in ipairs(result) do
  print(contact.name .. " (ID: " .. contact.id .. ")")
end
```

---

## copper_get_contact

Get details of a specific contact by ID.

### Parameters

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

### Examples

```lua
local contact = app.integrations.copper.copper_get_contact({
  id = 12345
})

print(contact.name)
print(contact.emails[1].email)
```

---

## copper_create_contact

Create a new contact in Copper CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Full name of the contact |
| `email` | string | no | Email address |

### Examples

```lua
local contact = app.integrations.copper.copper_create_contact({
  name = "Jane Smith",
  email = "[email protected]"
})

print("Created contact ID: " .. contact.id)
```

---

## copper_update_contact

Update an existing contact in Copper CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The Copper contact ID to update |
| `name` | string | no | Updated full name |
| `email` | string | no | Updated email address |

### Examples

```lua
local contact = app.integrations.copper.copper_update_contact({
  id = 12345,
  name = "Jane Smith-Jones"
})

print("Updated: " .. contact.name)
```

---

## copper_delete_contact

Delete a contact from Copper CRM. This action cannot be undone.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | integer | yes | The Copper contact ID to delete |

### Examples

```lua
app.integrations.copper.copper_delete_contact({
  id = 12345
})
```

---

## copper_list_companies

Search and list companies in Copper CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of companies per page (default: 25, max: 200) |
| `sort_by` | string | no | Field to sort by (e.g., `"name"`, `"created_at"`) |

### Examples

```lua
local result = app.integrations.copper.copper_list_companies({
  page_size = 50
})

for _, company in ipairs(result) do
  print(company.name .. " (ID: " .. company.id .. ")")
end
```

---

## copper_get_company

Get details of a specific company by ID.

### Parameters

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

### Examples

```lua
local company = app.integrations.copper.copper_get_company({
  id = 67890
})

print(company.name)
```

---

## copper_create_company

Create a new company in Copper CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Company name |

### Examples

```lua
local company = app.integrations.copper.copper_create_company({
  name = "Acme Corp"
})

print("Created company ID: " .. company.id)
```

---

## copper_list_opportunities

Search and list opportunities (deals) in Copper CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page_size` | integer | no | Number of opportunities per page (default: 25, max: 200) |
| `sort_by` | string | no | Field to sort by (e.g., `"name"`, `"created_at"`) |

### Examples

```lua
local result = app.integrations.copper.copper_list_opportunities({
  page_size = 50
})

for _, opp in ipairs(result) do
  print(opp.name .. " — $" .. (opp.monetary_value or 0))
end
```

---

## copper_get_opportunity

Get details of a specific opportunity by ID.

### Parameters

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

### Examples

```lua
local opp = app.integrations.copper.copper_get_opportunity({
  id = 54321
})

print(opp.name)
print("Value: $" .. (opp.monetary_value or 0))
```

---

## copper_create_opportunity

Create a new opportunity (deal) in Copper CRM.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Opportunity name |
| `pipeline_id` | integer | yes | ID of the pipeline — use `copper_list_pipelines` to find available IDs |

### Examples

```lua
-- First, get available pipelines
local pipelines = app.integrations.copper.copper_list_pipelines({})

-- Create an opportunity in the first pipeline
local opp = app.integrations.copper.copper_create_opportunity({
  name = "New Deal",
  pipeline_id = pipelines[1].id
})

print("Created opportunity ID: " .. opp.id)
```

---

## copper_list_pipelines

List all sales pipelines in Copper CRM. Each pipeline contains stages that opportunities move through.

### Parameters

This function takes no parameters.

### Examples

```lua
local pipelines = app.integrations.copper.copper_list_pipelines({})

for _, pipeline in ipairs(pipelines) do
  print("Pipeline: " .. pipeline.name .. " (ID: " .. pipeline.id .. ")")
  for _, stage in ipairs(pipeline.stages or {}) do
    print("  Stage: " .. stage.name .. " (ID: " .. stage.id .. ")")
  end
end
```

---

## copper_get_current_user

Get the currently authenticated Copper CRM user. Useful for verifying the connection and account context.

### Parameters

This function takes no parameters.

### Examples

```lua
local user = app.integrations.copper.copper_get_current_user({})

print("Logged in as: " .. (user.first_name or "") .. " " .. (user.last_name or ""))
print("Email: " .. user.email)
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.copper.production.function_name({...})
app.integrations.copper.staging.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.copper.copper_list_contacts({
  page_size = 1,
  sort_by = "example_sort_by"
})
print(result)

Functions

copper_list_contacts

Search and list contacts in Copper CRM. Returns contact names, emails, and IDs.

Operation
Read read
Full name
copper.copper_list_contacts
ParameterTypeRequiredDescription
page_size integer no Number of contacts to return per page (default: 25, max: 200).
sort_by string no Field to sort by (e.g., "name", "created_at").

copper_get_contact

Get details of a specific contact in Copper CRM by ID.

Operation
Read read
Full name
copper.copper_get_contact
ParameterTypeRequiredDescription
id integer yes The Copper contact ID.

copper_create_contact

Create a new contact in Copper CRM. Provide at least a name.

Operation
Write write
Full name
copper.copper_create_contact
ParameterTypeRequiredDescription
name string yes Full name of the contact.
email string no Email address of the contact.

copper_update_contact

Update an existing contact in Copper CRM. Only the fields provided will be updated.

Operation
Write write
Full name
copper.copper_update_contact
ParameterTypeRequiredDescription
id integer yes The Copper contact ID to update.
name string no Updated full name of the contact.
email string no Updated email address.

copper_delete_contact

Delete a contact from Copper CRM. This action cannot be undone.

Operation
Write write
Full name
copper.copper_delete_contact
ParameterTypeRequiredDescription
id integer yes The Copper contact ID to delete.

copper_list_companies

Search and list companies in Copper CRM. Returns company names, domains, and IDs.

Operation
Read read
Full name
copper.copper_list_companies
ParameterTypeRequiredDescription
page_size integer no Number of companies to return per page (default: 25, max: 200).
sort_by string no Field to sort by (e.g., "name", "created_at").

copper_get_company

Get details of a specific company in Copper CRM by ID.

Operation
Read read
Full name
copper.copper_get_company
ParameterTypeRequiredDescription
id integer yes The Copper company ID.

copper_create_company

Create a new company in Copper CRM.

Operation
Write write
Full name
copper.copper_create_company
ParameterTypeRequiredDescription
name string yes Company name.

copper_list_opportunities

Search and list opportunities (deals) in Copper CRM. Returns opportunity names, values, stages, and IDs.

Operation
Read read
Full name
copper.copper_list_opportunities
ParameterTypeRequiredDescription
page_size integer no Number of opportunities to return per page (default: 25, max: 200).
sort_by string no Field to sort by (e.g., "name", "created_at").

copper_get_opportunity

Get details of a specific opportunity (deal) in Copper CRM by ID.

Operation
Read read
Full name
copper.copper_get_opportunity
ParameterTypeRequiredDescription
id integer yes The Copper opportunity ID.

copper_create_opportunity

Create a new opportunity (deal) in Copper CRM. Provide a name and pipeline ID. Use copper_list_pipelines first to find available pipeline IDs.

Operation
Write write
Full name
copper.copper_create_opportunity
ParameterTypeRequiredDescription
name string yes Opportunity name.
pipeline_id integer yes ID of the pipeline to create the opportunity in. Use copper_list_pipelines to find available IDs.

copper_list_pipelines

List all sales pipelines in Copper CRM. Each pipeline contains stages that opportunities move through.

Operation
Read read
Full name
copper.copper_list_pipelines
ParameterTypeRequiredDescription
No parameters.

copper_get_current_user

Get the currently authenticated Copper CRM user. Useful for verifying the connection and account context.

Operation
Read read
Full name
copper.copper_get_current_user
ParameterTypeRequiredDescription
No parameters.