# Klaviyo Integration via LowCodeAPI

## Overview

Klaviyo is a powerful email marketing and automation platform that helps businesses create targeted email campaigns, automate customer journeys, and track performance metrics.

## Base Endpoint

```
https://api.lowcodeapi.com/klaviyo/
```

## Authentication

LowCodeAPI handles authentication automatically. You only need to:

1. **Sign up** at https://www.klaviyo.com/
2. **Connect your account** in LowCodeAPI dashboard
3. **Use your `api_token`** in all requests

The `api_token` is your LowCodeAPI authentication token. LowCodeAPI will automatically:
- Fetch your Klaviyo API key from database
- Apply it to each request with proper header format
- Handle authentication for all API calls

**Auth Type**: `API Key` (Private Key Authentication)

## API Categories

- Marketing Email
- Accounts
- Campaigns
- Catalog
- Coupons

## Common Endpoints

### Category: Accounts

#### Get Accounts

**Method**: `GET` | **LowCodeAPI Path**: `/api/accounts`

**Full URL**:
```
https://api.lowcodeapi.com/klaviyo/api/accounts?api_token={api_token}
```

**Description**: Retrieve the account(s) associated with a given private API key.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/klaviyo/api/accounts?api_token=YOUR_API_TOKEN"
```

**Example Response**:
```json
{
  "data": {
    "id": "123456789",
    "name": "My Account",
    "organization_id": "987654321"
  }
}
```

**Official Documentation**: https://developers.klaviyo.com/en/reference/get_accounts

---

### Category: Campaigns

#### Get Campaigns

**Method**: `GET` | **LowCodeAPI Path**: `/api/campaigns`

**Full URL**:
```
https://api.lowcodeapi.com/klaviyo/api/campaigns?api_token={api_token}
```

**Description**: Returns some or all campaigns based on filters.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/klaviyo/api/campaigns?api_token=YOUR_API_TOKEN"
```

**Example Response**:
```json
{
  "data": [
    {
      "id": "ABC_123",
      "name": "Summer Sale Campaign",
      "status": "sent"
    }
  ]
}
```

**Official Documentation**: https://developers.klaviyo.com/en/reference/get_campaigns

---

### Category: Catalog

#### Get Catalog Items

**Method**: `GET` | **LowCodeAPI Path**: `/api/catalog-items`

**Full URL**:
```
https://api.lowcodeapi.com/klaviyo/api/catalog-items?api_token={api_token}
```

**Description**: Get Catalog Items from your account.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/klaviyo/api/catalog-items?api_token=YOUR_API_TOKEN"
```

**Official Documentation**: https://developers.klaviyo.com/en/reference/get_catalog_items

---

### Category: Coupons

#### Get Coupons

**Method**: `GET` | **LowCodeAPI Path**: `/api/coupons`

**Full URL**:
```
https://api.lowcodeapi.com/klaviyo/api/coupons?api_token={api_token}
```

**Description**: Get all coupons in an account.

**Query Parameters**:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |

**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/klaviyo/api/coupons?api_token=YOUR_API_TOKEN"
```

**Official Documentation**: https://developers.klaviyo.com/en/reference/get_coupons

---

## Usage Examples

### Example 1: Retrieve Account Information

Get your Klaviyo account details to verify connection.

```bash
# Retrieve account information
# No ID needed - this returns your account details
curl -X GET "https://api.lowcodeapi.com/klaviyo/api/accounts?api_token=YOUR_API_TOKEN"
```

### Example 2: List Campaigns and Check Catalog

Browse your email campaigns and catalog items.

```bash
# Get all campaigns in your account
# Returns array of campaigns with IDs, names, and status
curl -X GET "https://api.lowcodeapi.com/klaviyo/api/campaigns?api_token=YOUR_API_TOKEN"

# Get catalog items for your products
# Useful for syncing product data
curl -X GET "https://api.lowcodeapi.com/klaviyo/api/catalog-items?api_token=YOUR_API_TOKEN"
```

### Example 3: Access Coupon Management

Retrieve all coupons configured in your Klaviyo account.

```bash
# List all available coupons
# Returns coupon codes, discounts, and usage information
curl -X GET "https://api.lowcodeapi.com/klaviyo/api/coupons?api_token=YOUR_API_TOKEN"
```

## Complete Endpoint Reference

For a complete list of all endpoints and their parameters, refer to:
- **OpenAPI Definition**: `https://backend.lowcodeapi.com/klaviyo/definition`
- **Official Provider Documentation**: https://developers.klaviyo.com/en/docs/authenticate_#private-key-authentication

## Rate Limits & Best Practices

Klaviyo API enforces rate limits based on your account plan. Refer to official Klaviyo documentation for specific rate limit details.

## Error Handling

Standard HTTP status codes apply. Errors are returned in the response body with details about authentication failures or request issues.