Public API
Read and manage recommendations, anomalies, Aevi insights, forecasts, cloud inventory, realized savings, and Auto-Fix from your own scripts and integrations.
The CostLens public API (/public/v1) lets your own scripts, dashboards, and internal tools read and act on your CostLens data — independent of the CostLens web app. It's a separate, machine-authenticated surface from the app itself: an API key, not a logged-in session, is what authorizes every call.
Try it without connecting your own account
CostLens maintains a permanent CostLens Sandbox organization seeded with realistic, entirely synthetic data — no real cloud accounts, no real AI spend. Ask CostLens support for the current sandbox key and start making real requests immediately. See Sandbox mode below.
What you can do
| Domain | Reads | Writes |
|---|---|---|
| Recommendations | List, get by id | Approve, dismiss |
| Anomalies | List, get by id, get contributing drivers | Acknowledge |
| Aevi Insights | Get the org's current insights | Force a refresh |
| Forecast | Current-month projection, by-service breakdown | — (read-only) |
| Cloud Inventory | List resources, get one resource's config, get its open findings | — (read-only) |
| Realized Savings | Funnel breakdown, effectiveness/ROI, audit trail, timeline | — (read-only) |
| Auto-Fix | List queued/completed fixes, get status | Approve, reject, roll back |
Auto-Fix deliberately does not expose creating or directly applying a fix — an API key can never spend money or change your infrastructure with no logged-in admin in the loop. approve/reject only resolve a fix CostLens's own Auto-Fix rule engine has already queued for review.
Getting an API key
- Go to Settings → API Access (organization admins only).
- Click Create API key, name it, and choose exactly the scopes it needs (see below).
- Copy the key immediately — it's shown once, at creation. CostLens stores only a one-way hash and can never show or recover it again.
Each key belongs to your organization and can only ever see your organization's data.
Authentication
Send your key as a bearer token on every request:
curl https://costlens.aezona.com/public/v1/meta \
-H "Authorization: Bearer cl_live_..."GET /public/v1/meta is the first call any integration should make — it confirms the key is valid and reports the scopes it holds:
{
"api_version": "v1",
"org_id": "b3f1...",
"key_prefix": "cl_live_ab12cd34",
"scopes": ["recommendations:read", "recommendations:write"]
}Scopes
A key only works for the scopes it was granted. A 403 naming a missing scope means the key needs replacing with one that has it — scopes can't be edited on an existing key after creation, by design, so a key's access is always exactly what you can see when you created it.
| Scope | Grants |
|---|---|
recommendations:read / :write | View / approve & dismiss recommendations |
anomalies:read / :write | View / acknowledge anomalies |
insights:read / :write | View / force-refresh Aevi insights |
forecast:read | View cost forecasts |
inventory:read | View cloud inventory |
savings:read | View realized savings |
fixes:write | Manage Auto-Fix (list, approve, reject, roll back) |
Rate limits
Every response carries rate-limit headers:
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9987
X-RateLimit-Reset: 1735689600
Two independent limits apply: a 60 requests / 60 seconds burst cap, and a calendar-month quota (10,000 calls today, shared across all your keys' combined usage against that quota per credential). A 429 response includes a Retry-After header telling you how many seconds to wait.
Pagination
List endpoints use page-number pagination:
{
"items": [ ... ],
"total": 142,
"page": 1,
"page_size": 20,
"pages": 8
}Pass ?page= and ?page_size= to move through results.
Errors
Errors use a single, consistent shape:
{ "detail": "Recommendation not found" }| Status | Meaning |
|---|---|
401 / 403 | Missing, revoked, or expired key — or the key lacks a required scope |
404 | The resource doesn't exist, or isn't visible to your organization |
429 | Rate limit or monthly quota exceeded — see Retry-After |
402 | Only from POST /insights/refresh — your organization's monthly Aevi AI budget is exhausted |
Sandbox mode
CostLens seeds and permanently maintains a CostLens Sandbox organization with realistic, synthetic recommendations, anomalies, a completed fix, months of billing history, and Aevi insights — so you can build and test an integration before ever connecting a real cloud account. A sandbox key works against the exact same /public/v1 endpoints and base URL as a live key; it simply resolves to sandbox data instead of your organization's.
Ask CostLens support for the current sandbox key to get started immediately.
Versioning
/public/v1 follows a simple, additive-first policy: new fields, new optional parameters, and new endpoints ship in place with no version bump. A genuinely breaking change (a field removed or renamed, a new required parameter, a changed response shape) ships as /public/v2 instead, with /public/v1 kept running through an announced deprecation window — an integration built today never breaks silently underneath you. See the changelog for what's shipped.
Where to go next
- SDKs — official JavaScript/TypeScript and Python client libraries.
- Webhooks — get notified the moment something happens, instead of polling.
- Interactive API reference — every endpoint, request, and response schema, live at
/public/v1/docs. - Postman collection — every endpoint with example requests; ask CostLens support for the current collection file.