KosmoKrator

productivity

Klaviyo CLI for AI Agents

Use the Klaviyo CLI from KosmoKrator to call Klaviyo tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Klaviyo CLI Setup

Klaviyo can be configured headlessly with `kosmokrator integrations:configure klaviyo`.

Install, configure, and verify
# 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 klaviyo --enable --read allow --write ask --json
kosmokrator integrations:doctor klaviyo --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

No credentials are required.

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call klaviyo.klaviyo_create_profile '{"email":"example_email","phone_number":"example_phone_number","first_name":"example_first_name","last_name":"example_last_name","properties":"example_properties"}' --json
Provider shortcut
kosmo integrations:klaviyo klaviyo_create_profile '{"email":"example_email","phone_number":"example_phone_number","first_name":"example_first_name","last_name":"example_last_name","properties":"example_properties"}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs klaviyo --json
kosmo integrations:docs klaviyo.klaviyo_create_profile --json
kosmo integrations:schema klaviyo.klaviyo_create_profile --json
kosmo integrations:search "Klaviyo" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

klaviyo.klaviyo_create_profile

Create a new profile in Klaviyo. Provide at least an email address or phone number. Optionally set first name, last name, and custom properties. Returns the newly created profile with its Klaviyo ID.

Write write
Parameters
email, phone_number, first_name, last_name, properties
Generic call
kosmo integrations:call klaviyo.klaviyo_create_profile '{"email":"example_email","phone_number":"example_phone_number","first_name":"example_first_name","last_name":"example_last_name","properties":"example_properties"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_create_profile '{"email":"example_email","phone_number":"example_phone_number","first_name":"example_first_name","last_name":"example_last_name","properties":"example_properties"}' --json

klaviyo.klaviyo_get_profile

Retrieve a single Klaviyo profile by its ID. Returns the full profile including email, phone number, name, and custom properties.

Read read
Parameters
profile_id
Generic call
kosmo integrations:call klaviyo.klaviyo_get_profile '{"profile_id":"example_profile_id"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_get_profile '{"profile_id":"example_profile_id"}' --json

klaviyo.klaviyo_update_profile

Update an existing Klaviyo profile by ID. Provide only the fields you want to change — omitted fields are left untouched. Supports updating email, phone number, first name, last name, and custom properties.

Write write
Parameters
profile_id, email, phone_number, first_name, last_name, properties
Generic call
kosmo integrations:call klaviyo.klaviyo_update_profile '{"profile_id":"example_profile_id","email":"example_email","phone_number":"example_phone_number","first_name":"example_first_name","last_name":"example_last_name","properties":"example_properties"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_update_profile '{"profile_id":"example_profile_id","email":"example_email","phone_number":"example_phone_number","first_name":"example_first_name","last_name":"example_last_name","properties":"example_properties"}' --json

klaviyo.klaviyo_list_profiles

List profiles in Klaviyo with cursor-based pagination. Returns each profile's ID, email, phone number, name, and custom properties. Use the page_cursor from a previous response to fetch the next page of results.

Read read
Parameters
limit, page_cursor
Generic call
kosmo integrations:call klaviyo.klaviyo_list_profiles '{"limit":1,"page_cursor":"example_page_cursor"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_list_profiles '{"limit":1,"page_cursor":"example_page_cursor"}' --json

klaviyo.klaviyo_subscribe_profile

Subscribe a profile to a Klaviyo list using their email address. Requires a valid list ID and the subscriber's email. Optionally provide a phone number and an ISO 8601 consented_at timestamp.

Write write
Parameters
list_id, email, phone_number, consented_at
Generic call
kosmo integrations:call klaviyo.klaviyo_subscribe_profile '{"list_id":"example_list_id","email":"example_email","phone_number":"example_phone_number","consented_at":"example_consented_at"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_subscribe_profile '{"list_id":"example_list_id","email":"example_email","phone_number":"example_phone_number","consented_at":"example_consented_at"}' --json

klaviyo.klaviyo_create_event

Track a new event for an existing Klaviyo profile. Provide the profile ID, event name, and optional properties, numeric value, and timestamp. Events are used to trigger flows and segment profiles based on behaviour.

