KosmoKrator

other

Attio Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Bearer token auth

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.

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

list_records

List records for an object type in Attio with filtering, sorting, and pagination.

Parameters

NameTypeRequiredDescription
object_idstringyesObject slug or ID (e.g. "people", "companies", "deals")
limitintegernoMax records to return (default: 20, max: 500)
offsetintegernoRecords to skip for pagination (default: 0)
sortsarraynoSort definitions. Each entry: {attribute = {slug = "name"}, direction = "asc"}
filtersobjectnoFilter definitions following Attio’s filter grammar (see below)

Sort Syntax

Each sort entry is a table with:

  • attribute — table with slug (string) for the attribute to sort on
  • direction"asc" or "desc"
sorts = {
  { attribute = { slug = "name" }, direction = "asc" }
}

Filter Syntax

Filters use a JSON-like structure. Wrap multiple filters with $and or $or:

-- Single filter
filters = {
  attribute = { slug = "name" },
  condition = "contains",
  value = "Acme"
}

-- Compound filter
filters = {
  ["$and"] = {
    {
      attribute = { slug = "name" },
      condition = "contains",
      value = "Acme"
    },
    {
      attribute = { slug = "stage" },
      condition = "equals",
      value = "lead"
    }
  }
}

Common conditions: equals, not_equals, contains, not_contains, starts_with, ends_with, is_empty, is_not_empty, greater_than, less_than, in, not_in.

Example

local result = app.integrations.attio.list_records({
  object_id = "companies",
  limit = 10,
  offset = 0,
  sorts = {
    { attribute = { slug = "name" }, direction = "asc" }
  },
  filters = {
    ["$and"] = {
      {
        attribute = { slug = "name" },
        condition = "contains",
        value = "Acme"
      }
    }
  }
})

for _, record in ipairs(result.data) do
  print(record.id.record_id .. ": " .. (record.values.name and record.values.name[1].value or "Unnamed"))
end

get_record

Get a single record by ID.

Parameters

NameTypeRequiredDescription
object_idstringyesObject slug or ID (e.g. "people", "companies")
idstringyesThe record UUID

Example

local result = app.integrations.attio.get_record({
  object_id = "companies",
  id = "aa1b2c3d-..."
})

local company = result.data
print(company.values.name[1].value)

create_record

Create a new record for a given object type.

Parameters

NameTypeRequiredDescription
object_idstringyesObject slug or ID (e.g. "people", "companies")
dataobjectyesAttribute values keyed by attribute slug

Example

local result = app.integrations.attio.create_record({
  object_id = "companies",
  data = {
    name = "Acme Corp",
    domains = { "acme.com" },
    website = "https://acme.com"
  }
})

print("Created company: " .. result.data.id.record_id)

list_objects

List all object types defined in the workspace.

Parameters

None.

Example

local result = app.integrations.attio.list_objects()

for _, obj in ipairs(result.data) do
  print(obj.api_slug .. " — " .. obj.singular_noun)
end

get_object

Get details for a specific object type, including its attributes.

Parameters

NameTypeRequiredDescription
idstringyesObject slug or UUID

Example

local result = app.integrations.attio.get_object({
  id = "companies"
})

for _, attr in ipairs(result.data.attributes) do
  print(attr.api_slug .. " (" .. attr.attribute_type .. ")")
end

list_workspaces

List all workspaces accessible to the authenticated user.

Parameters

None.

Example

local result = app.integrations.attio.list_workspaces()

for _, ws in ipairs(result.data) do
  print(ws.id.workspace_id .. ": " .. ws.name)
end

get_current_user

Get the currently authenticated user profile.

Parameters

None.

Example

local result = app.integrations.attio.get_current_user()

print("User: " .. result.data.first_name .. " " .. result.data.last_name)
print("Email: " .. result.data.email)

Multi-Account Usage

If you have multiple Attio workspaces configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.attio.list_records({ object_id = "companies" })

-- Explicit default (portable across setups)
app.integrations.attio.default.list_records({ object_id = "companies" })

-- Named accounts
app.integrations.attio.production.list_records({ object_id = "companies" })
app.integrations.attio.staging.list_records({ object_id = "companies" })

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

Raw agent markdown
# Attio CRM — Lua API Reference

## list_records

List records for an object type in Attio with filtering, sorting, and pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `object_id` | string | yes | Object slug or ID (e.g. `"people"`, `"companies"`, `"deals"`) |
| `limit` | integer | no | Max records to return (default: 20, max: 500) |
| `offset` | integer | no | Records to skip for pagination (default: 0) |
| `sorts` | array | no | Sort definitions. Each entry: `{attribute = {slug = "name"}, direction = "asc"}` |
| `filters` | object | no | Filter definitions following Attio's filter grammar (see below) |

### Sort Syntax

Each sort entry is a table with:

