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

NameInTypeDescription
organization_idpathstring (uuid)The organization's ID, from the organizations list. Required.
yearqueryintegerThe year to report on.
monthqueryintegerThe 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 of daily, 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.

Get savings#

GET /api/organizations/{organization_id}/savings

Month-to-date, monthly and lifetime savings, plus monthly savings and coverage per service.

Parameters

NameInTypeDescription
organization_idpathstring (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.

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

NameInTypeDescription
organization_idpathstring (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.