Docs/Code Samples

Code Samples

Complete working examples for the most common KoeIQ API tasks. Replace your-koeiq.com with your instance domain.

1. Upload a Call (Ingest API)

curl

curl -X POST https://your-koeiq.com/api/ingest/upload \
  -H "X-API-Key: koeiq_live_xxxxxxxxxxxx" \
  -F "file=@/path/to/call.wav" \
  -F "call_id=CALL-20260317-001" \
  -F "language=ja-JP" \
  -F "operator_id=OP001" \
  -F "department=Support" \
  -F "call_date=2026-03-17"

Python

import requests

url = "https://your-koeiq.com/api/ingest/upload"
headers = {"X-API-Key": "koeiq_live_xxxxxxxxxxxx"}

with open("/path/to/call.wav", "rb") as f:
    response = requests.post(url, headers=headers, files={
        "file": ("call.wav", f, "audio/wav"),
    }, data={
        "call_id": "CALL-20260317-001",
        "language": "ja-JP",
        "operator_id": "OP001",
        "department": "Support",
        "call_date": "2026-03-17",
    })

print(response.json())  # {"id": "vl_xxxx", "status": "queued"}

Node.js

import FormData from "form-data";
import fetch from "node-fetch";
import fs from "fs";

const form = new FormData();
form.append("file", fs.createReadStream("/path/to/call.wav"), "call.wav");
form.append("call_id", "CALL-20260317-001");
form.append("language", "ja-JP");
form.append("operator_id", "OP001");
form.append("department", "Support");
form.append("call_date", "2026-03-17");

const res = await fetch("https://your-koeiq.com/api/ingest/upload", {
  method: "POST",
  headers: { "X-API-Key": "koeiq_live_xxxxxxxxxxxx", ...form.getHeaders() },
  body: form,
});
console.log(await res.json());

2. List Voicelogs (Python)

import requests

# 1. Login to get JWT
login = requests.post("https://your-koeiq.com/api/auth/login", json={
    "email": "admin@example.com",
    "password": "your_password",
})
token = login.json()["access_token"]
headers = {"Authorization": f"Bearer {token}"}

# 2. List voicelogs (page 1, 20 per page)
r = requests.get("https://your-koeiq.com/api/voicelogs", headers=headers, params={
    "page": 1,
    "status": "done",
})
for call in r.json()["items"]:
    print(call["call_id"], call["quality_score"])

3. Trigger AI Analytics (Python)

import requests

headers = {"Authorization": "Bearer eyJ..."}

voicelog_id = "vl_xxxx"

# Trigger all 4 analytics at once
r = requests.post(
    f"https://your-koeiq.com/api/voicelogs/{voicelog_id}/analyze-all",
    headers=headers,
)
print(r.json())

# Or trigger individually:
for endpoint in ["summary", "emotion", "intent", "quality"]:
    r = requests.post(
        f"https://your-koeiq.com/api/voicelogs/{voicelog_id}/{endpoint}",
        headers=headers,
    )
    print(endpoint, r.status_code)
Note: For webhook signature verification examples in Python and Node.js, see the Webhook Payload Reference.

Next Steps

All DocsContact Support →