KosmoKrator

data

Baserow Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.baserow.api_delete({path = "example_path", payload = "example_payload", query = "example_query"}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("baserow"))' --json
kosmo integrations:lua --eval 'print(docs.read("baserow.api_delete"))' --json

Workflow file

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

workflow.lua
local baserow = app.integrations.baserow
local result = baserow.api_delete({path = "example_path", payload = "example_payload", query = "example_query"})

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

MCP-only Lua

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

Baserow Lua API Reference

Namespace: app.integrations.baserow

Baserow tools operate on database IDs, table IDs, field IDs, and row IDs from the Baserow REST API. Database tokens normally use Authorization: Token ...; account-level endpoints may require a host-provided JWT or Bearer token.

Discovery

Use list_databases, list_all_tables, list_database_tables, get_table, and list_fields to find the schema before reading or writing rows.

local databases = app.integrations.baserow.list_databases({ page = 1, size = 100 })
local tables = app.integrations.baserow.list_database_tables({ database_id = 123 })
local fields = app.integrations.baserow.list_fields({ table_id = 456 })

list_all_tables returns the tables visible to the configured database token and is useful when the agent only has a database token scope.

Rows

Use list_rows for new row-listing work. The older list_tables tool is kept only as a compatibility alias and also lists rows.

local rows = app.integrations.baserow.list_rows({
  table_id = 456,
  search = "Acme",
  order_by = "-id",
  filters = {
    { field = 789, type = "equal", value = "Active" }
  }
})

local row = app.integrations.baserow.get_row({
  table_id = 456,
  row_id = 1
})

Row outputs are the normalized JSON returned by Baserow. When user_field_names or field-name mode is used by the upstream endpoint, field names appear directly in the row object; otherwise Baserow may return field IDs such as field_789.

Row Writes

local created = app.integrations.baserow.create_row({
  table_id = 456,
  data = {
    Name = "Acme",
    Status = "Active"
  }
})

local updated = app.integrations.baserow.update_row({
  table_id = 456,
  row_id = 1,
  data = {
    Status = "Inactive"
  }
})

app.integrations.baserow.move_row({
  table_id = 456,
  row_id = 1,
  before_id = 2
})

app.integrations.baserow.delete_row({
  table_id = 456,
  row_id = 1
})

Batch Rows

Batch payloads use Baserow’s items wrapper internally. You can pass a JSON array or Lua array of row objects.

local result = app.integrations.baserow.batch_create({
  table_id = 456,
  records = {
    { Name = "Acme" },
    { Name = "Globex" }
  }
})

app.integrations.baserow.batch_update({
  table_id = 456,
  records = {
    { id = 1, Status = "Active" },
    { id = 2, Status = "Inactive" }
  }
})

app.integrations.baserow.batch_delete({
  table_id = 456,
  row_ids = { 1, 2 }
})

Fields

Field mutation endpoints require credentials with schema permissions.

local field = app.integrations.baserow.create_field({
  table_id = 456,
  payload = {
    name = "Status",
    type = "single_select"
  }
})

app.integrations.baserow.update_field({
  field_id = field.id,
  payload = { name = "Lifecycle status" }
})

Raw API Helpers

Use api_get, api_post, api_patch, and api_delete only for relative paths inside the configured Baserow API host. Full URLs and parent-directory paths are rejected.

local response = app.integrations.baserow.api_get({
  path = "/api/database/fields/table/456/",
  query = { include = { "id", "name" } }
})

Multi-Account

If multiple Baserow accounts are configured, use the generated account namespace:

app.integrations.baserow.production.list_rows({ table_id = 456 })
app.integrations.baserow.staging.list_rows({ table_id = 456 })
Raw agent markdown
# Baserow Lua API Reference

Namespace: `app.integrations.baserow`

Baserow tools operate on database IDs, table IDs, field IDs, and row IDs from the Baserow REST API. Database tokens normally use `Authorization: Token ...`; account-level endpoints may require a host-provided JWT or Bearer token.

## Discovery

Use `list_databases`, `list_all_tables`, `list_database_tables`, `get_table`, and `list_fields` to find the schema before reading or writing rows.

```lua
local databases = app.integrations.baserow.list_databases({ page = 1, size = 100 })
local tables = app.integrations.baserow.list_database_tables({ database_id = 123 })
local fields = app.integrations.baserow.list_fields({ table_id = 456 })
```

`list_all_tables` returns the tables visible to the configured database token and is useful when the agent only has a database token scope.

## Rows

Use `list_rows` for new row-listing work. The older `list_tables` tool is kept only as a compatibility alias and also lists rows.

```lua
local rows = app.integrations.baserow.list_rows({
  table_id = 456,
  search = "Acme",
  order_by = "-id",
  filters = {
    { field = 789, type = "equal", value = "Active" }
  }
})

local row = app.integrations.baserow.get_row({
  table_id = 456,
  row_id = 1
})
```

