KosmoKrator

productivity

Docker Hub Lua API for KosmoKrator Agents

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

Lua Namespace

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

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

Workflow file

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

workflow.lua
local docker = app.integrations.docker
local result = docker.create_authentication_token({})

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

MCP-only Lua

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

Docker Hub Lua API Reference

Namespace: docker

This integration exposes generated coverage for Docker Hub’s official OpenAPI document at https://docs.docker.com/reference/api/hub/latest.yaml.

Configure url as the API root, usually https://hub.docker.com. Existing configs that use https://hub.docker.com/v2 continue to work for /v2 tools.

Authentication uses a Docker Hub bearer token or personal access token. Endpoint access depends on the token and organization permissions.

Common Tools

  • docker_list_repositories maps to GET /v2/namespaces/{namespace}/repositories.
  • docker_get_repository maps to GET /v2/namespaces/{namespace}/repositories/{repository}.
  • docker_create_repository maps to POST /v2/namespaces/{namespace}/repositories.
  • docker_list_tags maps to GET /v2/namespaces/{namespace}/repositories/{repository}/tags.
  • docker_get_tag maps to GET /v2/namespaces/{namespace}/repositories/{repository}/tags/{tag}.

The generated catalog also covers user login/token endpoints, access tokens, audit logs, organization settings, organization access tokens, members, groups, invites, immutable tags, repository groups, and SCIM users/groups/schemas.

Arguments

Path and query parameters use names from Docker’s OpenAPI document. Snake-case aliases are also accepted. JSON request bodies go in body; if body is omitted, non-path/query/header arguments are collected into the body.

Examples

local repos = docker.docker_list_repositories({
  namespace = "example-org",
  page_size = 25,
  page = 1
})
local repo = docker.docker_get_repository({
  namespace = "example-org",
  repository = "api"
})
local tags = docker.docker_list_tags({
  namespace = "example-org",
  repository = "api",
  page_size = 50
})
local created = docker.docker_create_repository({
  namespace = "example-org",
  body = {
    name = "agent-demo",
    description = "Demo repository",
    is_private = true
  }
})

Return Shapes

Responses are Docker Hub’s parsed JSON responses. Paginated endpoints usually include count, next, previous, and results fields.

Non-JSON responses return:

{
  body = "...",
  content_type = "text/plain"
}

The previous docker_list_organizations and docker_get_current_user helpers are intentionally not part of the generated catalog because the current official Hub OpenAPI document does not expose those operations.

Raw agent markdown
# Docker Hub Lua API Reference

Namespace: `docker`

This integration exposes generated coverage for Docker Hub's official OpenAPI document at `https://docs.docker.com/reference/api/hub/latest.yaml`.

Configure `url` as the API root, usually `https://hub.docker.com`. Existing configs that use `https://hub.docker.com/v2` continue to work for `/v2` tools.

Authentication uses a Docker Hub bearer token or personal access token. Endpoint access depends on the token and organization permissions.

## Common Tools

- `docker_list_repositories` maps to `GET /v2/namespaces/{namespace}/repositories`.
- `docker_get_repository` maps to `GET /v2/namespaces/{namespace}/repositories/{repository}`.
- `docker_create_repository` maps to `POST /v2/namespaces/{namespace}/repositories`.
- `docker_list_tags` maps to `GET /v2/namespaces/{namespace}/repositories/{repository}/tags`.
- `docker_get_tag` maps to `GET /v2/namespaces/{namespace}/repositories/{repository}/tags/{tag}`.

The generated catalog also covers user login/token endpoints, access tokens, audit logs, organization settings, organization access tokens, members, groups, invites, immutable tags, repository groups, and SCIM users/groups/schemas.

## Arguments

Path and query parameters use names from Docker's OpenAPI document. Snake-case aliases are also accepted. JSON request bodies go in `body`; if `body` is omitted, non-path/query/header arguments are collected into the body.

## Examples

```lua
local repos = docker.docker_list_repositories({
  namespace = "example-org",
  page_size = 25,
  page = 1
})
```

```lua
local repo = docker.docker_get_repository({
  namespace = "example-org",
  repository = "api"
})
```