Write write
Parameters
profile_id, event_name, properties, value, time
Generic call
kosmo integrations:call klaviyo.klaviyo_create_event '{"profile_id":"example_profile_id","event_name":"example_event_name","properties":"example_properties","value":1,"time":"example_time"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_create_event '{"profile_id":"example_profile_id","event_name":"example_event_name","properties":"example_properties","value":1,"time":"example_time"}' --json

klaviyo.klaviyo_get_event

Retrieve a single Klaviyo event by its ID. Returns the event with its metric name, properties, value, timestamp, and associated profile.

Read read
Parameters
event_id
Generic call
kosmo integrations:call klaviyo.klaviyo_get_event '{"event_id":"example_event_id"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_get_event '{"event_id":"example_event_id"}' --json

klaviyo.klaviyo_list_events

List events in Klaviyo with optional filtering and cursor-based pagination. Supports Klaviyo filter expressions (e.g. "greater-than(timestamp,2024-01-01)") to narrow results. Use page_cursor to paginate through large result sets.

Read read
Parameters
filter, limit, page_cursor
Generic call
kosmo integrations:call klaviyo.klaviyo_list_events '{"filter":"example_filter","limit":1,"page_cursor":"example_page_cursor"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_list_events '{"filter":"example_filter","limit":1,"page_cursor":"example_page_cursor"}' --json

klaviyo.klaviyo_list_lists

List all lists in the connected Klaviyo account. Returns each list's ID, name, and other metadata. Use cursor-based pagination to iterate through large numbers of lists.

Read read
Parameters
limit, page_cursor
Generic call
kosmo integrations:call klaviyo.klaviyo_list_lists '{"limit":1,"page_cursor":"example_page_cursor"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_list_lists '{"limit":1,"page_cursor":"example_page_cursor"}' --json

klaviyo.klaviyo_create_list

Create a new list in Klaviyo. Provide a name for the list. Returns the newly created list with its ID.

Write write
Parameters
name
Generic call
kosmo integrations:call klaviyo.klaviyo_create_list '{"name":"example_name"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_create_list '{"name":"example_name"}' --json

klaviyo.klaviyo_get_list

Retrieve a single Klaviyo list by its ID. Returns the list's name, member count, and other metadata.

Read read
Parameters
list_id
Generic call
kosmo integrations:call klaviyo.klaviyo_get_list '{"list_id":"example_list_id"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_get_list '{"list_id":"example_list_id"}' --json

klaviyo.klaviyo_list_list_profiles

List profiles that belong to a specific Klaviyo list. Returns each profile's ID, email, phone number, name, and custom properties. Use cursor-based pagination to iterate through large lists.

Read read
Parameters
list_id, limit, page_cursor
Generic call
kosmo integrations:call klaviyo.klaviyo_list_list_profiles '{"list_id":"example_list_id","limit":1,"page_cursor":"example_page_cursor"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_list_list_profiles '{"list_id":"example_list_id","limit":1,"page_cursor":"example_page_cursor"}' --json

klaviyo.klaviyo_list_flows

List all flows in the connected Klaviyo account. Returns each flow's ID, name, status, and other metadata. Use cursor-based pagination to iterate through large numbers of flows.

Read read
Parameters
limit, page_cursor
Generic call
kosmo integrations:call klaviyo.klaviyo_list_flows '{"limit":1,"page_cursor":"example_page_cursor"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_list_flows '{"limit":1,"page_cursor":"example_page_cursor"}' --json

klaviyo.klaviyo_get_flow

Retrieve a single Klaviyo flow by its ID. Returns the flow's name, status, trigger type, and other metadata.

Read read
Parameters
flow_id
Generic call
kosmo integrations:call klaviyo.klaviyo_get_flow '{"flow_id":"example_flow_id"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_get_flow '{"flow_id":"example_flow_id"}' --json

klaviyo.klaviyo_list_campaigns

List all campaigns in the connected Klaviyo account. Returns each campaign's ID, name, status, and other metadata. Use cursor-based pagination to iterate through large numbers of campaigns.

