KosmoKrator

productivity

Phrase Lua API for KosmoKrator Agents

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

Lua Namespace

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

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.phrase.list_projects({page = 1, per_page = 1}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("phrase"))' --json
kosmo integrations:lua --eval 'print(docs.read("phrase.list_projects"))' --json

Workflow file

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

workflow.lua
local phrase = app.integrations.phrase
local result = phrase.list_projects({page = 1, per_page = 1})

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

MCP-only Lua

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

Client for the Phrase localization platform — Lua API Reference

phrase_list_projects

List all Phrase projects the authenticated user has access to.

Parameters

NameTypeRequiredDescription
pageintegernoPage number (default 1).
per_pageintegernoNumber of projects per page (default 25, max 100).

Example

local result = app.integrations.phrase.phrase_list_projects({
  page = 1
  per_page = 25
})

phrase_get_project

Get details of a single Phrase project including name, slug, main format, and metadata.

Parameters

NameTypeRequiredDescription
project_idstringyesThe ID of the project to retrieve.

Example

local result = app.integrations.phrase.phrase_get_project({
  project_id = ""
})

phrase_list_keys

List translation keys in a Phrase project. Optionally filter by name and control pagination.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID.
pageintegernoPage number (default 1).
per_pageintegernoNumber of keys per page (default 25, max 100).
qstringnoSearch query to filter keys by name.

Example

local result = app.integrations.phrase.phrase_list_keys({
  project_id = ""
  page = 1
  per_page = 25
  q = ""
})

phrase_get_key

Get a single translation key by ID, including name, description, tags, and plural settings.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID.
key_idstringyesThe key ID.

Example

local result = app.integrations.phrase.phrase_get_key({
  project_id = ""
  key_id = ""
})

phrase_list_translations

List translations in a Phrase project. Optionally filter by key or locale.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID.
pageintegernoPage number (default 1).
per_pageintegernoNumber of translations per page (default 25, max 100).
key_idstringnoFilter translations by key ID.
locale_idstringnoFilter translations by locale ID.
qstringnoSearch query to filter translations.

Example

local result = app.integrations.phrase.phrase_list_translations({
  project_id = ""
  page = 1
  per_page = 25
  key_id = ""
  locale_id = ""
  q = ""
})

phrase_list_locales

List locales in a Phrase project. Returns locale IDs, codes, names, and default status.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID.
pageintegernoPage number (default 1).
per_pageintegernoNumber of locales per page (default 25, max 100).

Example

local result = app.integrations.phrase.phrase_list_locales({
  project_id = ""
  page = 1
  per_page = 25
})

phrase_get_current_user

Get the current authenticated Phrase user’s profile, including username, name, and email.

Example

local result = app.integrations.phrase.phrase_get_current_user({
})

Multi-Account Usage

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

-- Default account (always works)
app.integrations.phrase.function_name({...})

-- Explicit default (portable across setups)
app.integrations.phrase.default.function_name({...})

-- Named accounts
app.integrations.phrase.work.function_name({...})
app.integrations.phrase.personal.function_name({...})

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

Raw agent markdown
# Client for the Phrase localization platform — Lua API Reference

## phrase_list_projects

List all Phrase projects the authenticated user has access to.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | integer | no | Page number (default 1). |
| `per_page` | integer | no | Number of projects per page (default 25, max 100). |

### Example

```lua
local result = app.integrations.phrase.phrase_list_projects({
  page = 1
  per_page = 25
})
```

## phrase_get_project

Get details of a single Phrase project including name, slug, main format, and metadata.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The ID of the project to retrieve. |

### Example

```lua
local result = app.integrations.phrase.phrase_get_project({
  project_id = ""
})
```

## phrase_list_keys

List translation keys in a Phrase project. Optionally filter by name and control pagination.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID. |
| `page` | integer | no | Page number (default 1). |
| `per_page` | integer | no | Number of keys per page (default 25, max 100). |
| `q` | string | no | Search query to filter keys by name. |

### Example

```lua
local result = app.integrations.phrase.phrase_list_keys({
  project_id = ""
  page = 1
  per_page = 25
  q = ""
})
```

## phrase_get_key