```lua
local tags = docker.docker_list_tags({
  namespace = "example-org",
  repository = "api",
  page_size = 50
})
```

```lua
local created = docker.docker_create_repository({
  namespace = "example-org",
  body = {
    name = "agent-demo",
    description = "Demo repository",
    is_private = true
  }
})
```

## Return Shapes

Responses are Docker Hub's parsed JSON responses. Paginated endpoints usually include `count`, `next`, `previous`, and `results` fields.

Non-JSON responses return:

```lua
{
  body = "...",
  content_type = "text/plain"
}
```

The previous `docker_list_organizations` and `docker_get_current_user` helpers are intentionally not part of the generated catalog because the current official Hub OpenAPI document does not expose those operations.
Metadata-derived Lua example
local result = app.integrations.docker.create_authentication_token({})
print(result)

Functions

create_authentication_token Write

Creates and returns a bearer token in JWT format that you can use to authenticate with Docker Hub APIs. The returned token is used in the HTTP Authorization header like `Authorization: Bearer {TOKEN}`. _**As of September 16, 2024, this route requires a personal access token (PAT) instead of a password if your organization has SSO enforced.**_ <div style="background-color:rgb(255, 165, 0, .25); padding:5px; border-radius:4px"> <strong>Deprecated</strong>: Use [<a href="#tag/authentication-api/operation/AuthCreateAccessToken">Create access token</a>] instead. </div>

Lua path
app.integrations.docker.create_authentication_token
Full name
docker.docker_post_users_login
ParameterTypeRequiredDescription
No parameters.
second_factor_authentication Write

When a user has two-factor authentication (2FA) enabled, this is the second call to perform after `/v2/users/login` call. Creates and returns a bearer token in JWT format that you can use to authenticate with Docker Hub APIs. The returned token is used in the HTTP Authorization header like `Authorization: Bearer {TOKEN}`. Most Docker Hub APIs require this token either to consume or to get detailed information. For example, to list images in a private repository.

Lua path
app.integrations.docker.second_factor_authentication
Full name
docker.docker_post_users2_f_a_login
ParameterTypeRequiredDescription
No parameters.
create_access_token Write

Creates and returns a short-lived access token in JWT format for use as a bearer when calling Docker APIs. If successful, the access token returned should be used in the HTTP Authorization header like `Authorization: Bearer {access_token}`. _**If your organization has SSO enforced, you must use a personal access token (PAT) instead of a password.**_

Lua path
app.integrations.docker.create_access_token
Full name
docker.docker_auth_create_access_token
ParameterTypeRequiredDescription
No parameters.
list_personal_access_tokens Read

Returns a paginated list of personal access tokens.

Lua path
app.integrations.docker.list_personal_access_tokens
Full name
docker.docker_get_v2_access_tokens
ParameterTypeRequiredDescription
No parameters.
create_personal_access_token Write

Creates and returns a personal access token.

Lua path
app.integrations.docker.create_personal_access_token
Full name
docker.docker_post_v2_access_tokens
ParameterTypeRequiredDescription
No parameters.
get_personal_access_token Read

Returns a personal access token by UUID.

Lua path
app.integrations.docker.get_personal_access_token
Full name
docker.docker_get_v2_access_tokens_by_uuid
ParameterTypeRequiredDescription
No parameters.
update_personal_access_token Write

Updates a personal access token partially. You can either update the token's label or enable/disable it.

Lua path
app.integrations.docker.update_personal_access_token
Full name
docker.docker_patch_v2_access_tokens_by_uuid
ParameterTypeRequiredDescription
No parameters.
delete_personal_access_token Write

Deletes a personal access token permanently. This cannot be undone.

Lua path
app.integrations.docker.delete_personal_access_token
Full name
docker.docker_delete_v2_access_tokens_by_uuid
ParameterTypeRequiredDescription
No parameters.
list_audit_log_actions Read

List audit log actions for a namespace to be used as a filter for querying audit log events. <span class="oat"></span>

Lua path
app.integrations.docker.list_audit_log_actions
Full name
docker.docker_audit_logs_list_audit_actions
ParameterTypeRequiredDescription
No parameters.
list_audit_log_events Read

