Spend and savings
Get spend#
GET /api/organizations/{organization_id}/spend
Your AWS spend by service and by account, for a month or a year. Pass year for a year, or year and month for one month. Without them, it returns the latest month with cost data.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
organization_id | path | string (uuid) | The organization's ID, from the organizations list. Required. |
year | query | integer | The year to report on. |
month | query | integer | The month to report on, from 1 to 12. Without year, a month in the latest year. |
Response
spend(object): The spend.period(object): The period the report covers.year(integer): The year.month(integer or null): The month, or null for a whole year.label(string): The period's name, like October 2026.granularity(string): Daily points for a month, monthly for a year. One ofdaily,monthly.in_progress(boolean): Whether its totals can still grow.
bounds(object): The months you can ask for.earliest(string or null): The first month with cost data, as YYYY-MM.latest(string): The latest month with cost data, as YYYY-MM.
chart(array of objects): Spend over the period for the top services, the rest grouped as Other.name(string): The service, or Other.points(map of numbers): Spend in USD, keyed by day (YYYY-MM-DD) or by month.total(number): Spend over the period, in USD.
snapshot(object): Total spend for the period, and spend for each service.total(number): Total spend over the period, in USD.services(array of objects): Spend for each service.name(string): The service, or the account name.account_id(string): The 12-digit AWS account ID, on account rows.cost(number): Spend over the period, in USD.previous_cost(number): Spend over the previous month, in USD, for a month period.
accounts(array of objects): Spend for each AWS account.name(string): The service, or the account name.account_id(string): The 12-digit AWS account ID, on account rows.cost(number): Spend over the period, in USD.previous_cost(number): Spend over the previous month, in USD, for a month period.
Errors: 401, 403, 404, 429. See errors.
curl https://app.milkstraw.ai/api/organizations/$ORGANIZATION_ID/spend \
-H "Authorization: Bearer $MILKSTRAW_API_KEY"{
"spend": {
"period": {
"year": 2026,
"month": 11,
"label": "November 2026",
"granularity": "daily",
"in_progress": true
},
"bounds": {
"earliest": "2026-10",
"latest": "2026-11"
},
"chart": [
{
"name": "S3",
"points": {
"2026-11-07": 22,
"2026-11-08": 25
},
"total": 47
},
{
"name": "RDS",
"points": {
"2026-11-08": 100
},
"total": 100
}
],
"snapshot": {
"total": 447,
"services": [
{
"name": "EC2",
"cost": 300,
"previous_cost": 280
},
{
"name": "RDS",
"cost": 100,
"previous_cost": 0
}
]
},
"accounts": [
{
"name": "A1",
"account_id": "123456789012",
"cost": 440.75,
"previous_cost": 140
},
{
"name": "A2",
"account_id": "234567890123",
"cost": 250,
"previous_cost": 0
}
]
}
}Get savings#
GET /api/organizations/{organization_id}/savings
Month-to-date, monthly and lifetime savings, plus monthly savings and coverage per service.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
organization_id | path | string (uuid) | The organization's ID, from the organizations list. Required. |
Response
savings(object): The savings.month_to_date_savings(number): What your commitments saved so far this month, in USD.monthly_savings(number): This month's expected savings, or what is already saved once that is higher, in USD.lifetime_savings(number): Everything MilkStraw AI saved you so far, in USD.monthly_savings_by_service(object): This month's expected savings for each service, in USD.compute(number): Compute.database(number): Databases.
coverage_percentage_by_service(object): How much of each service your commitments cover, from 0 to 100.compute(number): Compute.database(number): Databases.
Errors: 401, 403, 404, 429. See errors.
curl https://app.milkstraw.ai/api/organizations/$ORGANIZATION_ID/savings \
-H "Authorization: Bearer $MILKSTRAW_API_KEY"{
"savings": {
"month_to_date_savings": 0,
"monthly_savings": 0,
"lifetime_savings": 1250,
"monthly_savings_by_service": {
"compute": 0,
"database": 0
},
"coverage_percentage_by_service": {
"compute": 100,
"database": 100
}
}
}List alerts#
GET /api/organizations/{organization_id}/alerts
The AWS accounts and permissions MilkStraw AI couldn't read, so you can fix its access.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
organization_id | path | string (uuid) | The organization's ID, from the organizations list. Required. |
Response
alerts(array of objects): The matching alerts.type(string): What went wrong: sts (the role could not be assumed), permissions (the role lacks permissions), or cost_explorer_enrollment (Cost Explorer is off).accounts(array of objects)id(string): The account's MilkStraw AI ID.nickname(string): The account's name in AWS Organizations.account_id(string): The 12-digit AWS account ID.services(array of objects)service(string): The AWS service, like ec2.aspects(array of objects)aspect(string): What MilkStraw AI could not read, like on_demand_instances.permissions(array of strings): The IAM actions AWS denied, like ecr:DescribeRepositories.
Errors: 401, 403, 404, 429. See errors.
curl https://app.milkstraw.ai/api/organizations/$ORGANIZATION_ID/alerts \
-H "Authorization: Bearer $MILKSTRAW_API_KEY"{
"alerts": [
{
"type": "permissions",
"accounts": [
{
"id": "727f7a11-2e01-5bc2-88db-5a4a19220868",
"nickname": "A1",
"account_id": "123456789012",
"services": [
{
"service": "compute_optimizer",
"aspects": [
{
"aspect": "recommendations",
"permissions": [
"compute-optimizer:GetIdleRecommendations"
]
}
]
}
]
}
]
}
]
}