### Klaviyo API Response Example Source: https://context7.com/klaviyo/openapi/llms.txt Example of a typical response from the Klaviyo API, showing event data and included related resources like profiles and metrics. ```json { "data": [{ "type": "event", "id": "evt_01ARZ3NDEKTSV4RRFFQ69G5FAV", "attributes": { "datetime": "2024-03-15T14:30:00+00:00", "event_properties": { "OrderId": "ORD-12345", "Value": 125.99 } }, "relationships": { "profile": {"data": {"type": "profile", "id": "prof_123"}}, "metric": {"data": {"type": "metric", "id": "metric_456"}} } }], "included": [ {"type": "profile", "id": "prof_123", "attributes": {"email": "customer@example.com", "first_name": "Jane"}}, {"type": "metric", "id": "metric_456", "attributes": {"name": "Placed Order"}} ] } ``` -------------------------------- ### Klaviyo Lists API - Create and Manage Lists (Bash) Source: https://context7.com/klaviyo/openapi/llms.txt Examples using curl to interact with the Klaviyo Lists API. This includes creating a new list, adding profiles to an existing list, and retrieving a list with its profile count. Requires a Klaviyo API key and specific revision date. ```bash # Create a new list curl -X POST "https://a.klaviyo.com/api/lists" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "list", "attributes": { "name": "VIP Customers", "opt_in_process": "single_opt_in" } } }' # Response { "data": { "type": "list", "id": "Y6nRLr", "attributes": { "name": "VIP Customers", "created": "2024-03-15T10:00:00+00:00", "updated": "2024-03-15T10:00:00+00:00", "opt_in_process": "single_opt_in" } } } # Add profiles to a list curl -X POST "https://a.klaviyo.com/api/lists/Y6nRLr/relationships/profiles" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": [ {"type": "profile", "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV"}, {"type": "profile", "id": "01ARZ3NDEKTSV4RRFFQ69G5FAW"} ] }' # Get list with profile count curl -X GET "https://a.klaviyo.com/api/lists/Y6nRLr?additional-fields[list]=profile_count" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" ``` -------------------------------- ### GET /api/webhooks Source: https://context7.com/klaviyo/openapi/llms.txt Retrieves a list of configured webhooks for the account, with options to include related topics. ```APIDOC ## GET /api/webhooks ### Description Fetch all webhooks configured for the authenticated account. Supports relationship inclusion. ### Method GET ### Endpoint https://a.klaviyo.com/api/webhooks ### Parameters #### Query Parameters - **include** (string) - Optional - Comma-separated list of relationships to include (e.g., webhook-topics) ### Request Example curl -X GET "https://a.klaviyo.com/api/webhooks?include=webhook-topics" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" ### Response #### Success Response (200) - **data** (object) - A list of webhook objects. #### Response Example { "data": { "type": "webhook", "id": "webhook_xyz789", "attributes": { "name": "Order Event Webhook", "endpoint_url": "https://myapp.com/webhooks/klaviyo", "enabled": true, "created_at": "2024-03-15T10:00:00+00:00" } } } ``` -------------------------------- ### Klaviyo Campaigns API - Create and Send Campaigns (Bash) Source: https://context7.com/klaviyo/openapi/llms.txt Examples using curl to interact with the Klaviyo Campaigns API. This includes filtering campaigns by channel and creating a new email campaign with specified audiences, send strategy, and tracking options. Requires a Klaviyo API key and specific revision date. ```bash # Get campaigns filtered by channel curl -X GET "https://a.klaviyo.com/api/campaigns?filter=equals(messages.channel,'email')&fields[campaign]=name,status,audiences,send_strategy,created_at,scheduled_at&include=campaign-messages" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Accept: application/vnd.api+json" # Create a new email campaign curl -X POST "https://a.klaviyo.com/api/campaigns" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "campaign", "attributes": { "name": "Spring Sale Announcement", "audiences": { "included": ["Y6nRLr"], "excluded": ["XyZ123"] }, "send_strategy": { "method": "static", "datetime": "2024-04-01T10:00:00-04:00", "options": { "is_local": true, "send_past_recipients_immediately": false } }, "send_options": { "use_smart_sending": true }, "tracking_options": { "is_tracking_clicks": true, "is_tracking_opens": true, "add_tracking_params": true } }, "relationships": { "campaign-messages": { "data": [{ "type": "campaign-message", "id": "$]templateId:ABC123" }] } } } }' ``` -------------------------------- ### Get Account Information - Bash Source: https://context7.com/klaviyo/openapi/llms.txt Retrieves account details including contact information, timezone, currency, and public API key. This endpoint is useful for validating API credentials and fetching account-level configuration. It requires an Authorization header with a private API key and a revision header. ```bash # Get account information curl -X GET "https://a.klaviyo.com/api/accounts" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Accept: application/vnd.api+json" ``` -------------------------------- ### Get Customer Profiles - Bash Source: https://context7.com/klaviyo/openapi/llms.txt Retrieves customer profiles with support for filtering, pagination, and optional subscription/predictive analytics data. Allows filtering by email, phone number, external ID, and date fields. Requires GET request with appropriate query parameters and headers. ```bash # Get profiles with filters and additional fields curl -X GET "https://a.klaviyo.com/api/profiles?filter=equals(email,'customer@example.com')&additional-fields[profile]=subscriptions,predictive_analytics&fields[profile]=email,first_name,last_name,subscriptions,predictive_analytics" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Accept: application/vnd.api+json" ``` -------------------------------- ### GET /api/profiles Source: https://context7.com/klaviyo/openapi/llms.txt Retrieve a list of profiles with support for filtering, pagination, and sparse fieldsets. ```APIDOC ## GET /api/profiles ### Description Retrieve profiles with filtering, pagination, and optional subscription/predictive analytics data. Supports filtering by email, phone number, external ID, and various date fields. ### Method GET ### Endpoint https://a.klaviyo.com/api/profiles ### Parameters #### Query Parameters - **filter** (string) - Optional - Filter criteria (e.g., equals(email,'customer@example.com')). - **fields[profile]** (string) - Optional - Comma-separated list of fields to return. ### Request Example curl -X GET "https://a.klaviyo.com/api/profiles?filter=equals(email,'customer@example.com')" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" ### Response #### Success Response (200) - **data** (array) - List of profile objects matching the filter criteria. #### Response Example { "data": [{ "type": "profile", "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "attributes": { "email": "customer@example.com" } }] } ``` -------------------------------- ### GET /api/accounts Source: https://context7.com/klaviyo/openapi/llms.txt Retrieve account-level configuration including contact details, timezone, currency, and public API keys. ```APIDOC ## GET /api/accounts ### Description Retrieve account information including contact details, timezone, currency settings, and public API key. This endpoint is useful for validating API credentials or fetching account-level configuration. ### Method GET ### Endpoint https://a.klaviyo.com/api/accounts ### Parameters None ### Request Example curl -X GET "https://a.klaviyo.com/api/accounts" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Accept: application/vnd.api+json" ### Response #### Success Response (200) - **data** (array) - List containing account objects with attributes like contact_information, timezone, and public_api_key. #### Response Example { "data": [{ "type": "account", "id": "abc123", "attributes": { "contact_information": { "default_sender_name": "My Store", "default_sender_email": "hello@mystore.com" }, "timezone": "America/New_York", "public_api_key": "pk_abc123" } }] } ``` -------------------------------- ### Catalogs API - Get Catalog Items with Filtering Source: https://context7.com/klaviyo/openapi/llms.txt Retrieves catalog items with support for filtering based on criteria like price. Allows specifying fields to return and pagination size. Requires API key. ```bash curl -X GET "https://a.klaviyo.com/api/catalog-items?filter=greater-than(price,25.00)&fields[catalog-item]=external_id,title,price,url&page[size]=50" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" ``` -------------------------------- ### Get Events with Filters and Includes Source: https://context7.com/klaviyo/openapi/llms.txt Retrieves events, allowing filtering by metric, profile, or date range. The `include` parameter can fetch related profile and metric data in a single request. This requires an API key, revision date, and specifies fields for events, profiles, and metrics, along with pagination settings. The response format is JSON API. ```bash # Get events with filters and includes curl -X GET "https://a.klaviyo.com/api/events?filter=greater-than(datetime,2024-03-01T00:00:00Z)&include=profile,metric&fields[event]=datetime,event_properties&fields[profile]=email,first_name&fields[metric]=name&page[size]=50" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Accept: application/vnd.api+json" ``` -------------------------------- ### GET /api/segments Source: https://context7.com/klaviyo/openapi/llms.txt Retrieves a list of all segments and their definitions. ```APIDOC ## GET /api/segments ### Description Retrieves all segments, including their active status and definition rules. ### Method GET ### Endpoint https://a.klaviyo.com/api/segments ### Query Parameters - **fields[segment]** (string) - Optional - Comma-separated list of fields to return ### Response #### Success Response (200) - **data** (array) - List of segment objects ### Response Example { "data": [{ "type": "segment", "id": "WbVvKe", "attributes": { "name": "Engaged Subscribers", "is_active": true } }] } ``` -------------------------------- ### GET /api/flows Source: https://context7.com/klaviyo/openapi/llms.txt Retrieves a list of flows, optionally filtered by status. ```APIDOC ## GET /api/flows ### Description Fetch all flows with specific fields and filtering capabilities. ### Method GET ### Endpoint https://a.klaviyo.com/api/flows ### Query Parameters - **filter** (string) - Optional - Filter criteria (e.g., status='live'). - **fields[flow]** (string) - Optional - Comma-separated list of fields to return. ### Response #### Success Response (200) - **data** (array) - List of flow objects. ### Response Example { "data": [{ "type": "flow", "id": "flow_abc123", "attributes": { "name": "Welcome Series", "status": "live" } }] } ``` -------------------------------- ### Get Templates - Klaviyo API Source: https://context7.com/klaviyo/openapi/llms.txt Retrieves a list of templates from Klaviyo. This endpoint allows you to fetch template details such as name, editor type, and creation/update timestamps. Pagination is supported using the `page[size]` parameter. ```bash curl -X GET "https://a.klaviyo.com/api/templates?fields[template]=name,editor_type,created,updated&page[size]=50" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" ``` -------------------------------- ### API Error Handling Patterns Source: https://context7.com/klaviyo/openapi/llms.txt Examples of standard JSON:API error responses returned by the Klaviyo API. Includes structures for bad requests and rate limit exceedance scenarios. ```json { "errors": [{ "id": "error_abc123", "status": 400, "code": "invalid_request", "title": "Invalid Request", "detail": "The 'email' field is required for profile creation", "source": { "pointer": "/data/attributes/email" } }] } { "errors": [{ "id": "error_def456", "status": 429, "code": "rate_limit_exceeded", "title": "Rate Limit Exceeded", "detail": "You have exceeded the burst rate limit of 75/s. Please retry after the Retry-After period.", "meta": { "retry_after": 1 } }] } ``` -------------------------------- ### Klaviyo Segments API - Retrieve Segments and Members (Bash) Source: https://context7.com/klaviyo/openapi/llms.txt Examples using curl to interact with the Klaviyo Segments API. This includes fetching all segments with specific fields and retrieving profiles associated with a particular segment. Requires a Klaviyo API key and specific revision date. ```bash # Get all segments curl -X GET "https://a.klaviyo.com/api/segments?fields[segment]=name,definition,is_active,created,updated" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Accept: application/vnd.api+json" # Response { "data": [{ "type": "segment", "id": "WbVvKe", "attributes": { "name": "Engaged Subscribers", "is_active": true, "created": "2024-01-15T08:00:00+00:00", "updated": "2024-03-15T12:00:00+00:00", "definition": { "condition_groups": [{ "conditions": [{ "type": "profile_metric", "metric_id": "metric_123", "timeframe": "last_30_days", "operator": "greater_than", "value": 0 }] }] } } }] } # Get profiles in a segment curl -X GET "https://a.klaviyo.com/api/segments/WbVvKe/profiles?fields[profile]=email,first_name,last_name&page[size]=100" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" ``` -------------------------------- ### GET /api/events Source: https://context7.com/klaviyo/openapi/llms.txt Retrieve events with filtering by metric, profile, or date range. Use includes to fetch related profile and metric data in a single request. ```APIDOC ## GET /api/events ### Description Retrieve events with filtering by metric, profile, or date range. Use includes to fetch related profile and metric data in a single request. ### Method GET ### Endpoint /api/events ### Parameters #### Query Parameters - **filter** (string) - Optional - Filter events based on various criteria (e.g., date range, metric name, profile email). - **include** (string) - Optional - Specify related resources to include in the response (e.g., "profile", "metric"). - **fields[event]** (string) - Optional - Specify which fields to return for the event resource. - **fields[profile]** (string) - Optional - Specify which fields to return for the profile resource. - **fields[metric]** (string) - Optional - Specify which fields to return for the metric resource. - **page[size]** (integer) - Optional - Number of results per page. - **page[cursor]** (string) - Optional - Cursor for paginating through results. ### Request Example ```bash curl -X GET "https://a.klaviyo.com/api/events?filter=greater-than(datetime,2024-03-01T00:00:00Z)&include=profile,metric&fields[event]=datetime,event_properties&fields[profile]=email,first_name&fields[metric]=name&page[size]=50" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Accept: application/vnd.api+json" ``` ### Response #### Success Response (200 OK) - **data** (array) - An array of event objects. - **type** (string) - Type of the resource, "event". - **id** (string) - Unique identifier for the event. - **attributes** (object) - Event attributes. - **datetime** (string) - Timestamp of the event. - **event_properties** (object) - Custom properties of the event. - **relationships** (object) - Relationships to other resources (e.g., profile, metric). - **links** (object) - Links for pagination. - **included** (array) - Included related resources (profiles, metrics) if requested. #### Response Example ```json { "data": [ { "type": "event", "id": "some-event-id", "attributes": { "datetime": "2024-03-15T14:30:00+00:00", "event_properties": { "OrderId": "ORD-12345", "Value": 125.99 } }, "relationships": { "profile": { "data": { "type": "profile", "id": "profile-id-1" } }, "metric": { "data": { "type": "metric", "id": "metric-id-1" } } } } ], "links": { "self": "https://a.klaviyo.com/api/events?filter=...", "next": "https://a.klaviyo.com/api/events?page[cursor]=abc123" }, "included": [ { "type": "profile", "id": "profile-id-1", "attributes": { "email": "customer@example.com", "first_name": "Jane" } }, { "type": "metric", "id": "metric-id-1", "attributes": { "name": "Placed Order" } } ] } ``` ``` -------------------------------- ### Manage Webhooks via Klaviyo API Source: https://context7.com/klaviyo/openapi/llms.txt Demonstrates how to retrieve webhook configurations from the Klaviyo API. Requires a valid private API key and the appropriate revision header. ```bash curl -X GET "https://a.klaviyo.com/api/webhooks?include=webhook-topics" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" ``` -------------------------------- ### Coupons API - Create Coupon Source: https://context7.com/klaviyo/openapi/llms.txt Creates a new coupon code in Klaviyo for promotional use. Requires an external ID and description for the coupon. API key is necessary for authentication. ```bash curl -X POST "https://a.klaviyo.com/api/coupons" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "coupon", "attributes": { "external_id": "SPRING2024", "description": "Spring Sale 20% Off" } } }' ``` -------------------------------- ### Catalogs API - Create Catalog Item Source: https://context7.com/klaviyo/openapi/llms.txt Creates a new catalog item in Klaviyo. Requires product details such as external ID, title, description, URL, and pricing. Custom metadata can also be included. API key is mandatory. ```bash curl -X POST "https://a.klaviyo.com/api/catalog-items" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "catalog-item", "attributes": { "external_id": "PROD-001", "title": "Premium Blue Widget", "description": "Our best-selling widget in stunning blue", "url": "https://mystore.com/products/premium-blue-widget", "image_full_url": "https://mystore.com/images/widget-full.jpg", "image_thumbnail_url": "https://mystore.com/images/widget-thumb.jpg", "price": 49.99, "custom_metadata": { "brand": "WidgetCo", "material": "aluminum", "weight_kg": 0.5 } }, "relationships": { "catalog-categories": { "data": [ {"type": "catalog-category", "id": "$custom:::CAT-WIDGETS"} ] } } } }' ``` -------------------------------- ### POST /api/coupons Source: https://context7.com/klaviyo/openapi/llms.txt Creates a new coupon code for promotional use. ```APIDOC ## POST /api/coupons ### Description Creates a coupon entity with an external ID and description. ### Method POST ### Endpoint https://a.klaviyo.com/api/coupons ### Request Body - **data** (object) - Required - Coupon attributes. ### Request Example { "data": { "type": "coupon", "attributes": { "external_id": "SPRING2024", "description": "Spring Sale 20% Off" } } } ``` -------------------------------- ### POST /api/lists Source: https://context7.com/klaviyo/openapi/llms.txt Creates a new subscriber list for targeted marketing campaigns. ```APIDOC ## POST /api/lists ### Description Creates a new subscriber list in your Klaviyo account. ### Method POST ### Endpoint https://a.klaviyo.com/api/lists ### Request Body - **data** (object) - Required - The list resource object - **data.type** (string) - Required - Must be "list" - **data.attributes** (object) - Required - Attributes including "name" and "opt_in_process" ### Request Example { "data": { "type": "list", "attributes": { "name": "VIP Customers", "opt_in_process": "single_opt_in" } } } ``` -------------------------------- ### POST /api/catalog-items Source: https://context7.com/klaviyo/openapi/llms.txt Creates a new item in the product catalog. ```APIDOC ## POST /api/catalog-items ### Description Adds a new product to the catalog with metadata and category relationships. ### Method POST ### Endpoint https://a.klaviyo.com/api/catalog-items ### Request Body - **data** (object) - Required - Catalog item attributes and relationships. ### Request Example { "data": { "type": "catalog-item", "attributes": { "external_id": "PROD-001", "title": "Premium Blue Widget", "price": 49.99 } } } ``` -------------------------------- ### Create Coupon Code - Klaviyo API Source: https://context7.com/klaviyo/openapi/llms.txt Creates a single coupon code within Klaviyo. Requires a private API key for authorization and specifies the coupon code and its expiration date. The coupon must already exist in Klaviyo. ```bash curl -X POST "https://a.klaviyo.com/api/coupon-codes" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "coupon-code", "attributes": { "unique_code": "SPRING20-ABC123", "expires_at": "2024-05-31T23:59:59Z" }, "relationships": { "coupon": { "data": {"type": "coupon", "id": "coupon_xyz"} } } } }' ``` -------------------------------- ### Create Customer Profile - Bash Source: https://context7.com/klaviyo/openapi/llms.txt Creates a new customer profile in Klaviyo, including contact details, custom properties, and location data. This is fundamental for building the customer data model and can be enriched with subscription and predictive analytics. Requires POST request with JSON payload and specific headers. ```bash # Create a new profile curl -X POST "https://a.klaviyo.com/api/profiles" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -H "Accept: application/vnd.api+json" \ -d '{ "data": { "type": "profile", "attributes": { "email": "customer@example.com", "phone_number": "+15551234567", "first_name": "Jane", "last_name": "Doe", "organization": "Acme Corp", "title": "CEO", "location": { "address1": "456 Oak Ave", "city": "San Francisco", "region": "CA", "country": "US", "zip": "94102" }, "properties": { "loyalty_tier": "gold", "signup_source": "website", "customer_since": "2024-01-15" } } } }' ``` -------------------------------- ### POST /api/template-render Source: https://context7.com/klaviyo/openapi/llms.txt Renders an email template by injecting dynamic context variables. ```APIDOC ## POST /api/template-render ### Description Render a template with provided context variables to generate HTML or plain text output. ### Method POST ### Endpoint https://a.klaviyo.com/api/template-render ### Request Body - **id** (string) - Required - The template ID. - **context** (object) - Required - Key-value pairs for template variables. ### Response Example { "data": { "type": "template", "attributes": { "html": "...", "text": "Plain text version..." } } } ``` -------------------------------- ### POST /api/campaigns Source: https://context7.com/klaviyo/openapi/llms.txt Creates a new email, SMS, or mobile push campaign. ```APIDOC ## POST /api/campaigns ### Description Creates a new campaign with specified audience, send strategy, and tracking options. ### Method POST ### Endpoint https://a.klaviyo.com/api/campaigns ### Request Body - **data** (object) - Required - Campaign resource object - **data.attributes** (object) - Required - Includes name, audiences, and send_strategy ### Request Example { "data": { "type": "campaign", "attributes": { "name": "Spring Sale Announcement", "audiences": { "included": ["Y6nRLr"] } } } } ``` -------------------------------- ### POST /api/profiles Source: https://context7.com/klaviyo/openapi/llms.txt Create a new customer profile in Klaviyo with contact details, custom properties, and location data. ```APIDOC ## POST /api/profiles ### Description Create a new customer profile with contact information, custom properties, and location data. Profiles are the foundation of Klaviyo's customer data model. ### Method POST ### Endpoint https://a.klaviyo.com/api/profiles ### Parameters #### Request Body - **data** (object) - Required - The profile object containing type and attributes. - **attributes** (object) - Required - Profile details including email, phone_number, first_name, last_name, and custom properties. ### Request Example { "data": { "type": "profile", "attributes": { "email": "customer@example.com", "first_name": "Jane", "last_name": "Doe" } } } ### Response #### Success Response (200) - **data** (object) - The created profile object including the generated ID. #### Response Example { "data": { "type": "profile", "id": "01ARZ3NDEKTSV4RRFFQ69G5FAV", "attributes": { "email": "customer@example.com", "created": "2024-03-15T10:30:00+00:00" } } } ``` -------------------------------- ### POST /api/profile-subscription-bulk-create-jobs Source: https://context7.com/klaviyo/openapi/llms.txt Subscribe one or more profiles to email and/or SMS marketing channels. Creates profiles if they don't exist. All subscribed profiles are added to the specified list. ```APIDOC ## POST /api/profile-subscription-bulk-create-jobs ### Description Subscribe one or more profiles to email and/or SMS marketing channels. Creates profiles if they don't exist. All subscribed profiles are added to the specified list. ### Method POST ### Endpoint /api/profile-subscription-bulk-create-jobs ### Parameters #### Request Body - **data** (object) - Required - The payload for the bulk subscription job. - **type** (string) - Required - Must be "profile-subscription-bulk-create-job". - **attributes** (object) - Required - Attributes for the job. - **profiles** (object) - Required - Profiles to subscribe. - **data** (array) - Required - Array of profile objects. - **type** (string) - Required - Must be "profile". - **attributes** (object) - Required - Profile attributes. - **email** (string) - Optional - The email address of the profile. - **phone_number** (string) - Optional - The phone number of the profile. - **subscriptions** (object) - Optional - Subscription details. - **email** (object) - Optional - Email subscription details. - **marketing** (object) - Optional - Marketing email subscription. - **consent** (string) - Required - "SUBSCRIBED" or "UNSUBSCRIBED". - **sms** (object) - Optional - SMS subscription details. - **marketing** (object) - Optional - Marketing SMS subscription. - **consent** (string) - Required - "SUBSCRIBED" or "UNSUBSCRIBED". - **relationships** (object) - Required - Relationships for the job. - **list** (object) - Required - The list to add profiles to. - **data** (object) - Required - List data. - **type** (string) - Required - Must be "list". - **id** (string) - Required - The ID of the list. ### Request Example ```json { "data": { "type": "profile-subscription-bulk-create-job", "attributes": { "profiles": { "data": [ { "type": "profile", "attributes": { "email": "subscriber1@example.com", "phone_number": "+15551234567", "subscriptions": { "email": { "marketing": { "consent": "SUBSCRIBED" } }, "sms": { "marketing": { "consent": "SUBSCRIBED" } } } } }, { "type": "profile", "attributes": { "email": "subscriber2@example.com", "subscriptions": { "email": { "marketing": { "consent": "SUBSCRIBED" } } } } } ] } }, "relationships": { "list": { "data": { "type": "list", "id": "Y6nRLr" } } } } } ``` ### Response #### Success Response (202 Accepted) - **data** (object) - Details of the created job. - **type** (string) - Type of the resource, "profile-subscription-bulk-create-job". - **id** (string) - Unique identifier for the job. - **attributes** (object) - Job attributes. - **status** (string) - Current status of the job (e.g., "PENDING", "PROCESSING", "COMPLETE"). - **created_at** (string) - Timestamp when the job was created. - **updated_at** (string) - Timestamp when the job was last updated. - **total_profiles** (integer) - Total number of profiles in the job. - **processed_profiles** (integer) - Number of profiles processed so far. - **succeeded_profiles** (integer) - Number of profiles successfully processed. - **failed_profiles** (integer) - Number of profiles that failed processing. #### Response Example ```json { "data": { "type": "profile-subscription-bulk-create-job", "id": "some-job-id", "attributes": { "status": "PENDING", "created_at": "2024-01-01T12:00:00+00:00", "updated_at": "2024-01-01T12:00:00+00:00", "total_profiles": 2, "processed_profiles": 0, "succeeded_profiles": 0, "failed_profiles": 0 } } } ``` ``` -------------------------------- ### POST /api/back-in-stock-subscriptions Source: https://context7.com/klaviyo/openapi/llms.txt Creates a subscription for a profile to be notified when a variant is back in stock. ```APIDOC ## POST /api/back-in-stock-subscriptions ### Description Registers a user for back-in-stock notifications via email or SMS. ### Method POST ### Endpoint https://a.klaviyo.com/api/back-in-stock-subscriptions ### Request Body - **data** (object) - Required - Subscription details including profile and variant ID. ### Response #### Success Response (202) - **status** (string) - Accepted ``` -------------------------------- ### Back In Stock Subscriptions API - Create Subscription Source: https://context7.com/klaviyo/openapi/llms.txt Subscribes a profile to receive back-in-stock notifications for a specific catalog variant. Supports email and SMS channels. Requires variant ID and profile contact information. API key is needed. ```bash curl -X POST "https://a.klaviyo.com/api/back-in-stock-subscriptions" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "back-in-stock-subscription", "attributes": { "channels": ["EMAIL", "SMS"], "profile": { "data": { "type": "profile", "attributes": { "email": "customer@example.com", "phone_number": "+15551234567" } } } }, "relationships": { "variant": { "data": { "type": "catalog-variant", "id": "$custom:::SKU-001-BLUE-SM" } } } } }' ``` -------------------------------- ### Create Event using Events API Source: https://context7.com/klaviyo/openapi/llms.txt Tracks customer behavior by creating events, which are crucial for automations, segmentation, and analytics. This endpoint requires an API key, revision date, and a JSON payload containing event details, including metric, profile identification, and custom properties. The response indicates asynchronous processing. ```bash # Track a custom event curl -X POST "https://a.klaviyo.com/api/events" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "event", "attributes": { "metric": { "data": { "type": "metric", "attributes": { "name": "Placed Order" } } }, "profile": { "data": { "type": "profile", "attributes": { "email": "customer@example.com" } } }, "properties": { "OrderId": "ORD-12345", "Value": 125.99, "Currency": "USD", "Items": [ { "ProductID": "PROD-001", "SKU": "SKU-ABC", "ProductName": "Blue Widget", "Quantity": 2, "ItemPrice": 49.99, "ImageURL": "https://example.com/widget.jpg", "ProductURL": "https://example.com/products/widget" } ], "ShippingAddress": { "City": "Boston", "Region": "MA", "Country": "US" } }, "value": 125.99, "unique_id": "ORD-12345", "time": "2024-03-15T14:30:00+00:00" } } }' # Response: 202 Accepted ``` -------------------------------- ### Create Webhook - Klaviyo API Source: https://context7.com/klaviyo/openapi/llms.txt Configures a webhook to receive real-time notifications for specific events in your Klaviyo account. This endpoint requires an endpoint URL, a secret key for security, and a list of webhook topics to subscribe to. ```bash curl -X POST "https://a.klaviyo.com/api/webhooks" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "webhook", "attributes": { "name": "Order Event Webhook", "endpoint_url": "https://myapp.com/webhooks/klaviyo", "secret_key": "whsec_your_secret_key_here" }, "relationships": { "webhook-topics": { "data": [ {"type": "webhook-topic", "id": "event:received"}, {"type": "webhook-topic", "id": "profile:created"}, {"type": "webhook-topic", "id": "profile:updated"} ] } } } }' ``` -------------------------------- ### Catalogs API - Create Catalog Variant Source: https://context7.com/klaviyo/openapi/llms.txt Adds a new variant to an existing catalog item. Requires the parent catalog item's ID, variant details like SKU, price, and inventory. API key is required. ```bash curl -X POST "https://a.klaviyo.com/api/catalog-variants" \ -H "Authorization: Klaviyo-API-Key pk_your_private_key" \ -H "revision: 2026-01-15" \ -H "Content-Type: application/vnd.api+json" \ -d '{ "data": { "type": "catalog-variant", "attributes": { "external_id": "SKU-001-BLUE-SM", "title": "Premium Blue Widget - Small", "sku": "SKU-001-BLUE-SM", "price": 49.99, "inventory_quantity": 150, "inventory_policy": 1 }, "relationships": { "catalog-item": { "data": {"type": "catalog-item", "id": "$custom:::PROD-001"} } } } }' ``` -------------------------------- ### POST /api/coupon-codes Source: https://context7.com/klaviyo/openapi/llms.txt Creates a single unique coupon code associated with a specific coupon definition. ```APIDOC ## POST /api/coupon-codes ### Description Creates a new unique coupon code for an existing coupon definition. ### Method POST ### Endpoint https://a.klaviyo.com/api/coupon-codes ### Request Body - **data** (object) - Required - The coupon code resource object. - **unique_code** (string) - Required - The unique string for the coupon. - **expires_at** (string) - Optional - ISO 8601 timestamp for expiration. ### Request Example { "data": { "type": "coupon-code", "attributes": { "unique_code": "SPRING20-ABC123", "expires_at": "2024-05-31T23:59:59Z" }, "relationships": { "coupon": { "data": {"type": "coupon", "id": "coupon_xyz"} } } } } ``` -------------------------------- ### POST /api/webhooks Source: https://context7.com/klaviyo/openapi/llms.txt Configures a new webhook to receive real-time notifications for account events. ```APIDOC ## POST /api/webhooks ### Description Configure webhooks to receive real-time notifications for events in your Klaviyo account. ### Method POST ### Endpoint https://a.klaviyo.com/api/webhooks ### Request Body - **name** (string) - Required - Name of the webhook. - **endpoint_url** (string) - Required - The destination URL for notifications. - **secret_key** (string) - Required - Secret key for payload verification. ``` -------------------------------- ### POST /api/data-sources Source: https://context7.com/klaviyo/openapi/llms.txt Creates a new data source to manage custom object data within the Klaviyo ecosystem. ```APIDOC ## POST /api/data-sources ### Description Registers a new data source for importing custom object data such as loyalty points or tier information. ### Method POST ### Endpoint https://a.klaviyo.com/api/data-sources ### Parameters #### Request Body - **data** (object) - Required - The data source payload containing type and attributes. ### Request Example { "data": { "type": "data-source", "attributes": { "title": "Loyalty Program Data", "description": "Custom loyalty points and tier data", "visibility": "public" } } } ### Response #### Success Response (201) - **data** (object) - The created data source object. #### Response Example { "data": { "type": "data-source", "id": "ds_123", "attributes": { "title": "Loyalty Program Data" } } } ```