Read read
Parameters
limit, page_cursor
Generic call
kosmo integrations:call klaviyo.klaviyo_list_campaigns '{"limit":1,"page_cursor":"example_page_cursor"}' --json
Shortcut
kosmo integrations:klaviyo klaviyo_list_campaigns '{"limit":1,"page_cursor":"example_page_cursor"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

klaviyo.klaviyo_create_profile 5 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_create_profile --json
ParameterTypeRequiredDescription
email string yes The profile's email address.
phone_number string no Phone number in E.164 format (e.g. +1234567890).
first_name string no First name of the profile.
last_name string no Last name of the profile.
properties object no Custom profile properties as key-value pairs.
klaviyo.klaviyo_get_profile 1 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_get_profile --json
ParameterTypeRequiredDescription
profile_id string yes The Klaviyo profile ID.
klaviyo.klaviyo_update_profile 6 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_update_profile --json
ParameterTypeRequiredDescription
profile_id string yes The Klaviyo profile ID to update.
email string no New email address for the profile.
phone_number string no New phone number in E.164 format.
first_name string no Updated first name.
last_name string no Updated last name.
properties object no Custom profile properties to update as key-value pairs.
klaviyo.klaviyo_list_profiles 2 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_list_profiles --json
ParameterTypeRequiredDescription
limit integer no Number of profiles to return (default 20, max 100).
page_cursor string no Pagination cursor from a previous response to fetch the next page.
klaviyo.klaviyo_subscribe_profile 4 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_subscribe_profile --json
ParameterTypeRequiredDescription
list_id string yes The Klaviyo list ID to subscribe the profile to.
email string yes The subscriber's email address.
phone_number string no Phone number in E.164 format.
consented_at string no ISO 8601 timestamp of when consent was given.
klaviyo.klaviyo_create_event 5 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_create_event --json
ParameterTypeRequiredDescription
profile_id string yes The Klaviyo profile ID to associate the event with.
event_name string yes The event name (metric name), e.g. "Placed Order".
properties object no Event properties as key-value pairs.
value number no Numeric value associated with the event (e.g. order total).
time string no ISO 8601 timestamp of when the event occurred.
klaviyo.klaviyo_get_event 1 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_get_event --json
ParameterTypeRequiredDescription
event_id string yes The Klaviyo event ID.
klaviyo.klaviyo_list_events 3 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_list_events --json
ParameterTypeRequiredDescription
filter string no Klaviyo filter expression (e.g. "greater-than(timestamp,2024-01-01)").
limit integer no Number of events to return (default 20, max 100).
page_cursor string no Pagination cursor from a previous response to fetch the next page.
klaviyo.klaviyo_list_lists 2 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_list_lists --json
ParameterTypeRequiredDescription
limit integer no Number of lists to return (default 20, max 100).
page_cursor string no Pagination cursor from a previous response to fetch the next page.
klaviyo.klaviyo_create_list 1 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_create_list --json
ParameterTypeRequiredDescription
name string yes The name for the new list.
klaviyo.klaviyo_get_list 1 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_get_list --json
ParameterTypeRequiredDescription
list_id string yes The Klaviyo list ID.
klaviyo.klaviyo_list_list_profiles 3 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_list_list_profiles --json
ParameterTypeRequiredDescription
list_id string yes The Klaviyo list ID.
limit integer no Number of profiles to return (default 20, max 100).
page_cursor string no Pagination cursor from a previous response to fetch the next page.
klaviyo.klaviyo_list_flows 2 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_list_flows --json
ParameterTypeRequiredDescription
limit integer no Number of flows to return (default 20, max 100).
page_cursor string no Pagination cursor from a previous response to fetch the next page.
klaviyo.klaviyo_get_flow 1 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_get_flow --json
ParameterTypeRequiredDescription
flow_id string yes The Klaviyo flow ID.
klaviyo.klaviyo_list_campaigns 2 parameters
Schema command
kosmo integrations:schema klaviyo.klaviyo_list_campaigns --json
ParameterTypeRequiredDescription
limit integer no Number of campaigns to return (default 20, max 100).
page_cursor string no Pagination cursor from a previous response to fetch the next page.

Permissions

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.