KosmoKrator

productivity

Bitwarden Lua API for KosmoKrator Agents

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

Lua Namespace

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

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

Workflow file

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

workflow.lua
local bitwarden = app.integrations.bitwarden
local result = bitwarden.retrieve_collection({})

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

MCP-only Lua

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

Bitwarden

Lua namespace: bitwarden

This integration covers the Bitwarden Public API for organization administration. It manages organization collections, event logs, groups, members, subscription details, organization imports, and policies. It does not manage individual vault items; Bitwarden documents that as a separate Vault Management API.

Authentication

Use an organization API key from the Admin Console, not a personal API key. Configure client_id and client_secret to let the integration fetch an OAuth client-credentials bearer token with scope=api.organization. You can also provide a short-lived access_token directly for testing.

Cloud defaults are https://api.bitwarden.com and https://identity.bitwarden.com/connect/token. EU and self-hosted deployments should set both api_url and identity_url so the token and API hosts match.

Common Workflows

  • List collections with bitwarden_collections_list, then read or update one with bitwarden_collections_get or bitwarden_collections_put.
  • List groups with bitwarden_groups_list, update membership ids with bitwarden_groups_put_member_ids, or read group member ids with bitwarden_groups_get_member_ids.
  • Invite and manage members with bitwarden_members_post, bitwarden_members_revoke, bitwarden_members_restore, and bitwarden_members_post_reinvite.
  • Audit organization activity with bitwarden_events_list; use start, end, and continuation_token for bounded pagination.
  • Read and update organization policies with bitwarden_policies_list, bitwarden_policies_get, and bitwarden_policies_put.

Payload Notes

Write tools accept a body object matching Bitwarden’s official Public API request schema. List responses commonly use Bitwarden’s list envelope, for example object, data, and sometimes continuationToken. The tools return the API response without flattening so agents can preserve Bitwarden-specific fields.

Safe Example

local members = bitwarden_members_list({})
local events = bitwarden_events_list({
  start = "2026-01-01T00:00:00Z",
  end = "2026-01-31T23:59:59Z",
})
Raw agent markdown
# Bitwarden

Lua namespace: `bitwarden`

This integration covers the Bitwarden Public API for organization administration. It manages organization collections, event logs, groups, members, subscription details, organization imports, and policies. It does not manage individual vault items; Bitwarden documents that as a separate Vault Management API.

## Authentication

Use an organization API key from the Admin Console, not a personal API key. Configure `client_id` and `client_secret` to let the integration fetch an OAuth client-credentials bearer token with `scope=api.organization`. You can also provide a short-lived `access_token` directly for testing.

Cloud defaults are `https://api.bitwarden.com` and `https://identity.bitwarden.com/connect/token`. EU and self-hosted deployments should set both `api_url` and `identity_url` so the token and API hosts match.

## Common Workflows

- List collections with `bitwarden_collections_list`, then read or update one with `bitwarden_collections_get` or `bitwarden_collections_put`.
- List groups with `bitwarden_groups_list`, update membership ids with `bitwarden_groups_put_member_ids`, or read group member ids with `bitwarden_groups_get_member_ids`.
- Invite and manage members with `bitwarden_members_post`, `bitwarden_members_revoke`, `bitwarden_members_restore`, and `bitwarden_members_post_reinvite`.
- Audit organization activity with `bitwarden_events_list`; use `start`, `end`, and `continuation_token` for bounded pagination.
- Read and update organization policies with `bitwarden_policies_list`, `bitwarden_policies_get`, and `bitwarden_policies_put`.

## Payload Notes

Write tools accept a `body` object matching Bitwarden's official Public API request schema. List responses commonly use Bitwarden's list envelope, for example `object`, `data`, and sometimes `continuationToken`. The tools return the API response without flattening so agents can preserve Bitwarden-specific fields.

## Safe Example

```lua
local members = bitwarden_members_list({})
local events = bitwarden_events_list({
  start = "2026-01-01T00:00:00Z",
  end = "2026-01-31T23:59:59Z",
})
```
Metadata-derived Lua example
local result = app.integrations.bitwarden.retrieve_collection({})
print(result)

Functions

retrieve_collection Read

Retrieves the details of an existing collection. You need only supply the unique collection identifier that was returned upon collection creation.

Lua path
app.integrations.bitwarden.retrieve_collection
Full name
bitwarden.bitwarden_collections_get
ParameterTypeRequiredDescription
No parameters.
update_collection Write

Updates the specified collection object. If a property is not provided, the value of the existing property will be reset.

Lua path
app.integrations.bitwarden.update_collection
Full name
bitwarden.bitwarden_collections_put
ParameterTypeRequiredDescription
No parameters.
delete_collection Write

Permanently deletes a collection. This cannot be undone.

Lua path
app.integrations.bitwarden.delete_collection
Full name
bitwarden.bitwarden_collections_delete
ParameterTypeRequiredDescription
No parameters.
list_all_collections Read

Returns a list of your organization's collections. Collection objects listed in this call do not include information about their associated groups.

Lua path
app.integrations.bitwarden.list_all_collections
Full name
bitwarden.bitwarden_collections_list
ParameterTypeRequiredDescription
No parameters.
list_all_events Read

Returns a filtered list of your organization's event logs, paged by a continuation token. If no filters are provided, it will return the last 30 days of event for the organization.

Lua path
app.integrations.bitwarden.list_all_events
Full name
bitwarden.bitwarden_events_list
ParameterTypeRequiredDescription
No parameters.
retrieve_group Read

Retrieves the details of an existing group. You need only supply the unique group identifier that was returned upon group creation.

Lua path
app.integrations.bitwarden.retrieve_group
Full name
bitwarden.bitwarden_groups_get
ParameterTypeRequiredDescription
No parameters.
update_group Write