List audit log events for a given namespace. <span class="oat"></span>

Lua path
app.integrations.docker.list_audit_log_events
Full name
docker.docker_audit_logs_list_audit_logs
ParameterTypeRequiredDescription
No parameters.
get_organization_settings Read

Returns organization settings by name.

Lua path
app.integrations.docker.get_organization_settings
Full name
docker.docker_get_v2_orgs_by_name_settings
ParameterTypeRequiredDescription
No parameters.
update_organization_settings Write

Updates an organization's settings. Some settings are only used when the organization is on a business subscription. ***Only users with administrative privileges for the organization (owner role) can modify these settings.*** The following settings are only used on a business subscription: - `restricted_images`

Lua path
app.integrations.docker.update_organization_settings
Full name
docker.docker_put_v2_orgs_by_name_settings
ParameterTypeRequiredDescription
No parameters.
list_access_tokens Read

List access tokens for an organization.

Lua path
app.integrations.docker.list_access_tokens
Full name
docker.docker_get_v2_orgs_by_name_access_tokens
ParameterTypeRequiredDescription
No parameters.
create_access_token Write

Create an access token for an organization.

Lua path
app.integrations.docker.create_access_token
Full name
docker.docker_post_v2_orgs_by_name_access_tokens
ParameterTypeRequiredDescription
No parameters.
get_access_token Read

Get details of a specific access token for an organization.

Lua path
app.integrations.docker.get_access_token
Full name
docker.docker_get_v2_orgs_by_org_name_access_tokens_by_access_token_id
ParameterTypeRequiredDescription
No parameters.
update_access_token Write

Update a specific access token for an organization.

Lua path
app.integrations.docker.update_access_token
Full name
docker.docker_patch_v2_orgs_by_org_name_access_tokens_by_access_token_id
ParameterTypeRequiredDescription
No parameters.
delete_access_token Write

Delete a specific access token for an organization. This action cannot be undone.

Lua path
app.integrations.docker.delete_access_token
Full name
docker.docker_delete_v2_orgs_by_org_name_access_tokens_by_access_token_id
ParameterTypeRequiredDescription
No parameters.
list_repository_tags Read

List repository tags (GET /v2/namespaces/{namespace}/repositories/{repository}/tags).

Lua path
app.integrations.docker.list_repository_tags
Full name
docker.docker_list_tags
ParameterTypeRequiredDescription
No parameters.
read_repository_tag Read

Read repository tag (GET /v2/namespaces/{namespace}/repositories/{repository}/tags/{tag}).

Lua path
app.integrations.docker.read_repository_tag
Full name
docker.docker_get_tag
ParameterTypeRequiredDescription
No parameters.
update_repository_immutable_tags Write

Updates the immutable tags configuration for this repository. **Only users with administrative privileges for the repository can modify these settings.**

Lua path
app.integrations.docker.update_repository_immutable_tags
Full name
docker.docker_update_repository_immutable_tags
ParameterTypeRequiredDescription
No parameters.
verify_repository_immutable_tags Write

Validates the immutable tags regex pass in parameter and returns a list of tags matching it in this repository. **Only users with administrative privileges for the repository call this endpoint.**

Lua path
app.integrations.docker.verify_repository_immutable_tags
Full name
docker.docker_verify_repository_immutable_tags
ParameterTypeRequiredDescription
No parameters.
assign_group_team_repository_access Write

Assign a group (Team) to a repository for access (POST /v2/repositories/{namespace}/{repository}/groups).

Lua path
app.integrations.docker.assign_group_team_repository_access
Full name
docker.docker_create_repository_group
ParameterTypeRequiredDescription
No parameters.
list_repositories_namespace Read

Returns a list of repositories within the specified namespace (organization or user). Public repositories are accessible to everyone, while private repositories require appropriate authentication and permissions.

Lua path
app.integrations.docker.list_repositories_namespace
Full name
docker.docker_list_repositories
ParameterTypeRequiredDescription
No parameters.
create_new_repository Write

Creates a new repository within the specified namespace. The repository will be created with the provided metadata including name, description, and privacy settings.

