Use the Contentful CLI from KosmoKrator to call Contentful tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
Contentful can be configured headlessly with `kosmokrator integrations:configure contentful`.
# Install KosmoKrator first if it is not available on PATH.curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash# Configure and verify this integration.kosmokrator integrations:configure contentful --set access_token="$CONTENTFUL_ACCESS_TOKEN" --set space_id="$CONTENTFUL_SPACE_ID" --enable --read allow --write ask --jsonkosmokrator integrations:doctor contentful --jsonkosmokrator integrations:status --json
Credentials
Authentication type: Bearer tokenbearer_token. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
access_token
CONTENTFUL_ACCESS_TOKEN
Secret secret
yes
Access Token
space_id
CONTENTFUL_SPACE_ID
Text text
yes
Space ID
Call Contentful Headlessly
Use the generic call form when another coding CLI or script needs a stable universal interface.
Every function below can be called headlessly. The generic form is stable across all integrations;
the provider shortcut is shorter but specific to Contentful.
contentful.contentful_list_content_types
Read read
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.
Get detailed information about a specific content type by its ID.
Returns the content type name, description, display field, and full field definitions.
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.
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.
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.
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.
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.
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.
List assets (images, files, videos) in the Contentful space.
Supports pagination with limit and skip parameters.
Returns asset IDs, titles, file details, and URLs.
Use these parameter tables when building CLI payloads without calling integrations:schema first.
contentful.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.
Maximum number of content types to return (default 100).
contentful.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.
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.
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.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.
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.
JSON object of localized field values. E.g. {"title": {"en-US": "Hello"}, "body": {"en-US": "World"}}.
contentful.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.
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.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.
Current version of the entry (required for optimistic locking).
contentful.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.
List assets (images, files, videos) in the Contentful space.
Supports pagination with limit and skip parameters.
Returns asset IDs, titles, file details, and URLs.
Headless calls still follow the integration read/write permission policy. Configure read/write defaults
with integrations:configure. Add --force only for trusted automation that should bypass that policy.