---
title: "Get Cost Trend"
method: GET
path: "/inventory/api/v2/analytics/spend/trend"
tags: ["analytics"]
---

# Get Cost Trend

`GET /inventory/api/v2/analytics/spend/trend`

Retrieving a list of costs over the course of the specified time frame based on the given input filters. If startTime and endTime are empty, the API returns the last month trend.

## Query parameters

- `connector` string[]
- `connectionId` string[]
- `connectionGroup` string[]
- `metricIds` string[]
- `startTime` integer
- `endTime` integer
- `granularity` 'monthly' | 'daily' | 'yearly'

## Response `200`

OK

- GithubComOpengovernOpengovernancePkgInventoryApiCostTrendDatapoint[]
  - `cost` number
  - `costStacked` GithubComOpengovernOpengovernancePkgInventoryApiCostStackedItem[]
    - `category` string[]
    - `cost` number
    - `metricID` string
    - `metricName` string
  - `date` string, date-time
  - `totalConnectionCount` integer
  - `totalSuccessfulDescribedConnectionCount` integer

---

[API](https://skmtc.net/opengovern/apis/opengovernance-service-api.md) · [All operations](https://skmtc.net/opengovern/apis/opengovernance-service-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/opengovern/opengovernance-service-api/versions/ab05295c4094/schema)
