Skip to main content

SDKs

Official KlayrAI client libraries are currently in development. In the meantime, you can interact with the API directly using HTTP requests.

Coming soon

JavaScript / TypeScript

@klayrai/sdkFull TypeScript support with type-safe request and response objects. Works with Node.js 18+ and modern browsers.Status: In development — estimated Q2 2026

Python

klayraiPythonic interface with async support. Compatible with Python 3.9+.Status: In development — estimated Q2 2026

Preview: JavaScript SDK

Here is a preview of the planned SDK interface:
import { KlayrAI } from "@klayrai/sdk";

const klayrai = new KlayrAI({
  apiKey: process.env.KLAYRAI_API_KEY,
  version: "2026-03-01",
});

// List campaigns
const campaigns = await klayrai.campaigns.list({
  page_size: 10,
});

// Run a diagnostic
const diagnostic = await klayrai.diagnostics.run({
  account_id: "act_123456789",
  campaign_id: "camp_abc123",
  date_start: "2026-03-03",
  date_end: "2026-03-10",
});

// Wait for completion
const result = await klayrai.diagnostics.waitForCompletion(diagnostic.id, {
  pollInterval: 2000,
  timeout: 30000,
});

console.log(result.summary);
console.log(result.issues);
console.log(result.recommendations);

Preview: Python SDK

from klayrai import KlayrAI

client = KlayrAI(
    api_key=os.environ["KLAYRAI_API_KEY"],
    version="2026-03-01",
)

# List campaigns
campaigns = client.campaigns.list(page_size=10)

# Run a diagnostic
diagnostic = client.diagnostics.run(
    account_id="act_123456789",
    campaign_id="camp_abc123",
    date_start="2026-03-03",
    date_end="2026-03-10",
)

# Wait for completion
result = client.diagnostics.wait_for_completion(
    diagnostic.id,
    poll_interval=2.0,
    timeout=30.0,
)

print(result.summary)
print(result.issues)
print(result.recommendations)

Using the API directly

Until the SDKs are available, you can use any HTTP client to interact with the API. See the Authentication page for header requirements and the API Reference for endpoint documentation.
curl -X GET "https://api.klayrai.com/v1/campaigns" \
  -H "x-api-key: $KLAYRAI_API_KEY" \
  -H "klayrai-version: 2026-03-01"

Stay updated

To be notified when SDKs are released:
Community-built client libraries are welcome. If you build a wrapper for KlayrAI’s API, let us know at support@klayrai.com and we may feature it here.