KosmoKrator

productivity

Pipedrive Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API token auth

Lua Namespace

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

Pipedrive — Lua API Reference

list_deals

List deals in Pipedrive with optional filters for user, person, organization, and status.

Parameters

NameTypeRequiredDescription
user_idintegernoFilter deals by assigned user ID
person_idintegernoFilter deals by person ID
org_idintegernoFilter deals by organization ID
statusstringnoFilter by status: "open", "won", "lost", "deleted"
limitintegernoMax results (default: 25, max: 500)
startintegernoPagination start offset (0-based)

Example

local result = app.integrations.pipedrive.list_deals({
  status = "open",
  limit = 10
})

for _, deal in ipairs(result.deals) do
  print(deal.id .. ": " .. deal.title .. " (" .. (deal.value or "0") .. " " .. (deal.currency or "") .. ")")
end

get_deal

Get full details for a single deal by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe deal ID

Example

local deal = app.integrations.pipedrive.get_deal({
  id = 123
})

print(deal.title)
print("Value: " .. (deal.value or "0") .. " " .. (deal.currency or ""))
print("Status: " .. deal.status)

create_deal

Create a new deal in Pipedrive.

Parameters

NameTypeRequiredDescription
titlestringyesThe deal title
valuenumbernoDeal value (numeric)
currencystringnoCurrency code (e.g., "USD", "EUR")
person_idintegernoID of the associated person
org_idintegernoID of the associated organization
stage_idintegernoPipeline stage ID
pipeline_idintegernoPipeline ID (omit for default)
statusstringno"open" (default), "won", or "lost"
probabilitynumbernoSuccess probability (0–100)
notestringnoNote to attach to the deal

Example

local deal = app.integrations.pipedrive.create_deal({
  title = "New Enterprise Deal",
  value = 50000,
  currency = "USD",
  org_id = 456,
  probability = 75
})

print("Created deal: " .. deal.id .. " - " .. deal.title)

list_persons

List persons (contacts) in Pipedrive.

Parameters

NameTypeRequiredDescription
limitintegernoMax results (default: 25, max: 500)
startintegernoPagination start offset (0-based)

Example

local result = app.integrations.pipedrive.list_persons({
  limit = 50
})

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

get_person

Get full details for a single person (contact) by ID.

Parameters

NameTypeRequiredDescription
idintegeryesThe person ID

Example

local person = app.integrations.pipedrive.get_person({
  id = 789
})

print(person.name)
if person.email then
  for _, email in ipairs(person.email) do
    print("  Email: " .. email.value)
  end
end
if person.phone then
  for _, phone in ipairs(person.phone) do
    print("  Phone: " .. phone.value)
  end
end

list_organizations

List organizations in Pipedrive.

Parameters

NameTypeRequiredDescription
limitintegernoMax results (default: 25, max: 500)
startintegernoPagination start offset (0-based)

Example

local result = app.integrations.pipedrive.list_organizations({
  limit = 50
})

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

get_current_user

Get the authenticated user’s profile.

Parameters

None.

Example

local user = app.integrations.pipedrive.get_current_user({})

print("Logged in as: " .. user.name)
print("Email: " .. user.email)
print("Company: " .. (user.company_name or ""))

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.pipedrive.sales_team.function_name({...})
app.integrations.pipedrive.eu_team.function_name({...})

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

Raw agent markdown
# Pipedrive — Lua API Reference

## list_deals

List deals in Pipedrive with optional filters for user, person, organization, and status.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `user_id` | integer | no | Filter deals by assigned user ID |
| `person_id` | integer | no | Filter deals by person ID |
| `org_id` | integer | no | Filter deals by organization ID |
| `status` | string | no | Filter by status: `"open"`, `"won"`, `"lost"`, `"deleted"` |
| `limit` | integer | no | Max results (default: 25, max: 500) |
| `start` | integer | no | Pagination start offset (0-based) |

### Example

```lua
local result = app.integrations.pipedrive.list_deals({
  status = "open",
  limit = 10
})

for _, deal in ipairs(result.deals) do
  print(deal.id .. ": " .. deal.title .. " (" .. (deal.value or "0") .. " " .. (deal.currency or "") .. ")")
end
```

---

## get_deal

Get full details for a single deal by ID.

### Parameters

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

### Example

```lua
local deal = app.integrations.pipedrive.get_deal({
  id = 123
})

print(deal.title)
print("Value: " .. (deal.value or "0") .. " " .. (deal.currency or ""))
print("Status: " .. deal.status)
```

---

## create_deal

Create a new deal in Pipedrive.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `title` | string | yes | The deal title |
| `value` | number | no | Deal value (numeric) |
| `currency` | string | no | Currency code (e.g., `"USD"`, `"EUR"`) |
| `person_id` | integer | no | ID of the associated person |
| `org_id` | integer | no | ID of the associated organization |
| `stage_id` | integer | no | Pipeline stage ID |
| `pipeline_id` | integer | no | Pipeline ID (omit for default) |
| `status` | string | no | `"open"` (default), `"won"`, or `"lost"` |
| `probability` | number | no | Success probability (0–100) |
| `note` | string | no | Note to attach to the deal |

