KosmoKrator

productivity

Pinterest Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.pinterest.create({boardId = "example_boardId", title = "example_title", description = "example_description", mediaSource = "example_mediaSource", imageUrl = "example_imageUrl", link = "example_link"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("pinterest"))' --json
kosmo integrations:lua --eval 'print(docs.read("pinterest.create"))' --json

Workflow file

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

workflow.lua
local pinterest = app.integrations.pinterest
local result = pinterest.create({boardId = "example_boardId", title = "example_title", description = "example_description", mediaSource = "example_mediaSource", imageUrl = "example_imageUrl", link = "example_link"})

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

MCP-only Lua

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

Pinterest — Lua API Reference

list_pins

List pins for the authenticated Pinterest user.

Parameters

NameTypeRequiredDescription
bookmarkstringnoPagination cursor from a previous response
pageSizeintegernoNumber of pins to return per page (max 250)

Example

local result = app.integrations.pinterest.list_pins({
  pageSize = 25
})

for _, pin in ipairs(result.items) do
  print(pin.id .. ": " .. (pin.title or ""))
end

get_pin

Get details of a specific pin by ID.

Parameters

NameTypeRequiredDescription
pinIdstringyesThe pin ID to retrieve

Example

local result = app.integrations.pinterest.get_pin({
  pinId = "1234567890"
})
print(result.title)
print(result.description)
print(result.link)

create_pin

Create a new pin on a Pinterest board.

Parameters

NameTypeRequiredDescription
boardIdstringyesThe board ID to pin to
titlestringyesThe title of the pin
descriptionstringyesThe description of the pin
mediaSourcestringnoThe media source type (default: "image_url")
imageUrlstringyesThe URL of the image to pin
linkstringnoOptional destination link URL for the pin

Example

local result = app.integrations.pinterest.create_pin({
  boardId = "987654321",
  title = "My New Pin",
  description = "Check out this amazing content!",
  imageUrl = "https://example.com/image.jpg",
  link = "https://example.com/blog"
})
print("Created pin: " .. result.id)

list_boards

List boards for the authenticated Pinterest user.

Parameters

NameTypeRequiredDescription
bookmarkstringnoPagination cursor from a previous response
pageSizeintegernoNumber of boards to return per page (max 250)

Example

local result = app.integrations.pinterest.list_boards({
  pageSize = 25
})

for _, board in ipairs(result.items) do
  print(board.id .. ": " .. board.name .. " (" .. (board.pin_count or 0) .. " pins)")
end

get_board

Get details of a specific board by ID.

Parameters

NameTypeRequiredDescription
boardIdstringyesThe board ID to retrieve

Example

local result = app.integrations.pinterest.get_board({
  boardId = "1234567890"
})
print(result.name)
print(result.description)
print("Pin count: " .. (result.pin_count or 0))

list_campaigns

List ad campaigns for a Pinterest ad account.

Parameters

NameTypeRequiredDescription
adAccountIdstringyesThe ad account ID to list campaigns for
bookmarkstringnoPagination cursor from a previous response
pageSizeintegernoNumber of campaigns to return per page

Example

local result = app.integrations.pinterest.list_campaigns({
  adAccountId = "549560687913",
  pageSize = 50
})

for _, campaign in ipairs(result.items) do
  print(campaign.id .. ": " .. campaign.name .. " (" .. campaign.status .. ")")
end

get_current_user

Get the currently authenticated Pinterest user profile.

Parameters

None.

Example

local result = app.integrations.pinterest.get_current_user()
print("Logged in as: " .. (result.username or ""))
print("Account type: " .. (result.account_type or ""))

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.pinterest.brand_account.function_name({...})
app.integrations.pinterest.agency.function_name({...})

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

Raw agent markdown
# Pinterest — Lua API Reference

## list_pins

List pins for the authenticated Pinterest user.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `bookmark` | string | no | Pagination cursor from a previous response |
| `pageSize` | integer | no | Number of pins to return per page (max 250) |

### Example

```lua
local result = app.integrations.pinterest.list_pins({
  pageSize = 25
})

for _, pin in ipairs(result.items) do
  print(pin.id .. ": " .. (pin.title or ""))
end
```

---

## get_pin

Get details of a specific pin by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `pinId` | string | yes | The pin ID to retrieve |

### Example

```lua
local result = app.integrations.pinterest.get_pin({
  pinId = "1234567890"
})
print(result.title)
print(result.description)
print(result.link)
```

---

## create_pin

Create a new pin on a Pinterest board.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `boardId` | string | yes | The board ID to pin to |
| `title` | string | yes | The title of the pin |
| `description` | string | yes | The description of the pin |
| `mediaSource` | string | no | The media source type (default: `"image_url"`) |
| `imageUrl` | string | yes | The URL of the image to pin |
| `link` | string | no | Optional destination link URL for the pin |

### Example

```lua
local result = app.integrations.pinterest.create_pin({
  boardId = "987654321",
  title = "My New Pin",
  description = "Check out this amazing content!",
  imageUrl = "https://example.com/image.jpg",
  link = "https://example.com/blog"
})
print("Created pin: " .. result.id)
```

---

## list_boards

List boards for the authenticated Pinterest user.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `bookmark` | string | no | Pagination cursor from a previous response |
| `pageSize` | integer | no | Number of boards to return per page (max 250) |

### Example

```lua
local result = app.integrations.pinterest.list_boards({
  pageSize = 25
})

for _, board in ipairs(result.items) do
  print(board.id .. ": " .. board.name .. " (" .. (board.pin_count or 0) .. " pins)")
end
```

---

## get_board

Get details of a specific board by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `boardId` | string | yes | The board ID to retrieve |

### Example

```lua
local result = app.integrations.pinterest.get_board({
  boardId = "1234567890"
})
print(result.name)
print(result.description)
print("Pin count: " .. (result.pin_count or 0))
```

---

## list_campaigns

List ad campaigns for a Pinterest ad account.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `adAccountId` | string | yes | The ad account ID to list campaigns for |
| `bookmark` | string | no | Pagination cursor from a previous response |
| `pageSize` | integer | no | Number of campaigns to return per page |

### Example

```lua
local result = app.integrations.pinterest.list_campaigns({
  adAccountId = "549560687913",
  pageSize = 50
})

for _, campaign in ipairs(result.items) do
  print(campaign.id .. ": " .. campaign.name .. " (" .. campaign.status .. ")")
end
```

---

## get_current_user

Get the currently authenticated Pinterest user profile.

### Parameters

None.

### Example

```lua
local result = app.integrations.pinterest.get_current_user()
print("Logged in as: " .. (result.username or ""))
print("Account type: " .. (result.account_type or ""))
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.pinterest.brand_account.function_name({...})
app.integrations.pinterest.agency.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.pinterest.create({boardId = "example_boardId", title = "example_title", description = "example_description", mediaSource = "example_mediaSource", imageUrl = "example_imageUrl", link = "example_link"})
print(result)

Functions

create Write

Create a new pin on a Pinterest board. Provide the board ID, title, description, and image URL. Optionally include a destination link.

Lua path
app.integrations.pinterest.create
Full name
pinterest.pinterest_create_pin
ParameterTypeRequiredDescription
boardId string yes The board ID to pin to.
title string yes The title of the pin.
description string yes The description of the pin.
mediaSource string no The media source type (default: "image_url").
imageUrl string yes The URL of the image to pin.
link string no Optional destination link URL for the pin.
get_board Read

Get details of a specific Pinterest board by its ID. Returns the board name, description, pin count, and privacy settings.

Lua path
app.integrations.pinterest.get_board
Full name
pinterest.pinterest_get_board
ParameterTypeRequiredDescription
boardId string yes The board ID to retrieve.
get_current_user Read

Get the currently authenticated Pinterest user profile. Returns the username, account type, and profile image.

Lua path
app.integrations.pinterest.get_current_user
Full name
pinterest.pinterest_get_current_user
ParameterTypeRequiredDescription
No parameters.
get Read

Get details of a specific Pinterest pin by its ID. Returns the pin title, description, image, board, and link.

Lua path
app.integrations.pinterest.get
Full name
pinterest.pinterest_get_pin
ParameterTypeRequiredDescription
pinId string yes The pin ID to retrieve.
list_boards Read

List boards for the authenticated Pinterest user. Supports pagination with bookmark cursor and page size. Returns board IDs, names, descriptions, and pin counts.

Lua path
app.integrations.pinterest.list_boards
Full name
pinterest.pinterest_list_boards
ParameterTypeRequiredDescription
bookmark string no Pagination cursor from a previous response.
pageSize integer no Number of boards to return per page (max 250).
list_campaigns Read

List ad campaigns for a Pinterest ad account. Requires an ad account ID. Supports pagination with bookmark cursor and page size.

Lua path
app.integrations.pinterest.list_campaigns
Full name
pinterest.pinterest_list_campaigns
ParameterTypeRequiredDescription
adAccountId string yes The ad account ID to list campaigns for.
bookmark string no Pagination cursor from a previous response.
pageSize integer no Number of campaigns to return per page.
list Read

List pins for the authenticated Pinterest user. Supports pagination with bookmark cursor and page size. Returns pin IDs, titles, descriptions, and media.

Lua path
app.integrations.pinterest.list
Full name
pinterest.pinterest_list_pins
ParameterTypeRequiredDescription
bookmark string no Pagination cursor from a previous response.
pageSize integer no Number of pins to return per page (max 250).