KosmoKrator

productivity

Auth0 Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Bearer token auth

Lua Namespace

Agents call this integration through app.integrations.auth_zero.*. Use lua_read_doc("integrations.auth-zero") 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.

Auth0 — Lua API Reference

list_users

List users in the Auth0 tenant. Supports search with Lucene syntax, pagination, and sorting.

Parameters

NameTypeRequiredDescription
pageintegernoPage index (zero-based). Default: 0.
per_pageintegernoNumber of results per page. Default: 50, max: 100.
qstringnoLucene search query (e.g. "email:*@example.com").
sortstringnoField to sort by, with optional direction (e.g. "created_at:-1" or "name:1").

Examples

local users = app.integrations["auth-zero"].list_users({
  per_page = 10,
  q = 'email:*@example.com'
})

for _, user in ipairs(users) do
  print(user.email .. " — " .. (user.name or "no name"))
end
-- Paginate through all users
local page = 0
local all_users = {}

repeat
  local batch = app.integrations["auth-zero"].list_users({
    page = page,
    per_page = 100
  })
  for _, u in ipairs(batch) do
    table.insert(all_users, u)
  end
  page = page + 1
until #batch < 100

get_user

Retrieve a single Auth0 user by their user ID.

Parameters

NameTypeRequiredDescription
idstringyesThe Auth0 user identifier (e.g. `“auth0

Examples

local user = app.integrations["auth-zero"].get_user({
  id = "auth0|507f1f77bcf86cd799439010"
})

print(user.email)
print(user.name)
print(user.created_at)

create_user

Create a new user in Auth0. Requires email, password, and the connection name.

Parameters

NameTypeRequiredDescription
emailstringyesEmail address for the new user.
passwordstringyesPassword for the new user (must meet connection requirements).
connectionstringyesThe database connection name (e.g. "Username-Password-Authentication").
namestringnoFull name of the user.

Examples

local user = app.integrations["auth-zero"].create_user({
  email = "[email protected]",
  password = "S3cur3P@ssw0rd!",
  connection = "Username-Password-Authentication",
  name = "Jane Doe"
})

print("Created user: " .. user.user_id)

list_connections

List identity connections configured in the Auth0 tenant. Optionally filter by strategy.

Parameters

NameTypeRequiredDescription
strategystringnoFilter by connection strategy (e.g. "auth0", "google-oauth2", "samlp", "oidc").

Examples

local connections = app.integrations["auth-zero"].list_connections()

for _, conn in ipairs(connections) do
  print(conn.name .. " (" .. conn.strategy .. ")")
end
-- Only database connections
local db_conns = app.integrations["auth-zero"].list_connections({
  strategy = "auth0"
})

list_roles

List roles defined in the Auth0 tenant with optional pagination.

Parameters

NameTypeRequiredDescription
pageintegernoPage index (zero-based). Default: 0.
per_pageintegernoNumber of results per page. Default: 50.

Examples

local roles = app.integrations["auth-zero"].list_roles()

for _, role in ipairs(roles) do
  print(role.name .. ": " .. (role.description or "no description"))
end

get_tenant_settings

Retrieve the Auth0 tenant settings (session lifetime, idle timeout, default directory, etc.).

Parameters

None.

Examples

local settings = app.integrations["auth-zero"].get_tenant_settings()

print("Session lifetime: " .. settings.session_lifetime .. " hours")
print("Idle timeout: " .. (settings.idle_session_lifetime or "none"))

get_current_user

Retrieve the profile of the currently authenticated user. Also serves as a health check for the Auth0 connection.

Parameters

None.

Examples

local me = app.integrations["auth-zero"].get_current_user()

print("Token valid. Health check passed.")

Multi-Account Usage

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

-- Default account (always works)
app.integrations["auth-zero"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["auth-zero"].default.function_name({...})

-- Named accounts
app.integrations["auth-zero"].production.function_name({...})
app.integrations["auth-zero"].staging.function_name({...})

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

Raw agent markdown
# Auth0 — Lua API Reference

## list_users

List users in the Auth0 tenant. Supports search with Lucene syntax, pagination, and sorting.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page index (zero-based). Default: 0. |
| `per_page` | integer | no | Number of results per page. Default: 50, max: 100. |
| `q` | string | no | Lucene search query (e.g. `"email:*@example.com"`). |
| `sort` | string | no | Field to sort by, with optional direction (e.g. `"created_at:-1"` or `"name:1"`). |

### Examples

```lua
local users = app.integrations["auth-zero"].list_users({
  per_page = 10,
  q = 'email:*@example.com'
})

for _, user in ipairs(users) do
  print(user.email .. " — " .. (user.name or "no name"))
end
```

```lua
-- Paginate through all users
local page = 0
local all_users = {}

repeat
  local batch = app.integrations["auth-zero"].list_users({
    page = page,
    per_page = 100
  })
  for _, u in ipairs(batch) do
    table.insert(all_users, u)
  end
  page = page + 1
until #batch < 100
```

---

## get_user

Retrieve a single Auth0 user by their user ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The Auth0 user identifier (e.g. `"auth0|abc123"`, `"google-oauth2|xyz"`). |

### Examples

```lua
local user = app.integrations["auth-zero"].get_user({
  id = "auth0|507f1f77bcf86cd799439010"
})

print(user.email)
print(user.name)
print(user.created_at)
```

---

## create_user

Create a new user in Auth0. Requires email, password, and the connection name.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `email` | string | yes | Email address for the new user. |
| `password` | string | yes | Password for the new user (must meet connection requirements). |
| `connection` | string | yes | The database connection name (e.g. `"Username-Password-Authentication"`). |
| `name` | string | no | Full name of the user. |

### Examples

```lua
local user = app.integrations["auth-zero"].create_user({
  email = "[email protected]",
  password = "S3cur3P@ssw0rd!",
  connection = "Username-Password-Authentication",
  name = "Jane Doe"
})

print("Created user: " .. user.user_id)
```

---

## list_connections

List identity connections configured in the Auth0 tenant. Optionally filter by strategy.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `strategy` | string | no | Filter by connection strategy (e.g. `"auth0"`, `"google-oauth2"`, `"samlp"`, `"oidc"`). |

### Examples

```lua
local connections = app.integrations["auth-zero"].list_connections()

for _, conn in ipairs(connections) do
  print(conn.name .. " (" .. conn.strategy .. ")")
end
```

```lua
-- Only database connections
local db_conns = app.integrations["auth-zero"].list_connections({
  strategy = "auth0"
})
```

---

## list_roles

List roles defined in the Auth0 tenant with optional pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page index (zero-based). Default: 0. |
| `per_page` | integer | no | Number of results per page. Default: 50. |

### Examples

```lua
local roles = app.integrations["auth-zero"].list_roles()

for _, role in ipairs(roles) do
  print(role.name .. ": " .. (role.description or "no description"))
end
```

---

## get_tenant_settings

Retrieve the Auth0 tenant settings (session lifetime, idle timeout, default directory, etc.).

### Parameters

None.

### Examples

```lua
local settings = app.integrations["auth-zero"].get_tenant_settings()

print("Session lifetime: " .. settings.session_lifetime .. " hours")
print("Idle timeout: " .. (settings.idle_session_lifetime or "none"))
```

---

## get_current_user

Retrieve the profile of the currently authenticated user. Also serves as a health check for the Auth0 connection.

### Parameters

None.

### Examples

```lua
local me = app.integrations["auth-zero"].get_current_user()

print("Token valid. Health check passed.")
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations["auth-zero"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["auth-zero"].default.function_name({...})

-- Named accounts
app.integrations["auth-zero"].production.function_name({...})
app.integrations["auth-zero"].staging.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.auth_zero.auth_zero_list_users({
  page = 1,
  per_page = 1,
  q = "example_q",
  sort = "example_sort"
})
print(result)

Functions

auth_zero_list_users

List users in the Auth0 tenant. Supports search with Lucene syntax, pagination, and sorting.

Operation
Read read
Full name
auth-zero.auth_zero_list_users
ParameterTypeRequiredDescription
page integer no Page index (zero-based). Default: 0.
per_page integer no Number of results per page. Default: 50, max: 100.
q string no Lucene search query (e.g. "email:*@example.com").
sort string no Field to sort by, with optional direction (e.g. "created_at:-1" or "name:1").

auth_zero_get_user

Retrieve a single Auth0 user by their user ID (e.g. "auth0|abc123").

Operation
Read read
Full name
auth-zero.auth_zero_get_user
ParameterTypeRequiredDescription
id string yes The Auth0 user identifier (e.g. "auth0|abc123", "google-oauth2|xyz").

auth_zero_create_user

Create a new user in Auth0. Requires email, password, and the connection name (database connection).

Operation
Write write
Full name
auth-zero.auth_zero_create_user
ParameterTypeRequiredDescription
email string yes Email address for the new user.
password string yes Password for the new user (must meet connection requirements).
connection string yes The database connection name to create the user in (e.g. "Username-Password-Authentication").
name string no Full name of the user.

auth_zero_list_connections

List identity connections configured in the Auth0 tenant. Optionally filter by strategy (e.g. "auth0", "google-oauth2").

Operation
Read read
Full name
auth-zero.auth_zero_list_connections
ParameterTypeRequiredDescription
strategy string no Filter by connection strategy (e.g. "auth0", "google-oauth2", "samlp", "oidc").

auth_zero_list_roles

List roles defined in the Auth0 tenant with optional pagination.

Operation
Read read
Full name
auth-zero.auth_zero_list_roles
ParameterTypeRequiredDescription
page integer no Page index (zero-based). Default: 0.
per_page integer no Number of results per page. Default: 50.

auth_zero_get_tenant_settings

Retrieve the Auth0 tenant settings (session lifetime, idle timeout, default directory, etc.).

Operation
Read read
Full name
auth-zero.auth_zero_get_tenant_settings
ParameterTypeRequiredDescription
No parameters.

auth_zero_get_current_user

Retrieve the profile of the currently authenticated user. Also serves as a health check for the Auth0 connection.

Operation
Read read
Full name
auth-zero.auth_zero_get_current_user
ParameterTypeRequiredDescription
No parameters.