KosmoKrator

productivity

Attio Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.attio.api_get({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("attio"))' --json
kosmo integrations:lua --eval 'print(docs.read("attio.api_get"))' --json

Workflow file

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

workflow.lua
local attio = app.integrations.attio
local result = attio.api_get({})

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

MCP-only Lua

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

Attio CRM Lua API Reference

Namespace: app.integrations.attio

This integration manages Attio CRM records, objects, attributes, lists, entries, notes, tasks, and webhooks through the Attio REST API. Tools return Attio’s parsed JSON response directly, usually with the primary payload under data.

Raw API Helpers

Use raw helpers for newer or less common Attio endpoints:

ToolMethod
api_getGET
api_postPOST
api_patchPATCH
api_putPUT
api_deleteDELETE
local result = app.integrations.attio.api_get({
  path = "/v2/lists"
})

Records And Objects

ToolPurpose
list_objectsList object definitions
get_objectGet one object definition
list_recordsQuery records for an object
get_recordGet one record
create_recordCreate a record
update_recordUpdate record values
delete_recordDelete a record
list_record_entriesList list entries attached to a record
local companies = app.integrations.attio.list_records({
  object_id = "companies",
  limit = 25,
  filters = { name = "Acme" }
})

local created = app.integrations.attio.create_record({
  object_id = "companies",
  data = {
    name = "Example Corp",
    website = "https://example.test"
  }
})

local updated = app.integrations.attio.update_record({
  object_id = "companies",
  record_id = "891dcbfc-9141-415d-9b2a-2238a6cc012d",
  values = {
    website = "https://example.test"
  }
})

Attributes

ToolPurpose
list_attributesList attributes for an object or list
get_attributeGet one attribute
create_attributeCreate an object or list attribute
local attrs = app.integrations.attio.list_attributes({
  target = "objects",
  identifier = "companies"
})

For target, use objects for object attributes or lists for list attributes.

Lists And Entries

ToolPurpose
list_listsList Attio lists
get_listGet one list
create_listCreate a list
update_listUpdate a list
list_entriesQuery entries in a list
create_entryAdd a record to a list
get_entryGet one list entry
update_entryUpdate entry values
delete_entryDelete an entry
local entries = app.integrations.attio.list_entries({
  list_id = "sales-prospects",
  limit = 50,
  filter = { name = "Ada Lovelace" }
})

local entry = app.integrations.attio.create_entry({
  list_id = "sales-prospects",
  parent_object = "people",
  parent_record_id = "891dcbfc-9141-415d-9b2a-2238a6cc012d",
  entry_values = {
    status = "In Progress"
  }
})

update_entry uses Attio’s PUT endpoint, which overwrites multiselect values.

Notes, Tasks, And Webhooks

ToolPurpose
list_notesList notes globally or for a record
create_noteCreate a note
list_tasksList tasks
create_taskCreate a task
update_taskUpdate a task
delete_taskDelete a task
list_webhooksList webhooks
local notes = app.integrations.attio.list_notes({
  parent_object = "people",
  parent_record_id = "891dcbfc-9141-415d-9b2a-2238a6cc012d"
})

local task = app.integrations.attio.create_task({
  content_plaintext = "Follow up",
  deadline_at = "2026-05-15",
  linked_records = {
    {
      target_object_id = "people",
      target_record_id = "891dcbfc-9141-415d-9b2a-2238a6cc012d"
    }
  }
})

Account Context

list_workspaces and get_current_user help confirm which Attio account and workspace the token can access.

If multiple Attio accounts are configured, use account-specific namespaces:

local result = app.integrations.attio.accounts.sales.list_records({
  object_id = "companies"
})

Safety Notes

  • Use fake examples such as example.test in generated docs and tests.
  • Record, entry, and task deletes are destructive.
  • Attio create/update payloads usually wrap fields under data; first-class tools do that wrapping when you pass first-class parameters.
Raw agent markdown
# Attio CRM Lua API Reference

Namespace: `app.integrations.attio`

This integration manages Attio CRM records, objects, attributes, lists, entries, notes, tasks, and webhooks through the Attio REST API. Tools return Attio's parsed JSON response directly, usually with the primary payload under `data`.

## Raw API Helpers

Use raw helpers for newer or less common Attio endpoints:

| Tool | Method |
|------|--------|
| `api_get` | GET |
| `api_post` | POST |
| `api_patch` | PATCH |
| `api_put` | PUT |
| `api_delete` | DELETE |

```lua
local result = app.integrations.attio.api_get({
  path = "/v2/lists"
})
```

## Records And Objects

| Tool | Purpose |
|------|---------|
| `list_objects` | List object definitions |
| `get_object` | Get one object definition |
| `list_records` | Query records for an object |
| `get_record` | Get one record |
| `create_record` | Create a record |
| `update_record` | Update record values |
| `delete_record` | Delete a record |
| `list_record_entries` | List list entries attached to a record |

```lua
local companies = app.integrations.attio.list_records({
  object_id = "companies",
  limit = 25,
  filters = { name = "Acme" }
})

local created = app.integrations.attio.create_record({
  object_id = "companies",
  data = {
    name = "Example Corp",
    website = "https://example.test"
  }
})

local updated = app.integrations.attio.update_record({
  object_id = "companies",
  record_id = "891dcbfc-9141-415d-9b2a-2238a6cc012d",
  values = {
    website = "https://example.test"
  }
})
```

## Attributes

| Tool | Purpose |
|------|---------|
| `list_attributes` | List attributes for an object or list |
| `get_attribute` | Get one attribute |
| `create_attribute` | Create an object or list attribute |

```lua
local attrs = app.integrations.attio.list_attributes({
  target = "objects",
  identifier = "companies"
})
```

For `target`, use `objects` for object attributes or `lists` for list attributes.

## Lists And Entries

| Tool | Purpose |
|------|---------|
| `list_lists` | List Attio lists |
| `get_list` | Get one list |
| `create_list` | Create a list |
| `update_list` | Update a list |
| `list_entries` | Query entries in a list |
| `create_entry` | Add a record to a list |
| `get_entry` | Get one list entry |
| `update_entry` | Update entry values |
| `delete_entry` | Delete an entry |

```lua
local entries = app.integrations.attio.list_entries({
  list_id = "sales-prospects",
  limit = 50,
  filter = { name = "Ada Lovelace" }
})

local entry = app.integrations.attio.create_entry({
  list_id = "sales-prospects",
  parent_object = "people",
  parent_record_id = "891dcbfc-9141-415d-9b2a-2238a6cc012d",
  entry_values = {
    status = "In Progress"
  }
})
```

`update_entry` uses Attio's PUT endpoint, which overwrites multiselect values.

## Notes, Tasks, And Webhooks

| Tool | Purpose |
|------|---------|
| `list_notes` | List notes globally or for a record |
| `create_note` | Create a note |
| `list_tasks` | List tasks |
| `create_task` | Create a task |
| `update_task` | Update a task |
| `delete_task` | Delete a task |
| `list_webhooks` | List webhooks |

```lua
local notes = app.integrations.attio.list_notes({
  parent_object = "people",
  parent_record_id = "891dcbfc-9141-415d-9b2a-2238a6cc012d"
})

local task = app.integrations.attio.create_task({
  content_plaintext = "Follow up",
  deadline_at = "2026-05-15",
  linked_records = {
    {
      target_object_id = "people",
      target_record_id = "891dcbfc-9141-415d-9b2a-2238a6cc012d"
    }
  }
})
```

## Account Context

`list_workspaces` and `get_current_user` help confirm which Attio account and workspace the token can access.

If multiple Attio accounts are configured, use account-specific namespaces:

```lua
local result = app.integrations.attio.accounts.sales.list_records({
  object_id = "companies"
})
```

## Safety Notes

- Use fake examples such as `example.test` in generated docs and tests.
- Record, entry, and task deletes are destructive.
- Attio create/update payloads usually wrap fields under `data`; first-class tools do that wrapping when you pass first-class parameters.
Metadata-derived Lua example
local result = app.integrations.attio.api_get({})
print(result)

Functions

api_get Read

Call any Attio GET endpoint.

Lua path
app.integrations.attio.api_get
Full name
attio.attio_api_get
ParameterTypeRequiredDescription
No parameters.
api_post Write

Call any Attio POST endpoint.

Lua path
app.integrations.attio.api_post
Full name
attio.attio_api_post
ParameterTypeRequiredDescription
No parameters.
api_patch Write

Call any Attio PATCH endpoint.

Lua path
app.integrations.attio.api_patch
Full name
attio.attio_api_patch
ParameterTypeRequiredDescription
No parameters.
api_put Write

Call any Attio PUT endpoint.

Lua path
app.integrations.attio.api_put
Full name
attio.attio_api_put
ParameterTypeRequiredDescription
No parameters.
api_delete Write

Call any Attio DELETE endpoint.

Lua path
app.integrations.attio.api_delete
Full name
attio.attio_api_delete
ParameterTypeRequiredDescription
No parameters.
list_workspaces Read

List all Attio workspaces accessible to the authenticated user. Returns workspace IDs and names useful for understanding the context of the current integration.

Lua path
app.integrations.attio.list_workspaces
Full name
attio.attio_list_workspaces
ParameterTypeRequiredDescription
No parameters.
get_current_user Read

Get the currently authenticated Attio user profile. Useful for verifying API connectivity and identifying which workspace the integration is connected to.

Lua path
app.integrations.attio.get_current_user
Full name
attio.attio_get_current_user
ParameterTypeRequiredDescription
No parameters.
list_objects Read

List all object types defined in the Attio workspace (e.g. people, companies, deals, custom objects). Useful for discovering available objects before querying records.

Lua path
app.integrations.attio.list_objects
Full name
attio.attio_list_objects
ParameterTypeRequiredDescription
No parameters.
get_object Read

Get details for a specific object type in Attio, including its attributes and their types. Useful for understanding what fields are available before creating or updating records.

Lua path
app.integrations.attio.get_object
Full name
attio.attio_get_object
ParameterTypeRequiredDescription
id string yes The object slug or UUID (e.g. "people", "companies", "deals").
list_attributes Read

List object or list attributes.

Lua path
app.integrations.attio.list_attributes
Full name
attio.attio_list_attributes
ParameterTypeRequiredDescription
No parameters.
get_attribute Read

Get an object or list attribute.

Lua path
app.integrations.attio.get_attribute
Full name
attio.attio_get_attribute
ParameterTypeRequiredDescription
No parameters.
create_attribute Write

Create an object or list attribute.

Lua path
app.integrations.attio.create_attribute
Full name
attio.attio_create_attribute
ParameterTypeRequiredDescription
No parameters.
list_records Read

List records for an object type in Attio (e.g. people, companies, deals). Supports filtering, sorting, and pagination via a POST query endpoint. Use filters to narrow results by attribute values and sorts to control ordering.

Lua path
app.integrations.attio.list_records
Full name
attio.attio_list_records
ParameterTypeRequiredDescription
object_id string yes The object slug or ID (e.g. "people", "companies", "deals").
limit integer no Maximum number of records to return (default: 20, max: 500).
offset integer no Number of records to skip for pagination (default: 0).
sorts array no Sort definitions. Each entry is an object with "attribute" (object with "slug") and "direction" ("asc" or "desc"). Example: [{"attribute": {"slug": "name"}, "direction": "asc"}].
filters object no Filter definitions following Attio's filter grammar. Can be a single filter or a compound filter with "$and"/"$or". Example: {"$and": [{"attribute": {"slug": "name"}, "condition": "contains", "value": "Acme"}]}.
get_record Read

Get a single record from Attio by its object type and record ID. Returns full record details including all attribute values.

Lua path
app.integrations.attio.get_record
Full name
attio.attio_get_record
ParameterTypeRequiredDescription
object_id string yes The object slug or ID (e.g. "people", "companies", "deals").
id string yes The record UUID.
create_record Write

Create a new record in Attio for a given object type. Pass attribute values keyed by their attribute slug in the data parameter.

Lua path
app.integrations.attio.create_record
Full name
attio.attio_create_record
ParameterTypeRequiredDescription
object_id string yes The object slug or ID (e.g. "people", "companies", "deals").
data object yes Record data keyed by attribute slug. Example: {"name": "Acme Corp", "website": "https://acme.com"}. Values depend on the attribute type.
update_record Write

Update a record for an object type.

Lua path
app.integrations.attio.update_record
Full name
attio.attio_update_record
ParameterTypeRequiredDescription
No parameters.
delete_record Write

Delete a record for an object type.

Lua path
app.integrations.attio.delete_record
Full name
attio.attio_delete_record
ParameterTypeRequiredDescription
No parameters.
list_record_entries Read

List list entries for a record.

Lua path
app.integrations.attio.list_record_entries
Full name
attio.attio_list_record_entries
ParameterTypeRequiredDescription
No parameters.
list_lists Read

List Attio lists.

Lua path
app.integrations.attio.list_lists
Full name
attio.attio_list_lists
ParameterTypeRequiredDescription
No parameters.
get_list Read

Get an Attio list.

Lua path
app.integrations.attio.get_list
Full name
attio.attio_get_list
ParameterTypeRequiredDescription
No parameters.
create_list Write

Create an Attio list.

Lua path
app.integrations.attio.create_list
Full name
attio.attio_create_list
ParameterTypeRequiredDescription
No parameters.
update_list Write

Update an Attio list.

Lua path
app.integrations.attio.update_list
Full name
attio.attio_update_list
ParameterTypeRequiredDescription
No parameters.
list_entries Read

Query entries in an Attio list.

Lua path
app.integrations.attio.list_entries
Full name
attio.attio_list_entries
ParameterTypeRequiredDescription
No parameters.
create_entry Write

Add a record to an Attio list.

Lua path
app.integrations.attio.create_entry
Full name
attio.attio_create_entry
ParameterTypeRequiredDescription
No parameters.
get_entry Read

Get an Attio list entry.

Lua path
app.integrations.attio.get_entry
Full name
attio.attio_get_entry
ParameterTypeRequiredDescription
No parameters.
update_entry Write

Update an Attio list entry.

Lua path
app.integrations.attio.update_entry
Full name
attio.attio_update_entry
ParameterTypeRequiredDescription
No parameters.
delete_entry Write

Delete an Attio list entry.

Lua path
app.integrations.attio.delete_entry
Full name
attio.attio_delete_entry
ParameterTypeRequiredDescription
No parameters.
list_notes Read

List Attio notes.

Lua path
app.integrations.attio.list_notes
Full name
attio.attio_list_notes
ParameterTypeRequiredDescription
No parameters.
create_note Write

Create an Attio note.

Lua path
app.integrations.attio.create_note
Full name
attio.attio_create_note
ParameterTypeRequiredDescription
No parameters.
list_tasks Read

List Attio tasks.

Lua path
app.integrations.attio.list_tasks
Full name
attio.attio_list_tasks
ParameterTypeRequiredDescription
No parameters.
create_task Write

Create an Attio task.

Lua path
app.integrations.attio.create_task
Full name
attio.attio_create_task
ParameterTypeRequiredDescription
No parameters.
update_task Write

Update an Attio task.

Lua path
app.integrations.attio.update_task
Full name
attio.attio_update_task
ParameterTypeRequiredDescription
No parameters.
delete_task Write

Delete an Attio task.

Lua path
app.integrations.attio.delete_task
Full name
attio.attio_delete_task
ParameterTypeRequiredDescription
No parameters.
list_webhooks Read

List Attio webhooks.

Lua path
app.integrations.attio.list_webhooks
Full name
attio.attio_list_webhooks
ParameterTypeRequiredDescription
No parameters.