CalerioHomeFeaturesDemoLegacy import APIOpenAPI spec (JSON)العربية

Public API Beta

This page documents API v1 (/api/v1, Beta). The older single endpoint POST /api/ingest has its own page: /docs. The two use different keys.

Push a table (CSV, TSV, JSON, NDJSON or XML) and read back deterministic insights. Every number is computed by code. No call on this page uses AI or the shared AI quota.

5-minute quickstart

1. Create a key

Sign in, then create a key below. Use a sandbox key first: it runs the same calculations but stores nothing. The key is shown once.

2. Push a file
# sandbox key: same calculations, nothing is stored
curl -X POST "https://calerio.wazayef-callcenter.workers.dev/api/v1/results?pack=retail&name=Quickstart" \
  -H "Authorization: Bearer cal_test_YOUR_KEY" \
  -H "Content-Type: text/csv" \
  -H "Idempotency-Key: quickstart-0001" \
  --data-binary $'date,customer,item,qty,amount,status\n2026-01-05,Mina,Cable,2,100,unpaid\n2026-02-05,Omar,Case,1,250,paid'
3. Read the insights
curl "https://calerio.wazayef-callcenter.workers.dev/api/v1/results/sbx_sample/insights" \
  -H "Authorization: Bearer cal_test_YOUR_KEY"
# with a live key use the id returned by step 2: /api/v1/results//insights
Python (no extra packages)
import json, urllib.request, urllib.error
KEY = "cal_test_YOUR_KEY"   # or cal_live_...
BASE = "https://calerio.wazayef-callcenter.workers.dev/api/v1"
def call(method, path, body=None, ctype="application/json"):
    data = body.encode() if isinstance(body, str) else body
    req = urllib.request.Request(BASE + path, data=data, method=method,
        headers={"Authorization": "Bearer " + KEY, "Content-Type": ctype,
                 "User-Agent": "calerio-quickstart/1.0"})   # urllib's default User-Agent is blocked by the CDN
    try:
        with urllib.request.urlopen(req) as r: return r.status, json.load(r)
    except urllib.error.HTTPError as e: return e.code, json.load(e)   # 409 needs_confirmation, 429, ...
csv = "date,customer,item,qty,amount,status\n2026-01-05,Mina,Cable,2,100,unpaid\n2026-02-05,Omar,Case,1,250,paid"
status, res = call("POST", "/results?pack=retail&name=Quickstart", csv, "text/csv")
print(status, res)
rid = "sbx_sample" if res["data"].get("sandbox") else res["data"]["id"]   # sandbox keys store nothing
print(call("GET", "/results/" + rid + "/insights"))

API keys

...

Try it

Response

The response appears here after you press Send.

Rules that match the app

Troubleshooting

Connectors (Beta)

A connector reads a source for you and saves it as a result. GET /api/v1/connectors lists them with their status. Only connectors marked beta can be created; the others say coming_soon and are not available. Every connection is read once when you create it (if it cannot be read, nothing is kept), can be synced again with POST /connections/{id}/sync, and replaces its own previous result. At most 3 connections per workspace and 20 reads per day.

# 1) dry run: reads the sheet, stores nothing
curl -X POST "https://calerio.wazayef-callcenter.workers.dev/api/v1/connections/test" -H "Authorization: Bearer cal_live_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"connector":"google_sheets","config":{"url":"https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID/edit"}}'
# 2) create it (reads once, saves a result, can sync again later)
curl -X POST "https://calerio.wazayef-callcenter.workers.dev/api/v1/connections" -H "Authorization: Bearer cal_live_YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"connector":"sql_postgres","name":"Shop DB","every_hours":24,"config":{"host":"db.example.com","database":"shop","user":"calerio_ro","password":"...","query":"SELECT order_date AS date, customer, total AS amount, status FROM orders"}}'
# 3) read it again now
curl -X POST "https://calerio.wazayef-callcenter.workers.dev/api/v1/connections/cn_YOUR_ID/sync" -H "Authorization: Bearer cal_live_YOUR_KEY"

SDKs and Postman (Beta)

Copy one file, no packages needed. Python: /sdk/calerio.py. JavaScript (ES module): /sdk/calerio.mjs. Postman collection: /sdk/calerio.postman_collection.json (set the variable calerio_key).

# Python (copy sdk/calerio.py next to your script)
from calerio import Calerio, CalerioError
c = Calerio("cal_test_YOUR_KEY")
r = c.create_result(open("sales.csv").read(), name="Sales", pack="retail")
print(c.insights(r["id"])["summary"])

// JavaScript (copy sdk/calerio.mjs)
import { Calerio } from "./calerio.mjs";
const c = new Calerio(process.env.CALERIO_KEY);
const r = await c.createResult(csvText, { name: "Sales", pack: "retail" });
console.log((await c.insights(r.id)).summary);

Webhooks

Events: insight.new, alert.fired, action.awaiting_approval, webhook.test. Each POST is signed. Check the signature before you trust it:

Signature header: Calerio-Signature: t=,v1=. The signed string is t + "." + the raw request body (bytes exactly as received, before any JSON parsing), HMAC-SHA256 with your signing secret, hex encoded. Reject the request if the signature does not match, or if t is more than 300 seconds from your clock (replay protection). Other headers: Calerio-Event, Calerio-Delivery (the same id on every retry, use it to ignore duplicates). Your endpoint must answer 2xx within a few seconds; redirects are not followed.

import hmac, hashlib
def verify(secret, header, raw_body, tolerance=300):
    parts = dict(p.split("=", 1) for p in header.split(","))
    expected = hmac.new(secret.encode(), (parts["t"] + "." + raw_body.decode()).encode(), hashlib.sha256).hexdigest()
    import time
    return hmac.compare_digest(expected, parts["v1"]) and abs(time.time() - int(parts["t"])) <= tolerance
// Node 18+ (Express: use express.raw({type: "application/json"}) so req.body is the raw Buffer)
import crypto from "node:crypto";
export function verify(secret, header, rawBody, tolerance = 300) {
  const p = Object.fromEntries(header.split(",").map((x) => x.split("=", 2)));
  const expected = crypto.createHmac("sha256", secret).update(p.t + "." + rawBody.toString("utf8")).digest("hex");
  const ok = expected.length === p.v1.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(p.v1));
  return ok && Math.abs(Date.now() / 1000 - Number(p.t)) <= tolerance;
}

Retries: one quick retry, then up to four more on a schedule that runs every 3 hours on the free plan (5 attempts in total). The signing secret is shown once when you create the webhook.

Other ways to send data

Not offered

© 2026 Osama Mohamed. All rights reserved.