REST API
JSON over HTTPS. All endpoints are scoped to one organisation. Status: Beta
Authentication
Server-to-server calls use an API key created by an owner or admin in Settings → API keys. Keys are shown once, stored as hashes and carry read and/or write scopes.
curl https://<your-deployment>/api/products?limit=5 \ -H "Authorization: Bearer ews_sk_<prefix>_<secret>"
The web app uses an HttpOnly session cookie. Cookie-authenticated write requests must come from the same origin (CSRF protection). Routes marked “session” are not available to API keys.
Rate limits
| Group | Limit | Key |
|---|---|---|
| General API | 240 requests / minute | per API key or IP |
| AI engines & agents | 60 requests / minute | per API key or IP |
| Auth endpoints | 10 requests / minute | per IP |
| Public demo endpoints | 40 requests / minute | per IP |
Responses include x-ratelimit-limit and x-ratelimit-remaining. A 429 response includes retryAfterSeconds. Limits are per server instance in this version.
Errors
{ "error": { "code": "validation_error", "message": "price: must be a number", "field": "price" } }| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_json / invalid_token | Malformed body or expired token |
| 401 | unauthenticated | Sign in or send a valid API key |
| 403 | forbidden / bad_origin | Role lacks permission, or cross-site request blocked |
| 404 | not_found | Resource does not exist in your organisation |
| 409 | integration_not_configured / integration_not_available / already_decided | Action not possible in the current state |
| 413 | payload_too_large / file_too_large | Body or image too large |
| 415 | unsupported_media_type / invalid_image | Wrong image type or content does not match type |
| 422 | validation_error | A field failed validation — `field` says which |
| 423 | account_locked | Too many failed sign-ins |
| 429 | rate_limited | Too many requests — see retryAfterSeconds |
| 502 | provider_error / provider_unreachable / integration_unreachable | A configured external provider failed |
integration_not_configured or integration_not_available error — never a fake success. Agent actions on external systems without a live integration finish with status not_executed.Webhooks
Outgoing webhooks (HMAC-signed event delivery to your endpoint) are Planned and are not available yet. Incoming provider webhooks (Shopify orders/products) are also planned; today data enters through sync, CSV import or the API.
Catalog
/api/productssession or API keydata:readList products (filters: q, category, status, limit, offset).
{ "total": 24, "items": [ { "id": "prd_…", "sku": "KC-MUG-014", "title": "…", "attributes": {…} } ] }/api/productssession or API keycatalog:write (API key scope: write)Create a product.
{ "sku": "KC-NEW-001", "title": "Brass Diya", "price": 499, "category": "home.decor.candles", "attributes": { "material": "brass" } }201 { "product": {…} }/api/products/{id}session or API keydata:readProduct with channel listings and images.
{ "product": {…}, "listings": [], "images": [] }/api/products/{id}session or API keycatalog:writeUpdate product fields or attributes.
{ "attributes": { "capacity_ml": 350 } }{ "product": {…} }/api/products/{id}session or API keycatalog:writeArchive a product (soft delete).
{ "ok": true, "archived": true }/api/products/importsessioncatalog:writeValidate (dryRun) or import a CSV catalog.
{ "csv": "sku,title,price\nKC-1,Mug,499", "dryRun": true }{ "rows": 1, "valid": 1, "created": 1, "errors": [], "warnings": [], "preview": [ … ] }AI engines
/api/ai/vision/analyzesessionai:runCommerce Vision AI: image quality, colours, category, attributes, listings and matches. Images: PNG/JPEG/WebP data URL ≤ 4 MB.
{ "metrics": { "width": 1200, "height": 1200, "brightness": 0.8, "contrast": 0.2, "sharpness": 120, "whiteBackground": 0.9, "fill": 0.7, "dominant": [[50,62,130]], "dhash": "f0e0c0c0e0f0f8fc" }, "imageDataUrl": "data:image/jpeg;base64,…", "hint": "indigo ceramic mug" }{ "mode": "baseline" | "simulated" | "live", "quality": { "score": 85, "issues": [] }, "category": {…}, "attributes": {…}, "needsInput": ["capacity_ml"], "listings": [ … ], "matches": [ … ] }/api/ai/catalog/generatesession or API keyai:run (save: catalog:write)Catalog Intelligence: channel listings + quality scores for a product; save=true stores drafts.
{ "productId": "prd_…", "channels": ["amazon_in", "shopify"], "save": false }{ "mode": "template" | "live", "listings": [ { "channel": "amazon_in", "title": "…", "score": { "score": 82, "checks": [ … ] } } ] }/api/ai/demand/forecastsession or API keydata:readDemand Intelligence: probabilistic forecast, backtest and replenishment plan for a product.
{ "productId": "prd_…", "horizonDays": 28, "serviceLevel": "0.85" }{ "forecast": { "total": { "p10": 98, "p50": 140, "p90": 182 }, "backtest": { "wape": 0.17, "baselineWape": 0.21 } }, "plan": { "stockoutProbability": 0.38, "recommendedQty": 96 } }/api/ai/risk/evaluatesession or API keydata:readCommerce Risk AI: RTO risk for a stored order (orderId) or ad-hoc features.
{ "orderId": "ord_…" }{ "score": 0.71, "band": "high", "factors": [ { "label": "Address quality", "contribution": 0.76 } ], "actions": [ … ], "model": "ews-rto-baseline-v0 …" }/api/ai/providerssessiondata:readConfigured model providers (NIM, OpenAI-compatible, Triton, baseline) and their verified status.
{ "providers": [ { "id": "nvidia-nim", "configured": false } ] }Agents & workflows
/api/agents/executesession or API keyagents:runRun the agent engine on an instruction. Returns the run with plan, tasks, approvals and ledger.
{ "instruction": "Analyze today's orders and identify products with inventory risk." }{ "id": "run_…", "status": "awaiting_approval", "tasks": [ … ], "approvals": [ … ], "summary": "✓ …" }/api/agents/activitysession or API keydata:readRecent runs and approval requests.
{ "runs": [ … ], "approvals": [ … ] }/api/agents/runs/{id}session or API keydata:readFull run detail.
{ "id": "run_…", "tasks": [ … ], "ledger": [ … ] }/api/approvals/{id}sessionrole-dependentApprove or reject a pending action. T2 needs manager+, T3 needs admin/owner.
{ "decision": "approve", "note": "Confirmed with customer" }{ "id": "run_…", "status": "completed", … }/api/agents/ledger/verifysessiondata:readVerify the organisation’s hash-chained execution ledger.
{ "ok": true, "entries": 52, "brokenAt": null }/api/workflowssession or API keydata:readList workflows and recent executions.
{ "workflows": [ … ], "executions": [ … ] }/api/workflows/createsession or API keyworkflows:writeCreate a workflow (alias of POST /api/workflows).
{ "name": "Hold risky COD", "enabled": true, "trigger": { "type": "event", "value": "order.created" }, "conditions": [ { "field": "risk.score", "op": "gte", "value": 0.5 } ], "steps": [ { "tool": "risk.scan" }, { "tool": "order.hold" } ] }201 { "ok": true, "id": "wf_…" }/api/workflows/{id}/runsessionagents:runRun a workflow now, or simulate its trigger event against current data.
{ "source": "event" }{ "status": "awaiting_approval" | "skipped", "note": "…", "run": { … } }Analytics & data
/api/analytics/overviewsession or API keydata:readGMV, net revenue, gross margin, CM1, CM2, RTO and return rates; series; by channel. Query: range=7d|30d|90d|180d, channel.
{ "current": { "gmv": 2777121, "netRevenue": 2255371, "cm2": 1375473, "rtoRate": 0.146 }, "series": [ … ] }/api/orderssession or API keydata:readList orders with latest risk score (filters: from, to, status, channel, payment, q).
{ "total": 8707, "items": [ … ] }/api/inventorysession or API keydata:readForecast-driven inventory health per product and purchase-order drafts.
{ "items": [ { "sku": "…", "plan": { "status": "stockout_risk" } } ], "purchaseOrders": [ … ] }Integrations
/api/integrationssessiondata:readIntegration directory with connection status for the organisation.
{ "integrations": [ { "id": "shopify", "connection": null, "availability": { "live": false } } ] }/api/integrations/{provider}/connectsessionintegrations:manageCreate a demo connection, or a live one (Shopify OAuth / WooCommerce keys / Shiprocket API user). Returns integration_not_available where approval is pending.
{ "mode": "live", "storeUrl": "https://shop.example", "consumerKey": "ck_…", "consumerSecret": "cs_…" }{ "ok": true, "mode": "live" } | 409 { "error": { "code": "integration_not_available" } }/api/integrations/{provider}/syncsessionintegrations:manageSync a connection (live: reads first page from provider; demo: no external call).
{ "mode": "demo", "fetched": 0, "message": "…" }System
/api/healthpublicHealth check: database and provider configuration.
{ "ok": true, "database": "reachable" }