Install & Compatibility
Where this runs
tested against v3.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.380s · 21.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.2s · import 0.364s · 22MB
20MB installed
● package 20MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
APIClient
✓ from customerio import APIClient
✗ from customerio import Client
CustomerIO
✓ from customerio import CustomerIO
CustomerIOException
✓ from customerio import CustomerIOException
Initialize the `Client` with your Customer.io credentials (Site ID, API Key, and optionally App Key for transactional messages) and perform common operations like identifying users, tracking events, and sending transactional emails.
import os
from customerio import Client
# It's recommended to load credentials from environment variables
site_id = os.environ.get('CUSTOMERIO_SITE_ID', 'YOUR_SITE_ID')
api_key = os.environ.get('CUSTOMERIO_API_KEY', 'YOUR_API_KEY')
app_key = os.environ.get('CUSTOMERIO_APP_KEY', 'YOUR_APP_KEY') # For Transactional API
# Initialize the client. A single client can handle both Track and App APIs.
cio = Client(site_id=site_id, api_key=api_key, app_key=app_key)
# 1. Identify a user (Track API)
try:
response = cio.identify(
customer_id="customer_123",
email="user@example.com",
first_name="John",
last_name="Doe",
created_at=1678886400 # Unix timestamp (e.g., for March 15, 2023)
)
print(f"Identify response: {response.status_code} {response.text}")
except Exception as e:
print(f"Error identifying user: {e}")
# 2. Track an event for a user (Track API)
try:
response = cio.track(
customer_id="customer_123",
name="product_purchased",
data={
"product_id": "SKU456",
"price": 99.99,
"currency": "USD"
}
)
print(f"Track event response: {response.status_code} {response.text}")
except Exception as e:
print(f"Error tracking event: {e}")
# 3. Send a transactional email (App API, requires app_key)
# Ensure 'transactional_message_id' corresponds to an existing template in Customer.io
if app_key != 'YOUR_APP_KEY': # Check if app_key was actually provided from env
try:
response = cio.send_email(
to="user@example.com",
transactional_message_id=123, # Replace with your actual transactional email ID
message_data={
"name": "John Doe",
"item": "Widget"
}
)
print(f"Send email response: {response.status_code} {response.text}")
except Exception as e:
print(f"Error sending email: {e}")
else:
print("Skipping transactional email example: CUSTOMERIO_APP_KEY not configured.")
print("Customer.io operations complete (check console for API responses).")
Upgrade
Version history
3.2.0latest on PyPI · released Jul 24, 2026
Audit
Dependencies
requestsrequiredHTTP client for API communication.