Chronicle Labs API is currently in beta. Reach out for access
SDK GUIDE
Python
Install and configure the Chronicle Python SDK. Until the package is published, use the HTTP helpers shown below.
Install
npm install @chronicle-labs/sdkSDK generation in progress - until published, Node 18+ fetch works with no extra dependencies.
Install
Node
JS
# When the SDK is published:
pip install chronicle-labs
# Until then:
pip install requests sseclient-pyInitialize the client
Node
JS
from chronicle_labs import Chronicle
chronicle = Chronicle(api_key="ck_test_xxx")
# base_url defaults to https://api.chronicle-labs.dev/v1HTTP fallback (available now)
Use this helper until the SDK package is live.
Node
JS
import os, requests
API_BASE = os.getenv("CHRONICLE_BASE_URL", "https://sandbox-api.chronicle-labs.dev/v1")
API_KEY = os.environ["CHRONICLE_API_KEY"]
session = requests.Session()
session.headers.update({
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
})
def chronicle_request(method, path, **kwargs):
resp = session.request(method, f"{API_BASE}{path}", timeout=15, **kwargs)
resp.raise_for_status()
return resp.json()Create an event
Node
JS
# SDK
event = chronicle.events.create(
source="custom_app",
source_event_id="order_1001_paid",
event_type="order.payment_succeeded",
conversation_id="order_1001",
actor_type="system",
actor_id="payments_service",
payload={"order_id": "order_1001", "amount": 4999, "currency": "usd"},
tenant_id="tenant_demo",
)
# HTTP fallback
event = chronicle_request("POST", "/events", json={...})Response
JSON
{
"event_id": "evt_01J8WNEQ2NWY4G7EJAZ9M8MXXV",
"ingested": true,
"message": "Event ingested successfully"
}