### Example

```lua
local deal = app.integrations.pipedrive.create_deal({
  title = "New Enterprise Deal",
  value = 50000,
  currency = "USD",
  org_id = 456,
  probability = 75
})

print("Created deal: " .. deal.id .. " - " .. deal.title)
```

---

## list_persons

List persons (contacts) in Pipedrive.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Max results (default: 25, max: 500) |
| `start` | integer | no | Pagination start offset (0-based) |

### Example

```lua
local result = app.integrations.pipedrive.list_persons({
  limit = 50
})

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

---

## get_person

Get full details for a single person (contact) by ID.

### Parameters

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

### Example

```lua
local person = app.integrations.pipedrive.get_person({
  id = 789
})

print(person.name)
if person.email then
  for _, email in ipairs(person.email) do
    print("  Email: " .. email.value)
  end
end
if person.phone then
  for _, phone in ipairs(person.phone) do
    print("  Phone: " .. phone.value)
  end
end
```

---

## list_organizations

List organizations in Pipedrive.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Max results (default: 25, max: 500) |
| `start` | integer | no | Pagination start offset (0-based) |

### Example

```lua
local result = app.integrations.pipedrive.list_organizations({
  limit = 50
})

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

---

## get_current_user

Get the authenticated user's profile.

### Parameters

None.

### Example

```lua
local user = app.integrations.pipedrive.get_current_user({})

print("Logged in as: " .. user.name)
print("Email: " .. user.email)
print("Company: " .. (user.company_name or ""))
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.pipedrive.sales_team.function_name({...})
app.integrations.pipedrive.eu_team.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.pipedrive.pipedrive_create_deal({
  title = "example_title",
  value = 1,
  currency = "example_currency",
  person_id = 1,
  org_id = 1,
  stage_id = 1,
  pipeline_id = 1,
  status = "example_status"
})
print(result)

Functions

pipedrive_create_deal

Create a new deal in Pipedrive. Provide a title and optionally set value, currency, person, organization, stage, and other deal fields.

Operation
Write write
Full name
pipedrive.pipedrive_create_deal
ParameterTypeRequiredDescription
title string yes The deal title.
value number no The deal value (numeric).
currency string no Deal currency code (e.g., "USD", "EUR").
person_id integer no ID of the person associated with this deal.
org_id integer no ID of the organization associated with this deal.
stage_id integer no ID of the pipeline stage to place the deal in.
pipeline_id integer no ID of the pipeline. Omit for the default pipeline.
status string no Deal status: "open" (default), "won", or "lost".
probability number no Deal success probability (0–100).
note string no Note to attach to the deal.

pipedrive_get_current_user

Get the profile of the currently authenticated Pipedrive user — name, email, company, timezone, and other account details.

Operation
Read read
Full name
pipedrive.pipedrive_get_current_user
ParameterTypeRequiredDescription
No parameters.

pipedrive_get_deal

Get full details for a single deal in Pipedrive, including value, stage, person, organization, and custom fields.

Operation
Read read
Full name
pipedrive.pipedrive_get_deal
ParameterTypeRequiredDescription
id integer yes The deal ID.

pipedrive_get_person

Get full details for a single person (contact) in Pipedrive, including email, phone, organization, and custom fields.

Operation
Read read
Full name
pipedrive.pipedrive_get_person
ParameterTypeRequiredDescription
id integer yes The person ID.

pipedrive_list_deals

List deals in Pipedrive with optional filters for user, person, organization, and status. Returns a paginated list of deals with key details.

Operation
Read read
Full name
pipedrive.pipedrive_list_deals
ParameterTypeRequiredDescription
user_id integer no Filter deals by user ID (the user the deal is assigned to).
person_id integer no Filter deals by person ID.
org_id integer no Filter deals by organization ID.
status string no Filter by status: "open", "won", "lost", or "deleted". Omit to return all.
limit integer no Maximum number of deals to return (default: 25, max: 500).
start integer no Pagination start offset (0-based).

pipedrive_list_organizations

List organizations in Pipedrive. Returns a paginated list with name, address, owner, and other details.

Operation
Read read
Full name
pipedrive.pipedrive_list_organizations
ParameterTypeRequiredDescription
limit integer no Maximum number of organizations to return (default: 25, max: 500).
start integer no Pagination start offset (0-based).

pipedrive_list_persons

List persons (contacts) in Pipedrive. Returns a paginated list with name, email, phone, organization, and owner details.

Operation
Read read
Full name
pipedrive.pipedrive_list_persons
ParameterTypeRequiredDescription
limit integer no Maximum number of persons to return (default: 25, max: 500).
start integer no Pagination start offset (0-based).