Get a single translation key by ID, including name, description, tags, and plural settings.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID. |
| `key_id` | string | yes | The key ID. |

### Example

```lua
local result = app.integrations.phrase.phrase_get_key({
  project_id = ""
  key_id = ""
})
```

## phrase_list_translations

List translations in a Phrase project. Optionally filter by key or locale.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID. |
| `page` | integer | no | Page number (default 1). |
| `per_page` | integer | no | Number of translations per page (default 25, max 100). |
| `key_id` | string | no | Filter translations by key ID. |
| `locale_id` | string | no | Filter translations by locale ID. |
| `q` | string | no | Search query to filter translations. |

### Example

```lua
local result = app.integrations.phrase.phrase_list_translations({
  project_id = ""
  page = 1
  per_page = 25
  key_id = ""
  locale_id = ""
  q = ""
})
```

## phrase_list_locales

List locales in a Phrase project. Returns locale IDs, codes, names, and default status.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID. |
| `page` | integer | no | Page number (default 1). |
| `per_page` | integer | no | Number of locales per page (default 25, max 100). |

### Example

```lua
local result = app.integrations.phrase.phrase_list_locales({
  project_id = ""
  page = 1
  per_page = 25
})
```

## phrase_get_current_user

Get the current authenticated Phrase user's profile, including username, name, and email.

### Example

```lua
local result = app.integrations.phrase.phrase_get_current_user({
})
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.phrase.function_name({...})

-- Explicit default (portable across setups)
app.integrations.phrase.default.function_name({...})

-- Named accounts
app.integrations.phrase.work.function_name({...})
app.integrations.phrase.personal.function_name({...})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.phrase.list_projects({page = 1, per_page = 1})
print(result)

Functions

list_projects Read

List all Phrase projects the authenticated user has access to. Returns project IDs, names, main formats, and locale counts.

Lua path
app.integrations.phrase.list_projects
Full name
phrase.phrase_list_projects
ParameterTypeRequiredDescription
page integer no Page number (default 1).
per_page integer no Number of projects per page (default 25, max 100).
get_project Read

Get details of a single Phrase project including name, slug, main format, default locale, and shares.

Lua path
app.integrations.phrase.get_project
Full name
phrase.phrase_get_project
ParameterTypeRequiredDescription
project_id string yes The ID of the project to retrieve.
list_keys Read

List translation keys in a Phrase project. Optionally filter by name using the query parameter, and control pagination with page and per_page. Returns key IDs, names, and creation dates.

Lua path
app.integrations.phrase.list_keys
Full name
phrase.phrase_list_keys
ParameterTypeRequiredDescription
project_id string yes The project ID.
page integer no Page number (default 1).
per_page integer no Number of keys per page (default 25, max 100).
q string no Search query to filter keys by name.
get_key Read

Get a single translation key by ID, including its name, description, tags, and plural settings.

Lua path
app.integrations.phrase.get_key
Full name
phrase.phrase_get_key
ParameterTypeRequiredDescription
project_id string yes The project ID.
key_id string yes The key ID.
list_translations Read

List translations in a Phrase project. Optionally filter by key ID or locale ID, and control pagination with page and per_page. Returns translation content, key names, and locale codes.

Lua path
app.integrations.phrase.list_translations
Full name
phrase.phrase_list_translations
ParameterTypeRequiredDescription
project_id string yes The project ID.
page integer no Page number (default 1).
per_page integer no Number of translations per page (default 25, max 100).
key_id string no Filter translations by key ID.
locale_id string no Filter translations by locale ID.
q string no Search query to filter translations.
list_locales Read

List locales in a Phrase project. Returns locale IDs, codes, names, and default status.

Lua path
app.integrations.phrase.list_locales
Full name
phrase.phrase_list_locales
ParameterTypeRequiredDescription
project_id string yes The project ID.
page integer no Page number (default 1).
per_page integer no Number of locales per page (default 25, max 100).
get_current_user Read

Get the current authenticated Phrase user's profile, including username, name, email, and account details.

Lua path
app.integrations.phrase.get_current_user
Full name
phrase.phrase_get_current_user
ParameterTypeRequiredDescription
No parameters.