Visitar URL original
Set up your AI agent | Klaviyo DevelopersSkip to content

This page is available as Markdown at https://developers.klaviyo.com/en/docs/agent_setup.md. An index of every page is at https://developers.klaviyo.com/llms.txt.

KlaviyoKlaviyoDevelopers

Connect AI agents such as Claude, ChatGPT, Cursor and VS Code to Klaviyo with the MCP server and CLI, and give them Klaviyo's docs as Markdown and the OpenAPI spec.

You will learn

AI agents such as Claude, ChatGPT, Cursor and GitHub Copilot can work with Klaviyo in two ways: they can act on your Klaviyo account for you, and they can read Klaviyo's documentation to help you build an integration. This page covers the tools for each:

  • The Klaviyo MCP server lets an agent read and change data in your Klaviyo account.
  • The Klaviyo CLI gives an agent every API operation as a command it can run.
  • Markdown docs give an agent every page of these docs without the HTML around it.
  • The OpenAPI spec describes every endpoint in a format agents and tools can read.

Choose a tool

If you want your agent to… Use
Look up, create or update data in your Klaviyo account: profiles, lists, campaigns, flow reports MCP server
Call the API from a terminal, a script or CI Klaviyo CLI
Write or review code that calls the Klaviyo API Markdown docs and the OpenAPI spec

You can combine them. For example, a coding agent can read the docs to write your integration and use the MCP server to check the results in a test account.

Connect the Klaviyo MCP server

MCP (Model Context Protocol) is an open standard for connecting tools to AI agents. Klaviyo's MCP server gives your agent tools for working with your Klaviyo data, from drafting campaigns to reporting on flow performance.

Klaviyo hosts the server at:

text
https://mcp.klaviyo.com/mcp

It signs you in with OAuth, so you don't need to give the agent an API key.

To connect Claude Code, run:

bash
claude mcp add --transport http klaviyo https://mcp.klaviyo.com/mcp

To connect Cursor, add the server in Settings > Cursor Settings > MCP > New MCP Server:

json
{
  "mcpServers": {
    "klaviyo": {
      "url": "https://mcp.klaviyo.com/mcp"
    }
  }
}

For Claude, ChatGPT, VS Code and other clients, the local server, and the query parameters that control which tools are available, see Connect to the Klaviyo MCP server. For the list of tools, see Available tools.

Use the Klaviyo CLI

The Klaviyo CLI has a command for every JSON operation in the Klaviyo API, generated from the OpenAPI spec. It's designed to run unattended, which makes it a good fit for agents that can run shell commands:

  • Output piped to another program is always JSON. Interactive terminals get tables.
  • No command waits for input.
  • Errors print the API's error response and exit with a non-zero code.
  • Setting KLAVIYO_API_KEY authenticates without storing a key on the machine.

Install it from source with Go, or see Install Klaviyo CLI for binary releases:

bash
go install github.com/klaviyo/klaviyo-cli/cmd/klaviyo@latest

Then an agent can make calls like these:

bash
export KLAVIYO_API_KEY=pk_...
klaviyo profiles list --paginate --jq '.data | length'
klaviyo lists create --name Newsletter

--jq filters the response, --paginate follows every page of a list, and --revision sends a different API revision for one call.

Read the docs as Markdown

Every page of these docs has a Markdown version. Markdown takes far fewer tokens than the HTML page, so an agent can read more of the docs in its context window, and it reads the content without the page around it.

From any page

Open the Page actions menu beside a page's title to:

  • Copy as Markdown, to paste the page into a conversation.
  • View as Markdown, to open the Markdown version.
  • Open in Claude, ChatGPT or Cursor, to start a conversation that reads the page.

Add .md to the URL

Add .md to the end of any page's URL to get its Markdown version, for example:

text
/en/reference/get_profiles.md
/en/docs/get_started.md

An endpoint's Markdown starts with frontmatter that an agent can read without parsing the page: the API revision, OAuth scopes, rate limits, authentication, and which include, fields, filter, sort and pagination options the endpoint supports.

llms.txt

llms.txt files list pages for agents. Each llms.txt links the Markdown version of every page it covers, and each llms-full.txt holds those pages' full text in one file.

File What it covers
/llms.txt The whole site: links to the guides' and each API resource's llms.txt
/llms-full.txt Every guide and every endpoint, in one file
/en/docs/llms.txt Every guide
/en/reference/llms.txt Every API resource in the latest revision
/en/reference/<resource>/llms.txt One resource's endpoints, for example /en/reference/profiles/llms.txt

llms-full.txt files are large. Point an agent at the llms.txt for what it's working on, such as one resource's, so it reads only the pages it needs.

Older API revisions have their own files: add the revision to the path, as in /en/v2025-10-15/reference/llms.txt.

Use the OpenAPI spec

Klaviyo publishes an OpenAPI spec for every API revision in the klaviyo/openapi repository. The API reference, the SDKs and the Klaviyo CLI are all generated from it.

File What it holds
openapi/stable.json Every generally available endpoint in the latest revision
openapi/beta.json The latest revision's beta APIs
openapi/stable/categories/<resource>.json One resource's endpoints, for example profiles.json

Each revision is a branch of the repository, such as 2026-10-15, so an agent can read the spec for the revision your code sends. An endpoint's page also links an OpenAPI document for that endpoint alone.

Give an agent the spec when it needs exact request and response schemas, for example to generate types or a client, or to check the code it wrote against the API.

Next steps

Last updated 2026-11-10