KosmoKrator

productivity

Coda Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.coda.list_docs({query = "example_query", isOwner = true, limit = 1}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("coda"))' --json
kosmo integrations:lua --eval 'print(docs.read("coda.list_docs"))' --json

Workflow file

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

workflow.lua
local coda = app.integrations.coda
local result = coda.list_docs({query = "example_query", isOwner = true, limit = 1})

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

MCP-only Lua

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

Coda — Lua API Reference

coda_list_docs

List Coda docs accessible to the authenticated user.

Parameters

NameTypeRequiredDescription
querystringnoSearch query to filter docs by name.
isOwnerbooleannoIf true, only return docs owned by the user.
limitintegernoMaximum number of docs to return (default: 20, max: 100).

Example

local result = app.integrations.coda.list_docs({
  query = "project",
  limit = 10
})

for _, doc in ipairs(result.items) do
  print(doc.name .. " — " .. doc.id)
end

coda_get_doc

Get details of a specific Coda doc.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.

Example

local doc = app.integrations.coda.get_doc({
  doc_id = "abc123"
})
print(doc.name .. " — " .. doc.owner .. " — " .. doc.ownerName)

coda_list_tables

List tables in a Coda doc.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
limitintegernoMaximum number of tables to return (default: 20, max: 100).

Example

local result = app.integrations.coda.list_tables({
  doc_id = "abc123",
  limit = 50
})

for _, table in ipairs(result.items) do
  print(table.name .. " — " .. table.id .. " (type: " .. table.displayColumn .. ")")
end

coda_get_table

Get details of a specific table in a Coda doc.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
table_idstringyesThe ID or name of the table.

Example

local table = app.integrations.coda.get_table({
  doc_id = "abc123",
  table_id = "grid-MyTable"
})
print(table.name .. " — columns: " .. table.columnCount)

coda_list_rows

List rows in a Coda table.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
table_idstringyesThe ID or name of the table.
limitintegernoMaximum number of rows to return (default: 20, max: 1000).
useColumnNamesbooleannoReturn values keyed by column names instead of column IDs (default: true).

Example

local result = app.integrations.coda.list_rows({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  limit = 50,
  useColumnNames = true
})

for _, row in ipairs(result.items) do
  print(row.name .. ": " .. row.values["Status"])
end

coda_get_row

Get a single row from a Coda table.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
table_idstringyesThe ID or name of the table.
row_idstringyesThe ID of the row.
useColumnNamesbooleannoReturn values keyed by column names (default: true).

Example

local row = app.integrations.coda.get_row({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  row_id = "i-row123"
})
print(row.name)
for col, val in pairs(row.values) do
  print("  " .. col .. " = " .. tostring(val))
end

coda_insert_rows

Insert one or more rows into a Coda table.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
table_idstringyesThe ID or name of the table.
rowsarrayyesArray of row objects. Each row: {cells = {column = "col-name", value = "the-value"}}.

Example

local result = app.integrations.coda.insert_rows({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  rows = {
    {
      cells = {
        {column = "Name", value = "Alice"},
        {column = "Email", value = "alice@example.com"},
        {column = "Status", value = "Active"}
      }
    },
    {
      cells = {
        {column = "Name", value = "Bob"},
        {column = "Email", value = "bob@example.com"},
        {column = "Status", value = "Pending"}
      }
    }
  }
})
print("Request ID: " .. result.requestId)

coda_update_row

Update cells in an existing row.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
table_idstringyesThe ID or name of the table.
row_idstringyesThe ID of the row to update.
cellsarrayyesArray of cell objects: {column = "col-name", value = "new-value"}.

Example

local result = app.integrations.coda.update_row({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  row_id = "i-row123",
  cells = {
    {column = "Status", value = "Completed"},
    {column = "Completed At", value = "2026-04-05"}
  }
})
print("Request ID: " .. result.requestId)

coda_delete_row

Delete a row from a Coda table.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
table_idstringyesThe ID or name of the table.
row_idstringyesThe ID of the row to delete.

Example

local result = app.integrations.coda.delete_row({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  row_id = "i-row123"
})
print(result)

coda_list_columns

List columns in a Coda table.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
table_idstringyesThe ID or name of the table.
limitintegernoMaximum number of columns to return (default: 20, max: 100).

Example

local result = app.integrations.coda.list_columns({
  doc_id = "abc123",
  table_id = "grid-MyTable"
})

for _, col in ipairs(result.items) do
  print(col.name .. " (" .. col.type .. ") — " .. col.id)
end

coda_list_pages

List pages in a Coda doc.

Parameters

NameTypeRequiredDescription
doc_idstringyesThe ID of the doc.
limitintegernoMaximum number of pages to return (default: 20, max: 100).

Example

local result = app.integrations.coda.list_pages({
  doc_id = "abc123",
  limit = 50
})