Lua path
app.integrations.docker.create_new_repository
Full name
docker.docker_create_repository
ParameterTypeRequiredDescription
No parameters.
get_repository_namespace Read

Returns a repository within the specified namespace (organization or user). Public repositories are accessible to everyone, while private repositories require appropriate authentication and permissions.

Lua path
app.integrations.docker.get_repository_namespace
Full name
docker.docker_get_repository
ParameterTypeRequiredDescription
No parameters.
list_org_members Read

Returns a list of members for an organization. _The following fields are only visible to orgs with insights enabled._ - `last_logged_in_at` - `last_seen_at` - `last_desktop_version` To make visible, please see [View Insights for organization users](https://docs.docker.com/admin/insights/#view-insights-for-organization-users). <span class="oat"></span>

Lua path
app.integrations.docker.list_org_members
Full name
docker.docker_get_v2_orgs_by_org_name_members
ParameterTypeRequiredDescription
No parameters.
export_org_members_csv Read

Export members of an organization as a CSV <span class="oat"></span>

Lua path
app.integrations.docker.export_org_members_csv
Full name
docker.docker_get_v2_orgs_by_org_name_members_export
ParameterTypeRequiredDescription
No parameters.
update_org_member_role Write

Updates the role of a member in the organization. ***Only users in the "owners" group of the organization can use this endpoint.*** <span class="oat"></span>

Lua path
app.integrations.docker.update_org_member_role
Full name
docker.docker_put_v2_orgs_by_org_name_members_by_username
ParameterTypeRequiredDescription
No parameters.
remove_member_from_org Write

Removes the member from the org, ie. all groups in the org, unless they're the last owner <span class="oat"></span>

Lua path
app.integrations.docker.remove_member_from_org
Full name
docker.docker_delete_v2_orgs_by_org_name_members_by_username
ParameterTypeRequiredDescription
No parameters.
list_org_invites Read

Return all pending invites for a given org, only team owners can call this endpoint <span class="oat"></span>

Lua path
app.integrations.docker.list_org_invites
Full name
docker.docker_get_v2_orgs_by_org_name_invites
ParameterTypeRequiredDescription
No parameters.
get_groups_organization Read

<span class="oat"></span>

Lua path
app.integrations.docker.get_groups_organization
Full name
docker.docker_get_v2_orgs_by_org_name_groups
ParameterTypeRequiredDescription
No parameters.
create_new_group Write

Create a new group within an organization. <span class="oat"></span>

Lua path
app.integrations.docker.create_new_group
Full name
docker.docker_post_v2_orgs_by_org_name_groups
ParameterTypeRequiredDescription
No parameters.
get_group_organization Read

<span class="oat"></span>

Lua path
app.integrations.docker.get_group_organization
Full name
docker.docker_get_v2_orgs_by_org_name_groups_by_group_name
ParameterTypeRequiredDescription
No parameters.
update_details_organization_group Write

<span class="oat"></span>

Lua path
app.integrations.docker.update_details_organization_group
Full name
docker.docker_put_v2_orgs_by_org_name_groups_by_group_name
ParameterTypeRequiredDescription
No parameters.
update_some_details_organization_group Write

<span class="oat"></span>

Lua path
app.integrations.docker.update_some_details_organization_group
Full name
docker.docker_patch_v2_orgs_by_org_name_groups_by_group_name
ParameterTypeRequiredDescription
No parameters.
delete_organization_group Write

<span class="oat"></span>

Lua path
app.integrations.docker.delete_organization_group
Full name
docker.docker_delete_v2_orgs_by_org_name_groups_by_group_name
ParameterTypeRequiredDescription
No parameters.
list_members_group Read

List the members (users) that are in a group. If user is owner of the org or has otherwise elevated permissions, they can search by email and the result will also contain emails. <span class="oat"></span>

Lua path
app.integrations.docker.list_members_group
Full name
docker.docker_get_v2_orgs_by_org_name_groups_by_group_name_members
ParameterTypeRequiredDescription
No parameters.
add_member_group Write

<span class="oat"></span>

Lua path
app.integrations.docker.add_member_group
Full name
docker.docker_post_v2_orgs_by_org_name_groups_by_group_name_members
ParameterTypeRequiredDescription
No parameters.
remove_user_from_group Write

<span class="oat"></span>

Lua path
app.integrations.docker.remove_user_from_group
Full name
docker.docker_delete_v2_orgs_by_org_name_groups_by_group_name_members_by_username
ParameterTypeRequiredDescription
No parameters.
cancel_invite Write

Mark the invite as cancelled so it doesn't show up on the list of pending invites <span class="oat"></span>

Lua path
app.integrations.docker.cancel_invite
Full name
docker.docker_delete_v2_invites_by_id
ParameterTypeRequiredDescription
No parameters.
resend_invite Write

Resend a pending invite to the user, any org owner can resend an invite <span class="oat"></span>

Lua path
app.integrations.docker.resend_invite
Full name
docker.docker_patch_v2_invites_by_id_resend
ParameterTypeRequiredDescription
No parameters.
bulk_create_invites Write

Create multiple invites by emails or DockerIDs. Only a team owner can create invites. <span class="oat"></span>

Lua path
app.integrations.docker.bulk_create_invites
Full name
docker.docker_post_v2_invites_bulk
ParameterTypeRequiredDescription
No parameters.
get_service_provider_config Read

Returns a service provider config for Docker's configuration.

Lua path
app.integrations.docker.get_service_provider_config
Full name
docker.docker_get_v2_scim_2_0_service_provider_config
ParameterTypeRequiredDescription
No parameters.
list_resource_types Read

Returns all resource types supported for the SCIM configuration.

Lua path
app.integrations.docker.list_resource_types
Full name
docker.docker_get_v2_scim_2_0_resource_types
ParameterTypeRequiredDescription
No parameters.
get_resource_type Read

Returns a resource type by name.

Lua path
app.integrations.docker.get_resource_type
Full name
docker.docker_get_v2_scim_2_0_resource_types_by_name
ParameterTypeRequiredDescription
No parameters.
list_schemas Read

Returns all schemas supported for the SCIM configuration.

Lua path
app.integrations.docker.list_schemas
Full name
docker.docker_get_v2_scim_2_0_schemas
ParameterTypeRequiredDescription
No parameters.
get_schema Read

Returns a schema by ID.

Lua path
app.integrations.docker.get_schema
Full name
docker.docker_get_v2_scim_2_0_schemas_by_id
ParameterTypeRequiredDescription
No parameters.
list_users Read

Returns paginated users for an organization. Use `startIndex` and `count` query parameters to receive paginated results. **Sorting:** Sorting allows you to specify the order in which resources are returned by specifying a combination of `sortBy` and `sortOrder` query parameters. The `sortBy` parameter specifies the attribute whose value will be used to order the returned responses. The `sortOrder` parameter defines the order in which the `sortBy` parameter is applied. Allowed values are "ascending" and "descending". **Filtering:** You can request a subset of resources by specifying the `filter` query parameter containing a filter expression. Attribute names and attribute operators used in filters are case insensitive. The filter parameter must contain at least one valid expression. Each expression must contain an attribute name followed by an attribute operator and an optional value. Supported operators are listed below. - `eq` equal - `ne` not equal - `co` contains - `sw` starts with - `and` Logical "and" - `or` Logical "or" - `not` "Not" function - `()` Precedence grouping

Lua path
app.integrations.docker.list_users
Full name
docker.docker_get_v2_scim_2_0_users
ParameterTypeRequiredDescription
No parameters.
create_user Write

Creates a user. If the user already exists by email, they are assigned to the organization on the "company" team.

Lua path
app.integrations.docker.create_user
Full name
docker.docker_post_v2_scim_2_0_users
ParameterTypeRequiredDescription
No parameters.
get_user Read

Returns a user by ID.

Lua path
app.integrations.docker.get_user
Full name
docker.docker_get_v2_scim_2_0_users_by_id
ParameterTypeRequiredDescription
No parameters.
update_user Write

Updates a user. This route is used to change the user's name, activate, and deactivate the user.

Lua path
app.integrations.docker.update_user
Full name
docker.docker_put_v2_scim_2_0_users_by_id
ParameterTypeRequiredDescription
No parameters.