Row outputs are the normalized JSON returned by Baserow. When `user_field_names` or field-name mode is used by the upstream endpoint, field names appear directly in the row object; otherwise Baserow may return field IDs such as `field_789`.

## Row Writes

```lua
local created = app.integrations.baserow.create_row({
  table_id = 456,
  data = {
    Name = "Acme",
    Status = "Active"
  }
})

local updated = app.integrations.baserow.update_row({
  table_id = 456,
  row_id = 1,
  data = {
    Status = "Inactive"
  }
})

app.integrations.baserow.move_row({
  table_id = 456,
  row_id = 1,
  before_id = 2
})

app.integrations.baserow.delete_row({
  table_id = 456,
  row_id = 1
})
```

## Batch Rows

Batch payloads use Baserow's `items` wrapper internally. You can pass a JSON array or Lua array of row objects.

```lua
local result = app.integrations.baserow.batch_create({
  table_id = 456,
  records = {
    { Name = "Acme" },
    { Name = "Globex" }
  }
})

app.integrations.baserow.batch_update({
  table_id = 456,
  records = {
    { id = 1, Status = "Active" },
    { id = 2, Status = "Inactive" }
  }
})

app.integrations.baserow.batch_delete({
  table_id = 456,
  row_ids = { 1, 2 }
})
```

## Fields

Field mutation endpoints require credentials with schema permissions.

```lua
local field = app.integrations.baserow.create_field({
  table_id = 456,
  payload = {
    name = "Status",
    type = "single_select"
  }
})

app.integrations.baserow.update_field({
  field_id = field.id,
  payload = { name = "Lifecycle status" }
})
```

## Raw API Helpers

Use `api_get`, `api_post`, `api_patch`, and `api_delete` only for relative paths inside the configured Baserow API host. Full URLs and parent-directory paths are rejected.

```lua
local response = app.integrations.baserow.api_get({
  path = "/api/database/fields/table/456/",
  query = { include = { "id", "name" } }
})
```

## Multi-Account

If multiple Baserow accounts are configured, use the generated account namespace:

```lua
app.integrations.baserow.production.list_rows({ table_id = 456 })
app.integrations.baserow.staging.list_rows({ table_id = 456 })
```
Metadata-derived Lua example
local result = app.integrations.baserow.api_delete({path = "example_path", payload = "example_payload", query = "example_query"})
print(result)

Functions

api_delete Read

Call a relative Baserow API path with DELETE for supported endpoints not covered by a dedicated tool.

Lua path
app.integrations.baserow.api_delete
Full name
baserow.baserow_api_delete
ParameterTypeRequiredDescription
path string yes Relative API path.
payload object no Optional JSON request body.
query object no Optional query parameters.
api_get Read

Call a relative Baserow API path with GET for supported endpoints not covered by a dedicated tool.

Lua path
app.integrations.baserow.api_get
Full name
baserow.baserow_api_get
ParameterTypeRequiredDescription
path string yes Relative API path, for example /api/database/fields/table/42/.
query object no Optional query parameters.
api_patch Read

Call a relative Baserow API path with PATCH for supported endpoints not covered by a dedicated tool.

Lua path
app.integrations.baserow.api_patch
Full name
baserow.baserow_api_patch
ParameterTypeRequiredDescription
path string yes Relative API path.
payload object no JSON request body.
query object no Optional query parameters.
api_post Read

Call a relative Baserow API path with POST for supported endpoints not covered by a dedicated tool.

Lua path
app.integrations.baserow.api_post
Full name
baserow.baserow_api_post
ParameterTypeRequiredDescription
path string yes Relative API path.
payload object no JSON request body.
query object no Optional query parameters.
batch_create Read

Create multiple rows in a Baserow table in a single request.

Lua path
app.integrations.baserow.batch_create
Full name
baserow.baserow_batch_create
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
records string yes JSON array of row objects, e.g. [{"field_1": "a"}, {"field_1": "b"}]. Each object is flat key-value pairs.
batch_delete Read

Delete multiple rows from a Baserow table in a single request.

Lua path
app.integrations.baserow.batch_delete
Full name
baserow.baserow_batch_delete
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
row_ids string yes JSON array of row IDs to delete, e.g. [1, 2, 3].
batch_update Read

Update multiple rows in a Baserow table in a single request. Each row must include its "id".

Lua path
app.integrations.baserow.batch_update
Full name
baserow.baserow_batch_update
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
records string yes JSON array of row objects to update. Each must include an "id" key, e.g. [{"id": 1, "field_1": "new"}, {"id": 2, "field_1": "new"}].
create_field Write

Create a field in a Baserow table. Requires an account token with schema permissions.

Lua path
app.integrations.baserow.create_field
Full name
baserow.baserow_create_field
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
payload object yes Field payload, for example {"name":"Status","type":"single_select"}.
create Write

