Costfluent Public API

List business metrics

GET
https://api.costfluent.com
/v1/business-metrics
Bearer (API token)

Returns a workspace's business metrics.

Needs a token with viewCostReports on the workspace.

List business metrics › query Parameters

workspaceId
​WorkspacePublicId · pattern: ^wsp_[A-Za-z0-9_-]{2… · required
page
​integer · int32

The page to return, counted from 1. A page below 1 reads page 1; one past the last returns no items.

Default: 1
limit
​integer · int32

Items per page, from 1 to 100. A larger value is clamped to 100, a smaller one to 1.

Default: 20

List business metrics › Responses

Success

​PaginationLinks · required
​BusinessMetricResponse[] · required

Create business metric

POST
https://api.costfluent.com
/v1/business-metrics
Bearer (API token)

Creates a business metric whose daily values a cost report divides cost by. A workspace holds a bounded number of metrics: past it, the request is refused with 422 limit_exceeded.

Needs a token with manageBusinessMetrics on the workspace.

Create business metric › Headers

Idempotency-Key
​string · minLength: 1 · maxLength: 255

A unique value, at most 255 printable ASCII characters, such as a UUID, that makes retrying this create safe. A retry with the same key and the same request within 24 hours answers the first response again, marked Idempotent-Replayed: true, and creates nothing; the same key with another request answers 422 idempotency_key_reused. A key is kept only for a create that succeeded. Without it, every request creates.

Create business metric › Request Body

workspaceId
​WorkspacePublicId · minLength: 1 · pattern: ^wsp_[A-Za-z0-9_-]{2… · required
name
​string · required
unit
​string · required
labelColumns
​array | null

Create business metric › Responses

Created

id
​BusinessMetricPublicId · pattern: ^bmt_[A-Za-z0-9_-]{2… · required
name
​string · required
unit
​string · required
labelColumns
​string[] · required
createdAt
​string · date-time · required
updatedAt
​string | null · date-time

Get business metric

GET
https://api.costfluent.com
/v1/business-metrics/{metricId}
Bearer (API token)

Returns one business metric.

Needs a token with viewCostReports on the workspace.

Get business metric › path Parameters

metricId
​BusinessMetricPublicId · pattern: ^bmt_[A-Za-z0-9_-]{2… · required

Get business metric › query Parameters

workspaceId
​WorkspacePublicId · pattern: ^wsp_[A-Za-z0-9_-]{2… · required

Get business metric › Responses

Success

id
​BusinessMetricPublicId · pattern: ^bmt_[A-Za-z0-9_-]{2… · required
name
​string · required
unit
​string · required
labelColumns
​string[] · required
createdAt
​string · date-time · required
updatedAt
​string | null · date-time

Update business metric

PUT
https://api.costfluent.com
/v1/business-metrics/{metricId}
Bearer (API token)

Renames a business metric or its unit; its label columns stay.

Needs a token with manageBusinessMetrics on the workspace.

Update business metric › path Parameters

metricId
​BusinessMetricPublicId · pattern: ^bmt_[A-Za-z0-9_-]{2… · required

Update business metric › query Parameters

workspaceId
​WorkspacePublicId · pattern: ^wsp_[A-Za-z0-9_-]{2… · required

Update business metric › Headers

If-Match
​string

Applies the write only while the resource still has this ETag, and answers 412 precondition_failed otherwise. Without it, the last write wins.

Update business metric › Request Body

name
​string | null
unit
​string | null

Update business metric › Responses

Success

id
​BusinessMetricPublicId · pattern: ^bmt_[A-Za-z0-9_-]{2… · required
name
​string · required
unit
​string · required
labelColumns
​string[] · required
createdAt
​string · date-time · required
updatedAt
​string | null · date-time

Delete business metric

DELETE
https://api.costfluent.com
/v1/business-metrics/{metricId}
Bearer (API token)

Deletes a business metric and its values; a report charting its unit cost goes back to cost alone.

Needs a token with manageBusinessMetrics on the workspace.

Delete business metric › path Parameters

metricId
​BusinessMetricPublicId · pattern: ^bmt_[A-Za-z0-9_-]{2… · required

Delete business metric › query Parameters

workspaceId
​WorkspacePublicId · pattern: ^wsp_[A-Za-z0-9_-]{2… · required

Delete business metric › Headers

If-Match
​string

Applies the write only while the resource still has this ETag, and answers 412 precondition_failed otherwise. Without it, the last write wins.

Delete business metric › Responses

No Content

No data returned

List business metric values

GET
https://api.costfluent.com
/v1/business-metrics/{metricId}/values
Bearer (API token)

Returns a business metric's values between two days, both included, by day.

Needs a token with viewCostReports on the workspace.

List business metric values › path Parameters

metricId
​BusinessMetricPublicId · pattern: ^bmt_[A-Za-z0-9_-]{2… · required

List business metric values › query Parameters

workspaceId
​WorkspacePublicId · pattern: ^wsp_[A-Za-z0-9_-]{2… · required
startDate
​string | null · date

The first day listed, included. Omitted, the listing starts at the earliest value.

endDate
​string | null · date

The last day listed, included. Omitted, the listing ends at the latest value.

page
​integer · int32

The page to return, counted from 1. A page below 1 reads page 1; one past the last returns no items.

Default: 1
limit
​integer · int32

Items per page, from 1 to 1000. A larger value is clamped to 1000, a smaller one to 1.

Default: 20

List business metric values › Responses

Success

​PaginationLinks · required
​BusinessMetricValueResponse[] · required

Import business metric values

POST
https://api.costfluent.com
/v1/business-metrics/{metricId}/values
Bearer (API token)

Stores dated values, each replacing the amount the metric holds for its day and labels, so a repeated request changes nothing. An organization stores a bounded number of values across all its metrics: a request that would add past it is refused whole with 422 limit_exceeded, and one that only replaces stored values always passes.

Needs a token with manageBusinessMetrics on the workspace.

Import business metric values › path Parameters

metricId
​BusinessMetricPublicId · pattern: ^bmt_[A-Za-z0-9_-]{2… · required

Import business metric values › query Parameters

workspaceId
​WorkspacePublicId · pattern: ^wsp_[A-Za-z0-9_-]{2… · required

Import business metric values › Request Body

​array | null

Import business metric values › Responses

Success

created
​integer · int32 · required
updated
​integer · int32 · required
unchanged
​integer · int32 · required