KosmoKrator

cms

Contentful Lua API for KosmoKrator Agents

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

12 functions 6 read 6 write Bearer token auth

Lua Namespace

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

Client for the Contentful Content Management API covering content types, entries, assets, and space info — Lua API Reference

contentful_create_content_type

No description.

Parameters

NameTypeRequiredDescription
namestringyesInternal name of the content type (e.g.
display_namestringyesHuman-readable display name (e.g.
descriptionstringnoDescription of the content type.
fieldsstringyesJSON array of field definitions. Each field needs id, name, and type. Example: [{

Example

local result = app.integrations.contentful.contentful_create_content_type({
  name = ""
  display_name = ""
  description = ""
})

contentful_create_entry

No description.

Parameters

NameTypeRequiredDescription
content_type_idstringyesThe content type ID for the new entry.
fieldsstringyesJSON object of localized field values. E.g. {

Example

local result = app.integrations.contentful.contentful_create_entry({
  content_type_id = ""
  fields = ""
})

contentful_delete_entry

No description.

Parameters

NameTypeRequiredDescription
entry_idstringyesThe ID of the entry to delete.

Example

local result = app.integrations.contentful.contentful_delete_entry({
  entry_id = ""
})

contentful_get_content_type

No description.

Parameters

NameTypeRequiredDescription
content_type_idstringyesThe ID of the content type to retrieve.

Example

local result = app.integrations.contentful.contentful_get_content_type({
  content_type_id = ""
})

contentful_get_entry

No description.

Parameters

NameTypeRequiredDescription
entry_idstringyesThe ID of the entry to retrieve.

Example

local result = app.integrations.contentful.contentful_get_entry({
  entry_id = ""
})

contentful_get_space

No description.

Example

local result = app.integrations.contentful.contentful_get_space({
})

contentful_list_assets

No description.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of assets to return (default 100).
skipintegernoNumber of assets to skip for pagination.

Example

local result = app.integrations.contentful.contentful_list_assets({
  limit = 0
  skip = 0
})

contentful_list_content_types

No description.

Parameters

NameTypeRequiredDescription
limitintegernoMaximum number of content types to return (default 100).

Example

local result = app.integrations.contentful.contentful_list_content_types({
  limit = 0
})

contentful_list_entries

No description.

Parameters

NameTypeRequiredDescription
content_typestringnoFilter entries by content type ID.
limitintegernoMaximum number of entries to return (default 100, max 1000).
skipintegernoNumber of entries to skip for pagination.
orderstringnoOrder entries by field. Prefix with
querystringnoFull-text search query to filter entries.

Example

local result = app.integrations.contentful.contentful_list_entries({
  content_type = ""
  limit = 0
  skip = 0
})

contentful_publish_entry

No description.

Parameters

NameTypeRequiredDescription
entry_idstringyesThe ID of the entry to publish.
versionintegeryesCurrent version of the entry (required for optimistic locking).

Example

local result = app.integrations.contentful.contentful_publish_entry({
  entry_id = ""
  version = 0
})

contentful_unpublish_entry

No description.

Parameters

NameTypeRequiredDescription
entry_idstringyesThe ID of the entry to unpublish.
versionintegeryesCurrent version of the entry (required for optimistic locking).

Example

local result = app.integrations.contentful.contentful_unpublish_entry({
  entry_id = ""
  version = 0
})

contentful_update_entry

No description.

Parameters

NameTypeRequiredDescription
entry_idstringyesThe ID of the entry to update.
fieldsstringyesJSON object of localized field values to update. E.g. {
versionintegeryesCurrent version of the entry (required for optimistic locking). Get this from the entry\

Example

local result = app.integrations.contentful.contentful_update_entry({
  entry_id = ""
  fields = ""
  version = 0
})

Multi-Account Usage

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

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

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

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

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

Raw agent markdown
# Client for the Contentful Content Management API covering content types, entries, assets, and space info — Lua API Reference

## contentful_create_content_type

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | Internal name of the content type (e.g.  |
| `display_name` | string | yes | Human-readable display name (e.g.  |
| `description` | string | no | Description of the content type. |
| `fields` | string | yes | JSON array of field definitions. Each field needs id, name, and type. Example: [{ |

### Example

```lua
local result = app.integrations.contentful.contentful_create_content_type({
  name = ""
  display_name = ""
  description = ""
})
```

## contentful_create_entry

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `content_type_id` | string | yes | The content type ID for the new entry. |
| `fields` | string | yes | JSON object of localized field values. E.g. { |

### Example

```lua
local result = app.integrations.contentful.contentful_create_entry({
  content_type_id = ""
  fields = ""
})
```

## contentful_delete_entry

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `entry_id` | string | yes | The ID of the entry to delete. |

### Example

```lua
local result = app.integrations.contentful.contentful_delete_entry({
  entry_id = ""
})
```

## contentful_get_content_type

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `content_type_id` | string | yes | The ID of the content type to retrieve. |

### Example

```lua
local result = app.integrations.contentful.contentful_get_content_type({
  content_type_id = ""
})
```

## contentful_get_entry

No description.

### Parameters

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

### Example

```lua
local result = app.integrations.contentful.contentful_get_entry({
  entry_id = ""
})
```

## contentful_get_space

No description.

### Example

```lua
local result = app.integrations.contentful.contentful_get_space({
})
```

## contentful_list_assets

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of assets to return (default 100). |
| `skip` | integer | no | Number of assets to skip for pagination. |

### Example

```lua
local result = app.integrations.contentful.contentful_list_assets({
  limit = 0
  skip = 0
})
```

## contentful_list_content_types

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `limit` | integer | no | Maximum number of content types to return (default 100). |

### Example

```lua
local result = app.integrations.contentful.contentful_list_content_types({
  limit = 0
})
```

## contentful_list_entries

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `content_type` | string | no | Filter entries by content type ID. |
| `limit` | integer | no | Maximum number of entries to return (default 100, max 1000). |
| `skip` | integer | no | Number of entries to skip for pagination. |
| `order` | string | no | Order entries by field. Prefix with  |
| `query` | string | no | Full-text search query to filter entries. |

### Example

```lua
local result = app.integrations.contentful.contentful_list_entries({
  content_type = ""
  limit = 0
  skip = 0
})
```

## contentful_publish_entry

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `entry_id` | string | yes | The ID of the entry to publish. |
| `version` | integer | yes | Current version of the entry (required for optimistic locking). |

### Example

```lua
local result = app.integrations.contentful.contentful_publish_entry({
  entry_id = ""
  version = 0
})
```

## contentful_unpublish_entry

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `entry_id` | string | yes | The ID of the entry to unpublish. |
| `version` | integer | yes | Current version of the entry (required for optimistic locking). |

### Example

```lua
local result = app.integrations.contentful.contentful_unpublish_entry({
  entry_id = ""
  version = 0
})
```

## contentful_update_entry

No description.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `entry_id` | string | yes | The ID of the entry to update. |
| `fields` | string | yes | JSON object of localized field values to update. E.g. { |
| `version` | integer | yes | Current version of the entry (required for optimistic locking). Get this from the entry\ |

### Example

```lua
local result = app.integrations.contentful.contentful_update_entry({
  entry_id = ""
  fields = ""
  version = 0
})
```

---

## Multi-Account Usage

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

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

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

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

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

Metadata-Derived Lua Example

local result = app.integrations.contentful.contentful_list_content_types({
  limit = 1
})
print(result)

Functions

contentful_list_content_types

List all content types defined in the connected Contentful space. Returns each content type's ID, name, description, and field count. Optionally limit the number of results.

Operation
Read read
Full name
contentful.contentful_list_content_types
ParameterTypeRequiredDescription
limit integer no Maximum number of content types to return (default 100).

contentful_get_content_type

Get detailed information about a specific content type by its ID. Returns the content type name, description, display field, and full field definitions.

Operation
Read read
Full name
contentful.contentful_get_content_type
ParameterTypeRequiredDescription
content_type_id string yes The ID of the content type to retrieve.

contentful_create_content_type

Create a new content type in Contentful with a name, display name, optional description, and field definitions. Fields are provided as a JSON array of objects with id, name, and type. Common field types: Symbol, Text, Integer, Number, Boolean, Date, Location, RichText, Array, Link.

Operation
Write write
Full name
contentful.contentful_create_content_type
ParameterTypeRequiredDescription
name string yes Internal name of the content type (e.g. "blogPost").
display_name string yes Human-readable display name (e.g. "Blog Post").
description string no Description of the content type.
fields string yes JSON array of field definitions. Each field needs id, name, and type. Example: [{"id":"title","name":"Title","type":"Symbol"}].

contentful_list_entries

List entries in the Contentful space. Optionally filter by content type, control pagination with limit and skip, order results, or search with a text query. Returns entry IDs, content types, and localized field values.

Operation
Read read
Full name
contentful.contentful_list_entries
ParameterTypeRequiredDescription
content_type string no Filter entries by content type ID.
limit integer no Maximum number of entries to return (default 100, max 1000).
skip integer no Number of entries to skip for pagination.
order string no Order entries by field. Prefix with "-" for descending. E.g. "sys.createdAt" or "-sys.updatedAt".
query string no Full-text search query to filter entries.

contentful_get_entry

Get detailed information about a specific entry by its ID. Returns all localized field values, content type, version, and timestamps.

Operation
Read read
Full name
contentful.contentful_get_entry
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to retrieve.

contentful_create_entry

Create a new entry in Contentful. Specify the content type ID and provide field values as a JSON object. Fields must be localized, e.g. {"title": {"en-US": "My Title"}}. The entry is created as a draft; use the publish tool to publish it.

Operation
Write write
Full name
contentful.contentful_create_entry
ParameterTypeRequiredDescription
content_type_id string yes The content type ID for the new entry.
fields string yes JSON object of localized field values. E.g. {"title": {"en-US": "Hello"}, "body": {"en-US": "World"}}.

contentful_update_entry

Update an existing entry's field values. Requires the current version number for optimistic locking. Fields must be localized, e.g. {"title": {"en-US": "Updated Title"}}. The version is sent as the X-Contentful-Version header.

Operation
Write write
Full name
contentful.contentful_update_entry
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to update.
fields string yes JSON object of localized field values to update. E.g. {"title": {"en-US": "New Title"}}.
version integer yes Current version of the entry (required for optimistic locking). Get this from the entry's sys.version.

contentful_publish_entry

Publish a draft or updated entry. Requires the current version number for optimistic locking, sent as the X-Contentful-Version header. After publishing, the entry becomes publicly visible via the Content Delivery API.

Operation
Write write
Full name
contentful.contentful_publish_entry
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to publish.
version integer yes Current version of the entry (required for optimistic locking).

contentful_unpublish_entry

Unpublish a published entry, reverting it to draft status. Requires the current version number for optimistic locking, sent as the X-Contentful-Version header. The entry will no longer be visible via the Content Delivery API.

Operation
Write write
Full name
contentful.contentful_unpublish_entry
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to unpublish.
version integer yes Current version of the entry (required for optimistic locking).

contentful_delete_entry

Permanently delete an entry from the Contentful space. The entry must be unpublished before it can be deleted. This action is irreversible.

Operation
Write write
Full name
contentful.contentful_delete_entry
ParameterTypeRequiredDescription
entry_id string yes The ID of the entry to delete.

contentful_list_assets

List assets (images, files, videos) in the Contentful space. Supports pagination with limit and skip parameters. Returns asset IDs, titles, file details, and URLs.

Operation
Read read
Full name
contentful.contentful_list_assets
ParameterTypeRequiredDescription
limit integer no Maximum number of assets to return (default 100).
skip integer no Number of assets to skip for pagination.

contentful_get_space

Get details about the connected Contentful space, including name, locales, organization, and space type.

Operation
Read read
Full name
contentful.contentful_get_space
ParameterTypeRequiredDescription
No parameters.