| name | klaviyo-install-auth |
| description | Install and configure Klaviyo Node.js SDK with API key authentication.
Use when setting up a new Klaviyo integration, configuring API keys,
or initializing the klaviyo-api package in your project.
Trigger with phrases like "install klaviyo", "setup klaviyo",
"klaviyo auth", "configure klaviyo API key", "klaviyo SDK setup".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Bash(pip:*), Grep |
| version | 1.7.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","klaviyo","email-marketing","cdp"] |
| compatibility | Designed for Claude Code |
Klaviyo Install & Auth
Overview
Set up the official klaviyo-api Node.js SDK and configure private API key authentication against Klaviyo's REST API (revision 2024-10-15). The workflow below is the high-level path; the verbatim code for every step lives in the full implementation walkthrough, and copy-paste sequences live in worked examples.
Prerequisites
- Node.js 18+ (or Python 3.10+ for Python SDK)
- Klaviyo account at https://www.klaviyo.com/
- Private API key from Settings > API Keys in Klaviyo dashboard
- Public API key (for client-side only -- never use in server code)
Instructions
The full sequence is five steps. The essentials are below; drill into
references/implementation.md for the complete
code of each step (verify script, revision header, Python setup, scope table).
Step 1: Install the Official SDK
npm install klaviyo-api
Important: The npm package is klaviyo-api, not @klaviyo/sdk. The SDK exports per-resource API classes (ProfilesApi, EventsApi, etc.) that each take an ApiKeySession.
Step 2: Configure Authentication
Store the private key in .env and confirm it is gitignored. Klaviyo uses two key types:
| Key Type | Prefix | Use Case | Header |
|---|
| Private API Key | pk_ | Server-side REST API | Authorization: Klaviyo-API-Key pk_*** |
| Public API Key | 6-char | Client-side Track/Identify | Query param company_id |
Step 3: Initialize the SDK
import { ApiKeySession, ProfilesApi, EventsApi, ListsApi } ;
session = (process..!);
profilesApi = (session);
eventsApi = (session);
listsApi = (session);