- `attribute` — table with `slug` (string) for the attribute to sort on
- `direction` — `"asc"` or `"desc"`

```lua
sorts = {
  { attribute = { slug = "name" }, direction = "asc" }
}
```

### Filter Syntax

Filters use a JSON-like structure. Wrap multiple filters with `$and` or `$or`:

```lua
-- Single filter
filters = {
  attribute = { slug = "name" },
  condition = "contains",
  value = "Acme"
}

-- Compound filter
filters = {
  ["$and"] = {
    {
      attribute = { slug = "name" },
      condition = "contains",
      value = "Acme"
    },
    {
      attribute = { slug = "stage" },
      condition = "equals",
      value = "lead"
    }
  }
}
```

Common conditions: `equals`, `not_equals`, `contains`, `not_contains`, `starts_with`, `ends_with`, `is_empty`, `is_not_empty`, `greater_than`, `less_than`, `in`, `not_in`.

### Example

```lua
local result = app.integrations.attio.list_records({
  object_id = "companies",
  limit = 10,
  offset = 0,
  sorts = {
    { attribute = { slug = "name" }, direction = "asc" }
  },
  filters = {
    ["$and"] = {
      {
        attribute = { slug = "name" },
        condition = "contains",
        value = "Acme"
      }
    }
  }
})

for _, record in ipairs(result.data) do
  print(record.id.record_id .. ": " .. (record.values.name and record.values.name[1].value or "Unnamed"))
end
```

---

## get_record

Get a single record by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `object_id` | string | yes | Object slug or ID (e.g. `"people"`, `"companies"`) |
| `id` | string | yes | The record UUID |

### Example

```lua
local result = app.integrations.attio.get_record({
  object_id = "companies",
  id = "aa1b2c3d-..."
})

local company = result.data
print(company.values.name[1].value)
```

---

## create_record

Create a new record for a given object type.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `object_id` | string | yes | Object slug or ID (e.g. `"people"`, `"companies"`) |
| `data` | object | yes | Attribute values keyed by attribute slug |

### Example

```lua
local result = app.integrations.attio.create_record({
  object_id = "companies",
  data = {
    name = "Acme Corp",
    domains = { "acme.com" },
    website = "https://acme.com"
  }
})

print("Created company: " .. result.data.id.record_id)
```

---

## list_objects

List all object types defined in the workspace.

### Parameters

None.

### Example

```lua
local result = app.integrations.attio.list_objects()

for _, obj in ipairs(result.data) do
  print(obj.api_slug .. " — " .. obj.singular_noun)
end
```

---

## get_object

Get details for a specific object type, including its attributes.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | Object slug or UUID |

### Example

```lua
local result = app.integrations.attio.get_object({
  id = "companies"
})

for _, attr in ipairs(result.data.attributes) do
  print(attr.api_slug .. " (" .. attr.attribute_type .. ")")
end
```

---

## list_workspaces

List all workspaces accessible to the authenticated user.

### Parameters

None.

### Example

```lua
local result = app.integrations.attio.list_workspaces()

for _, ws in ipairs(result.data) do
  print(ws.id.workspace_id .. ": " .. ws.name)
end
```

---

## get_current_user

Get the currently authenticated user profile.

### Parameters

None.

### Example

```lua
local result = app.integrations.attio.get_current_user()

print("User: " .. result.data.first_name .. " " .. result.data.last_name)
print("Email: " .. result.data.email)
```

---

## Multi-Account Usage

If you have multiple Attio workspaces configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.attio.list_records({ object_id = "companies" })

-- Explicit default (portable across setups)
app.integrations.attio.default.list_records({ object_id = "companies" })

-- Named accounts
app.integrations.attio.production.list_records({ object_id = "companies" })
app.integrations.attio.staging.list_records({ object_id = "companies" })
```

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

Metadata-Derived Lua Example

local result = app.integrations.attio.attio_list_records({
  object_id = "example_object_id",
  limit = 1,
  offset = 1,
  sorts = "example_sorts",
  filters = "example_filters"
})
print(result)

Functions

attio_list_records

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.

Operation
Read read
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"}]}.

attio_get_record

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

Operation
Read read
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.

attio_create_record

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

Operation
Write write
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.

attio_list_objects

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

Operation
Read read
Full name
attio.attio_list_objects
ParameterTypeRequiredDescription
No parameters.

attio_get_object

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.

Operation
Read read
Full name
attio.attio_get_object
ParameterTypeRequiredDescription
id string yes The object slug or UUID (e.g. "people", "companies", "deals").

attio_list_workspaces

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

Operation
Read read
Full name
attio.attio_list_workspaces
ParameterTypeRequiredDescription
No parameters.

attio_get_current_user

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

Operation
Read read
Full name
attio.attio_get_current_user
ParameterTypeRequiredDescription
No parameters.