for _, page in ipairs(result.items) do
  print(page.name .. " — " .. page.id)
end

coda_get_current_user

Verify authentication and get current user info.

Parameters

None.

Example

local user = app.integrations.coda.get_current_user({})
print("Connected as: " .. user.name .. " (" .. user.loginId .. ")")

Multi-Account Usage

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

-- Default account (always works)
app.integrations.coda.list_docs({})

-- Explicit default (portable across setups)
app.integrations.coda.default.list_docs({})

-- Named accounts
app.integrations.coda.work.list_docs({})
app.integrations.coda.personal.list_docs({})

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

Raw agent markdown
# Coda — Lua API Reference

## coda_list_docs

List Coda docs accessible to the authenticated user.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `query` | string | no | Search query to filter docs by name. |
| `isOwner` | boolean | no | If true, only return docs owned by the user. |
| `limit` | integer | no | Maximum number of docs to return (default: 20, max: 100). |

### Example

```lua
local result = app.integrations.coda.list_docs({
  query = "project",
  limit = 10
})

for _, doc in ipairs(result.items) do
  print(doc.name .. " — " .. doc.id)
end
```

---

## coda_get_doc

Get details of a specific Coda doc.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |

### Example

```lua
local doc = app.integrations.coda.get_doc({
  doc_id = "abc123"
})
print(doc.name .. " — " .. doc.owner .. " — " .. doc.ownerName)
```

---

## coda_list_tables

List tables in a Coda doc.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `limit` | integer | no | Maximum number of tables to return (default: 20, max: 100). |

### Example

```lua
local result = app.integrations.coda.list_tables({
  doc_id = "abc123",
  limit = 50
})

for _, table in ipairs(result.items) do
  print(table.name .. " — " .. table.id .. " (type: " .. table.displayColumn .. ")")
end
```

---

## coda_get_table

Get details of a specific table in a Coda doc.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `table_id` | string | yes | The ID or name of the table. |

### Example

```lua
local table = app.integrations.coda.get_table({
  doc_id = "abc123",
  table_id = "grid-MyTable"
})
print(table.name .. " — columns: " .. table.columnCount)
```

---

## coda_list_rows

List rows in a Coda table.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `table_id` | string | yes | The ID or name of the table. |
| `limit` | integer | no | Maximum number of rows to return (default: 20, max: 1000). |
| `useColumnNames` | boolean | no | Return values keyed by column names instead of column IDs (default: true). |

### Example

```lua
local result = app.integrations.coda.list_rows({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  limit = 50,
  useColumnNames = true
})

for _, row in ipairs(result.items) do
  print(row.name .. ": " .. row.values["Status"])
end
```

---

## coda_get_row

Get a single row from a Coda table.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `table_id` | string | yes | The ID or name of the table. |
| `row_id` | string | yes | The ID of the row. |
| `useColumnNames` | boolean | no | Return values keyed by column names (default: true). |

### Example

```lua
local row = app.integrations.coda.get_row({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  row_id = "i-row123"
})
print(row.name)
for col, val in pairs(row.values) do
  print("  " .. col .. " = " .. tostring(val))
end
```

---

## coda_insert_rows

Insert one or more rows into a Coda table.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `table_id` | string | yes | The ID or name of the table. |
| `rows` | array | yes | Array of row objects. Each row: `{cells = {column = "col-name", value = "the-value"}}`. |

### Example

```lua
local result = app.integrations.coda.insert_rows({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  rows = {
    {
      cells = {
        {column = "Name", value = "Alice"},
        {column = "Email", value = "alice@example.com"},
        {column = "Status", value = "Active"}
      }
    },
    {
      cells = {
        {column = "Name", value = "Bob"},
        {column = "Email", value = "bob@example.com"},
        {column = "Status", value = "Pending"}
      }
    }
  }
})
print("Request ID: " .. result.requestId)
```

---

## coda_update_row

Update cells in an existing row.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `table_id` | string | yes | The ID or name of the table. |
| `row_id` | string | yes | The ID of the row to update. |
| `cells` | array | yes | Array of cell objects: `{column = "col-name", value = "new-value"}`. |

### Example

```lua
local result = app.integrations.coda.update_row({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  row_id = "i-row123",
  cells = {
    {column = "Status", value = "Completed"},
    {column = "Completed At", value = "2026-04-05"}
  }
})
print("Request ID: " .. result.requestId)
```

---

## coda_delete_row

Delete a row from a Coda table.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `table_id` | string | yes | The ID or name of the table. |
| `row_id` | string | yes | The ID of the row to delete. |

### Example

```lua
local result = app.integrations.coda.delete_row({
  doc_id = "abc123",
  table_id = "grid-MyTable",
  row_id = "i-row123"
})
print(result)
```

---

## coda_list_columns

List columns in a Coda table.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `table_id` | string | yes | The ID or name of the table. |
| `limit` | integer | no | Maximum number of columns to return (default: 20, max: 100). |