Updates the specified group object. If a property is not provided, the value of the existing property will be reset.

Lua path
app.integrations.bitwarden.update_group
Full name
bitwarden.bitwarden_groups_put
ParameterTypeRequiredDescription
No parameters.
delete_group Write

Permanently deletes a group. This cannot be undone.

Lua path
app.integrations.bitwarden.delete_group
Full name
bitwarden.bitwarden_groups_delete
ParameterTypeRequiredDescription
No parameters.
retrieve_groups_member_ids Read

Retrieves the unique identifiers for all members that are associated with this group. You need only supply the unique group identifier that was returned upon group creation.

Lua path
app.integrations.bitwarden.retrieve_groups_member_ids
Full name
bitwarden.bitwarden_groups_get_member_ids
ParameterTypeRequiredDescription
No parameters.
update_group_members Write

Updates the specified group's member associations.

Lua path
app.integrations.bitwarden.update_group_members
Full name
bitwarden.bitwarden_groups_put_member_ids
ParameterTypeRequiredDescription
No parameters.
list_all_groups Read

Returns a list of your organization's groups. Group objects listed in this call include information about their associated collections.

Lua path
app.integrations.bitwarden.list_all_groups
Full name
bitwarden.bitwarden_groups_list
ParameterTypeRequiredDescription
No parameters.
create_group Write

Creates a new group object.

Lua path
app.integrations.bitwarden.create_group
Full name
bitwarden.bitwarden_groups_post
ParameterTypeRequiredDescription
No parameters.
retrieve_member Read

Retrieves the details of an existing member of the organization. You need only supply the unique member identifier that was returned upon member creation.

Lua path
app.integrations.bitwarden.retrieve_member
Full name
bitwarden.bitwarden_members_get
ParameterTypeRequiredDescription
No parameters.
update_member Write

Updates the specified member object. If a property is not provided, the value of the existing property will be reset.

Lua path
app.integrations.bitwarden.update_member
Full name
bitwarden.bitwarden_members_put
ParameterTypeRequiredDescription
No parameters.
remove_member Write

Removes a member from the organization. This cannot be undone. The user account will still remain.

Lua path
app.integrations.bitwarden.remove_member
Full name
bitwarden.bitwarden_members_remove
ParameterTypeRequiredDescription
No parameters.
retrieve_member_group_ids Read

Retrieves the unique identifiers for all groups that are associated with this member. You need only supply the unique member identifier that was returned upon member creation.

Lua path
app.integrations.bitwarden.retrieve_member_group_ids
Full name
bitwarden.bitwarden_members_get_group_ids
ParameterTypeRequiredDescription
No parameters.
update_member_groups Write

Updates the specified member's group associations.

Lua path
app.integrations.bitwarden.update_member_groups
Full name
bitwarden.bitwarden_members_put_group_ids
ParameterTypeRequiredDescription
No parameters.
list_all_members Read

Returns a list of your organization's members. Member objects listed in this call include information about their associated collections.

Lua path
app.integrations.bitwarden.list_all_members
Full name
bitwarden.bitwarden_members_list
ParameterTypeRequiredDescription
No parameters.
create_member Write

Creates a new member object by inviting a user to the organization.

Lua path
app.integrations.bitwarden.create_member
Full name
bitwarden.bitwarden_members_post
ParameterTypeRequiredDescription
No parameters.
re_invite_member Write

Re-sends the invitation email to an organization member.

Lua path
app.integrations.bitwarden.re_invite_member
Full name
bitwarden.bitwarden_members_post_reinvite
ParameterTypeRequiredDescription
No parameters.
revoke_member_access_organization Write

Revoke a member's access to an organization.

Lua path
app.integrations.bitwarden.revoke_member_access_organization
Full name
bitwarden.bitwarden_members_revoke
ParameterTypeRequiredDescription
No parameters.
restore_member Write

Restores a previously revoked member of the organization.

Lua path
app.integrations.bitwarden.restore_member
Full name
bitwarden.bitwarden_members_restore
ParameterTypeRequiredDescription
No parameters.
retrieves_subscription_details_current_organization Read

Retrieves the subscription details for the current organization.

Lua path
app.integrations.bitwarden.retrieves_subscription_details_current_organization
Full name
bitwarden.bitwarden_organization_get_subscription
ParameterTypeRequiredDescription
No parameters.
update_organization_current_subscription_password_manager_and_or_secrets_manager Write

Update the organization's current subscription for Password Manager and/or Secrets Manager.

Lua path
app.integrations.bitwarden.update_organization_current_subscription_password_manager_and_or_secrets_manager
Full name
bitwarden.bitwarden_organization_post_subscription
ParameterTypeRequiredDescription
No parameters.
import_members_and_groups Write

Import members and groups from an external system.

Lua path
app.integrations.bitwarden.import_members_and_groups
Full name
bitwarden.bitwarden_organization_import
ParameterTypeRequiredDescription
No parameters.
retrieve_policy Read

Retrieves the details of a policy.

Lua path
app.integrations.bitwarden.retrieve_policy
Full name
bitwarden.bitwarden_policies_get
ParameterTypeRequiredDescription
No parameters.
update_policy Write

Updates the specified policy. If a property is not provided, the value of the existing property will be reset.

Lua path
app.integrations.bitwarden.update_policy
Full name
bitwarden.bitwarden_policies_put
ParameterTypeRequiredDescription
No parameters.
list_all_policies Read

Returns a list of your organization's policies.

Lua path
app.integrations.bitwarden.list_all_policies
Full name
bitwarden.bitwarden_policies_list
ParameterTypeRequiredDescription
No parameters.