Skip to main content
The costs endpoints give you programmatic access to InfraAudit’s multi-cloud billing data. You can retrieve current-month overviews, daily or weekly trend breakdowns by service, cost forecasts with confidence intervals, and anomaly detection results. Base path: /api/v1/costs

POST /costs/sync — trigger billing sync

Fetches the latest billing data from all connected providers.
POST /api/v1/costs/sync
Authorization: Bearer <token>

Response 202

{
  "job_id": 55,
  "status": "running"
}

GET /costs/overview — get cost overview

Returns the current month’s spend, last month’s total, and a breakdown by provider.
GET /api/v1/costs/overview
Authorization: Bearer <token>

Response

{
  "current_month": {
    "amount": 4231.50,
    "currency": "USD",
    "from": "2024-01-01",
    "to": "2024-01-14"
  },
  "last_month": {
    "amount": 8450.00,
    "currency": "USD"
  },
  "mom_change_percent": -8.2,
  "by_provider": [
    { "provider_id": 1, "name": "AWS Production", "amount": 3800.00 },
    { "provider_id": 2, "name": "GCP Production", "amount": 431.50 }
  ]
}

GET /costs/trend — get cost trend

Returns daily, weekly, or monthly cost data grouped by provider, service, or region.
GET /api/v1/costs/trend
Authorization: Bearer <token>

Query parameters

provider_id
integer
Filter to a specific provider. Defaults to all providers.
days
integer
default:"30"
Number of days of history to return.
granularity
string
default:"day"
Aggregation granularity: day, week, or month.
group_by
string
default:"provider"
Group breakdown by: provider, service, or region.

Response

{
  "data": [
    {
      "date": "2024-01-14",
      "amount": 285.40,
      "breakdown": {
        "EC2": 180.00,
        "S3": 45.00,
        "RDS": 60.40
      }
    }
  ]
}

GET /costs/forecast — get cost forecast

Returns a projected spend total with confidence interval and daily breakdown.
GET /api/v1/costs/forecast
Authorization: Bearer <token>

Query parameters

days
integer
default:"30"
Forecast horizon in days: 30, 60, or 90.
provider_id
integer
Scope forecast to a specific provider.

Response

{
  "forecast_days": 30,
  "projected_total": 8750.00,
  "confidence_interval": {
    "low": 7900.00,
    "high": 9600.00
  },
  "daily": [
    {
      "date": "2024-01-15",
      "amount": 291.67,
      "lower": 260.00,
      "upper": 320.00
    }
  ]
}

GET /costs/anomalies — list cost anomalies

Returns days where actual spend exceeded the expected range.
GET /api/v1/costs/anomalies
Authorization: Bearer <token>

Query parameters

provider_id
integer
Filter by provider.
days
integer
default:"30"
Look-back window in days.
status
string
Filter by status: active or dismissed.

POST /costs/anomalies//dismiss — dismiss anomaly

POST /api/v1/costs/anomalies/{id}/dismiss
Authorization: Bearer <token>
Content-Type: application/json

Request body

reason
string
Reason for dismissing the anomaly, for example Planned migration.
{
  "reason": "Planned migration"
}