AI Sales Summary — API quick start ================================== Base URL: https://aisummary.acitinar.com (old address http://199.192.25.8:8052 still works for now; please move to the URL above) Auth: send header X-API-Key: (admin-only endpoints need X-Admin-Key: ) Interactive docs: /docs (Swagger) · /redoc Read ---- GET /api/v1/stats # includes 30-day token/cost usage GET /api/v1/summary/{company_number} GET /api/v1/summary/{company_number}/history Estimate cost first (read-only, no OpenAI calls) ------------------------------------------------ POST /api/v1/estimate body: {"numbers":["09595646"],"mode":"batch"} POST /api/v1/refresh/estimate body: {"older_than":30,"limit":500,"mode":"batch"} POST /api/v1/upload?estimate_only=true multipart file= -> {"billable":N,"cost_low_usd":..,"cost_high_usd":..,"recommended_credit_usd":..} Generate -------- POST /api/v1/summary/{company_number}/generate # one company, synchronous (live) POST /api/v1/generate body: {"numbers":["09595646","08804411"],"mode":"batch"} POST /api/v1/upload?mode=batch multipart file= POST /api/v1/refresh body: {"older_than":30,"limit":500,"mode":"batch"} -> all of the above (except single) return {"run_id":N,"total":N,"mode":".."} mode: "batch" = OpenAI Batch API, 50% cheaper, results within 24h "live" = immediate, full price. Default: BULK_MODE in .env Companies whose data hasn't changed since their last summary are skipped free. Runs (pause / resume / cancel / export / retry — interruption-safe, no duplicate spend) ---- GET /api/v1/runs GET /api/v1/runs/{id} # includes est_cost_usd / actual_cost_usd GET /api/v1/runs/{id}/items?state=skipped,error&limit=500&offset=0 GET /api/v1/runs/{id}/export?state=skipped,error POST /api/v1/runs/{id}/retry body: {"states":["skipped","error"],"autostart":true} POST /api/v1/runs/{id}/mode body: {"mode":"batch"} # paused runs only; done companies kept POST /api/v1/runs/{id}/pause POST /api/v1/runs/{id}/resume POST /api/v1/runs/{id}/cancel Admin (X-Admin-Key) ------------------- GET /api/v1/prompt POST /api/v1/prompt body: {"template":"... {{signals}} ..."} POST /api/v1/feedback body: {"summary_id":1,"is_winner":true,"outcome":"meeting"} GET /api/v1/compare # model comparisons (python main.py compare) GET /api/v1/compare/{label} POST /api/v1/compare/{row_id}/prefer Examples -------- curl -H "X-API-Key: KEY" https://aisummary.acitinar.com/api/v1/summary/09595646 curl -H "X-API-Key: KEY" -H "Content-Type: application/json" \ -d '{"numbers":["09595646","08804411"]}' https://aisummary.acitinar.com/api/v1/estimate curl -H "X-API-Key: KEY" -H "Content-Type: application/json" \ -d '{"numbers":["09595646","08804411"],"mode":"batch"}' https://aisummary.acitinar.com/api/v1/generate curl -H "X-API-Key: KEY" -F file=@companies.csv "https://aisummary.acitinar.com/api/v1/upload?mode=batch" curl -H "X-API-Key: KEY" -X POST https://aisummary.acitinar.com/api/v1/runs/12/pause