Create a new row in a Baserow database table. Provide field data as a JSON object mapping field names to values.

Lua path
app.integrations.baserow.create
Full name
baserow.baserow_create_row
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID to create the row in.
data object yes Row data as a JSON object with field names (or field IDs) as keys and their values. Example: {"Name": "John", "Email": "john@example.com"}.
delete_field Write

Delete a Baserow field by field ID. This removes the field and its values.

Lua path
app.integrations.baserow.delete_field
Full name
baserow.baserow_delete_field
ParameterTypeRequiredDescription
field_id integer yes The Baserow field ID.
delete Write

Delete a row from a Baserow database table. This action is permanent and cannot be undone.

Lua path
app.integrations.baserow.delete
Full name
baserow.baserow_delete_row
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
row_id integer yes The ID of the row to delete.
get_current_user Read

Get the currently authenticated Baserow user profile. Returns user details including name, email, and workspace memberships.

Lua path
app.integrations.baserow.get_current_user
Full name
baserow.baserow_get_current_user
ParameterTypeRequiredDescription
No parameters.
get_field Read

Get metadata for a single Baserow field by field ID.

Lua path
app.integrations.baserow.get_field
Full name
baserow.baserow_get_field
ParameterTypeRequiredDescription
field_id integer yes The Baserow field ID.
get Read

Get a single row from a Baserow database table by its row ID. Returns all field values for the row.

Lua path
app.integrations.baserow.get
Full name
baserow.baserow_get_row
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
row_id integer yes The ID of the row to retrieve.
get_table Read

Get details for a single Baserow table by its ID.

Lua path
app.integrations.baserow.get_table
Full name
baserow.baserow_get_table
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
list_all_tables Read

List every Baserow table visible to the configured database token.

Lua path
app.integrations.baserow.list_all_tables
Full name
baserow.baserow_list_all_tables
ParameterTypeRequiredDescription
params object no Optional Baserow query parameters.
list_database_tables Read

List tables inside a specific Baserow database.

Lua path
app.integrations.baserow.list_database_tables
Full name
baserow.baserow_list_database_tables
ParameterTypeRequiredDescription
database_id integer yes The Baserow database ID.
list_databases Read

List all databases (applications) in the Baserow workspace. Returns database names, IDs, and types for navigation.

Lua path
app.integrations.baserow.list_databases
Full name
baserow.baserow_list_databases
ParameterTypeRequiredDescription
page integer no Page number (1-based). Defaults to 1.
size integer no Number of databases per page. Defaults to 100.
list_fields Read

List all fields (columns) and their types in a Baserow table.

Lua path
app.integrations.baserow.list_fields
Full name
baserow.baserow_list_fields
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
list Read

List rows in a Baserow table with optional filtering, searching, sorting, and pagination.

Lua path
app.integrations.baserow.list
Full name
baserow.baserow_list_rows
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
limit integer no Maximum number of rows to return (default: 100).
offset integer no Number of rows to skip for pagination.
search string no Search term to filter rows by.
order_by string no Field name to order by. Prefix with "-" for descending.
filter_type string no How to combine filters: "AND" or "OR".
filters string no JSON array of filter objects, e.g. [{"field": 123, "type": "equal", "value": "test"}].
field_ids string no Comma-separated list of field IDs to include in the response.
list_tables Read

List rows in a Baserow database table. Supports pagination and optional filters to narrow results by field values.

Lua path
app.integrations.baserow.list_tables
Full name
baserow.baserow_list_tables
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID to list rows from.
page integer no Page number (1-based). Defaults to 1.
size integer no Number of rows per page. Defaults to 100.
filters object no Optional Baserow filter parameters as key-value pairs (e.g., {"search": "term"}, {"filter__field_1__equal": "value"}).
move Write

Move a Baserow row before another row or to the end of a table.

Lua path
app.integrations.baserow.move
Full name
baserow.baserow_move_row
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
row_id integer yes The row ID to move.
before_id integer no Optional row ID to move this row before. Omit to move to the end.
update_field Write

Update a Baserow field definition. Requires an account token with schema permissions.

Lua path
app.integrations.baserow.update_field
Full name
baserow.baserow_update_field
ParameterTypeRequiredDescription
field_id integer yes The Baserow field ID.
payload object yes Field update payload.
update Write

Update an existing row in a Baserow database table. Provide field data as a JSON object with field names and new values. Only specified fields are updated.

Lua path
app.integrations.baserow.update
Full name
baserow.baserow_update_row
ParameterTypeRequiredDescription
table_id integer yes The Baserow table ID.
row_id integer yes The ID of the row to update.
data object yes Updated field data as a JSON object with field names (or field IDs) as keys and their new values. Example: {"Name": "Jane", "Status": "Active"}.