### Example

```lua
local result = app.integrations.coda.list_columns({
  doc_id = "abc123",
  table_id = "grid-MyTable"
})

for _, col in ipairs(result.items) do
  print(col.name .. " (" .. col.type .. ") — " .. col.id)
end
```

---

## coda_list_pages

List pages in a Coda doc.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_id` | string | yes | The ID of the doc. |
| `limit` | integer | no | Maximum number of pages to return (default: 20, max: 100). |

### Example

```lua
local result = app.integrations.coda.list_pages({
  doc_id = "abc123",
  limit = 50
})

for _, page in ipairs(result.items) do
  print(page.name .. " — " .. page.id)
end
```

---

## coda_get_current_user

Verify authentication and get current user info.

### Parameters

None.

### Example

```lua
local user = app.integrations.coda.get_current_user({})
print("Connected as: " .. user.name .. " (" .. user.loginId .. ")")
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.coda.list_docs({})

-- Explicit default (portable across setups)
app.integrations.coda.default.list_docs({})

-- Named accounts
app.integrations.coda.work.list_docs({})
app.integrations.coda.personal.list_docs({})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.coda.list_docs({query = "example_query", isOwner = true, limit = 1})
print(result)

Functions

list_docs Read

List Coda docs accessible to the authenticated user. Optionally filter by name or ownership.

Lua path
app.integrations.coda.list_docs
Full name
coda.coda_list_docs
ParameterTypeRequiredDescription
query string no Search query to filter docs by name.
isOwner boolean no If true, only return docs owned by the user.
limit integer no Maximum number of docs to return (default: 20, max: 100).
get_doc Read

Get details of a specific Coda doc by its ID.

Lua path
app.integrations.coda.get_doc
Full name
coda.coda_get_doc
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc to retrieve.
list_tables Read

List tables in a Coda doc. Returns table IDs, names, and display types.

Lua path
app.integrations.coda.list_tables
Full name
coda.coda_list_tables
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
limit integer no Maximum number of tables to return (default: 20, max: 100).
get_table Read

Get details of a specific table in a Coda doc, including its columns and display column.

Lua path
app.integrations.coda.get_table
Full name
coda.coda_get_table
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
table_id string yes The ID or name of the table.
list_rows Read

List rows in a Coda table. Use useColumnNames=true to get values keyed by human-readable column names instead of column IDs.

Lua path
app.integrations.coda.list_rows
Full name
coda.coda_list_rows
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
table_id string yes The ID or name of the table.
limit integer no Maximum number of rows to return (default: 20, max: 1000).
useColumnNames boolean no If true, return values keyed by column names instead of column IDs (default: true).
get_row Read

Get a single row from a Coda table by its row ID.

Lua path
app.integrations.coda.get_row
Full name
coda.coda_get_row
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
table_id string yes The ID or name of the table.
row_id string yes The ID of the row to retrieve.
useColumnNames boolean no If true, return values keyed by column names instead of column IDs (default: true).
insert_rows Write

Insert one or more new rows into a Coda table. Each row should have a "cells" array with column/value pairs.

Lua path
app.integrations.coda.insert_rows
Full name
coda.coda_insert_rows
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
table_id string yes The ID or name of the table.
rows array yes Array of row objects. Each row should be {"cells": [{"column": "col-name-or-id", "value": "the-value"}]}.
update_row Write

Update cells in an existing row in a Coda table. Provide a cells array with column/value pairs to update.

Lua path
app.integrations.coda.update_row
Full name
coda.coda_update_row
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
table_id string yes The ID or name of the table.
row_id string yes The ID of the row to update.
cells array yes Array of cell objects to update, e.g. [{"column": "col-name-or-id", "value": "new-value"}].
delete_row Write

Delete a row from a Coda table. This action is permanent.

Lua path
app.integrations.coda.delete_row
Full name
coda.coda_delete_row
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
table_id string yes The ID or name of the table.
row_id string yes The ID of the row to delete.
list_columns Read

List columns in a Coda table. Useful to discover column names and types before querying or inserting rows.

Lua path
app.integrations.coda.list_columns
Full name
coda.coda_list_columns
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
table_id string yes The ID or name of the table.
limit integer no Maximum number of columns to return (default: 20, max: 100).
list_pages Read

List pages in a Coda doc. Pages can contain text, tables, and other content.

Lua path
app.integrations.coda.list_pages
Full name
coda.coda_list_pages
ParameterTypeRequiredDescription
doc_id string yes The ID of the doc.
limit integer no Maximum number of pages to return (default: 20, max: 100).
get_current_user Read

Verify Coda authentication and get the current user's profile information.

Lua path
app.integrations.coda.get_current_user
Full name
coda.coda_get_current_user
ParameterTypeRequiredDescription
No parameters.