Costfluent Public API

List allocation rules

GET
https://api.costfluent.com
/v1/allocation/rules
Bearer (API token)

Returns the workspace's rules in compiled precedence order, paged. The order is the meaning of the set, so reading every page in turn is also the export.

Needs a token with viewCostAllocation on the workspace.

List allocation rules › 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 allocation rules › Responses

Success

​PaginationLinks · required
​AllocationRuleResponse[] · required

Create an allocation rule

POST
https://api.costfluent.com
/v1/allocation/rules
Bearer (API token)

Needs a token with manageCostAllocation on the workspace.

Create an allocation rule › 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 an allocation rule › Request Body

workspaceId
​WorkspacePublicId · minLength: 1 · pattern: ^wsp_[A-Za-z0-9_-]{2… · required
name
​string · required
filter
​string · required
segmentId
​SegmentPublicId · minLength: 1 · pattern: ^seg_[A-Za-z0-9_-]{2… · required
priority
​integer · int32
isEnabled
​boolean

Create an allocation rule › Responses

Created

id
​AllocationRulePublicId · pattern: ^alr_[A-Za-z0-9_-]{2… · required
name
​string · required
priority
​integer · int32 · required
filter
​string · required
costKind
​string · required
segmentId
​SegmentPublicId · pattern: ^seg_[A-Za-z0-9_-]{2… · required
isEnabled
​boolean · required
createdAt
​string · date-time · required
segmentName
​string | null
costCentre
​string | null
updatedAt
​string | null · date-time

Update an allocation rule

PUT
https://api.costfluent.com
/v1/allocation/rules/{ruleId}
Bearer (API token)

Needs a token with manageCostAllocation on the workspace.

Update an allocation rule › path Parameters

ruleId
​AllocationRulePublicId · pattern: ^alr_[A-Za-z0-9_-]{2… · required

Update an allocation rule › query Parameters

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

Update an allocation rule › 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 an allocation rule › Request Body

name
​string · required
filter
​string · required
segmentId
​SegmentPublicId · minLength: 1 · pattern: ^seg_[A-Za-z0-9_-]{2… · required
priority
​integer | null · int32
isEnabled
​boolean | null

Update an allocation rule › Responses

Success

id
​AllocationRulePublicId · pattern: ^alr_[A-Za-z0-9_-]{2… · required
name
​string · required
priority
​integer · int32 · required
filter
​string · required
costKind
​string · required
segmentId
​SegmentPublicId · pattern: ^seg_[A-Za-z0-9_-]{2… · required
isEnabled
​boolean · required
createdAt
​string · date-time · required
segmentName
​string | null
costCentre
​string | null
updatedAt
​string | null · date-time

Delete an allocation rule

DELETE
https://api.costfluent.com
/v1/allocation/rules/{ruleId}
Bearer (API token)

Allocation is evaluated at query time, so removing a rule restates every past month immediately.

Needs a token with manageCostAllocation on the workspace.

Delete an allocation rule › path Parameters

ruleId
​AllocationRulePublicId · pattern: ^alr_[A-Za-z0-9_-]{2… · required

Delete an allocation rule › query Parameters

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

Delete an allocation rule › 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 an allocation rule › Responses

No Content

No data returned

Reorder the allocation rule set

POST
https://api.costfluent.com
/v1/allocation/rules/order
Bearer (API token)

Needs a token with manageCostAllocation on the workspace.

Reorder the allocation rule set › Request Body

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

Reorder the allocation rule set › Responses

Success

id
​AllocationRulePublicId · pattern: ^alr_[A-Za-z0-9_-]{2… · required
name
​string · required
priority
​integer · int32 · required
filter
​string · required
costKind
​string · required
segmentId
​SegmentPublicId · pattern: ^seg_[A-Za-z0-9_-]{2… · required
isEnabled
​boolean · required
createdAt
​string · date-time · required
segmentName
​string | null
costCentre
​string | null
updatedAt
​string | null · date-time

Read allocation coverage

GET
https://api.costfluent.com
/v1/allocation/coverage
Bearer (API token)

Needs a token with viewCostAllocation on the workspace.

Read allocation coverage › query Parameters

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

The window's first day, included.

endDate
​string · date · required

The window's last day, included, so March is 2026-03-01 to 2026-03-31. A window covers at most 366 days.

costBasis
​string
Default: ActualCost

Read allocation coverage › Responses

Success

startDate
​string · date · required
endDate
​string · date · required
costBasis
​string · required
​AllocationCoverageCurrency[] · required

List segments

GET
https://api.costfluent.com
/v1/segments
Bearer (API token)

Returns every segment cost can be assigned to in a workspace.

Needs a token with viewCostAllocation on the workspace.

List segments › 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 segments › Responses

Success

​PaginationLinks · required
​SegmentResponse[] · required

Create a segment

POST
https://api.costfluent.com
/v1/segments
Bearer (API token)

Needs a token with manageCostAllocation on the workspace.

Create a segment › 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 a segment › Request Body

workspaceId
​WorkspacePublicId · minLength: 1 · pattern: ^wsp_[A-Za-z0-9_-]{2… · required
​
teamLabel
​string | null
product
​string
costCentre
​string
isShared
​boolean
label
​string | null
​

Create a segment › Responses

Created

id
​SegmentPublicId · pattern: ^seg_[A-Za-z0-9_-]{2… · required
teamLabel
​string · required
product
​string · required
costCentre
​string · required
isShared
​boolean · required
label
​string · required
createdAt
​string · date-time · required
​
teamName
​string | null
​
updatedAt
​string | null · date-time

Update a segment

PUT
https://api.costfluent.com
/v1/segments/{segmentId}
Bearer (API token)

Renames a direct segment, or changes a shared segment's label and split.

Needs a token with manageCostAllocation on the workspace.

Update a segment › path Parameters

segmentId
​SegmentPublicId · pattern: ^seg_[A-Za-z0-9_-]{2… · required

Update a segment › query Parameters

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

Update a segment › 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 a segment › Request Body

​
teamLabel
​string | null
product
​string | null
costCentre
​string | null
label
​string | null
​

Update a segment › Responses

Success

id
​SegmentPublicId · pattern: ^seg_[A-Za-z0-9_-]{2… · required
teamLabel
​string · required
product
​string · required
costCentre
​string · required
isShared
​boolean · required
label
​string · required
createdAt
​string · date-time · required
​
teamName
​string | null
​
updatedAt
​string | null · date-time

Delete a segment

DELETE
https://api.costfluent.com
/v1/segments/{segmentId}
Bearer (API token)

Refused with 409 in_use while any rule still assigns cost to it, any budget measures it, a shared segment's split names it, or a cost report, cost alert or saved filter filters to it.

Needs a token with manageCostAllocation on the workspace.

Delete a segment › path Parameters

segmentId
​SegmentPublicId · pattern: ^seg_[A-Za-z0-9_-]{2… · required

Delete a segment › query Parameters

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

Delete a segment › 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 a segment › Responses

No Content

No data returned

Preview an allocation rule

POST
https://api.costfluent.com
/v1/allocation/rules/preview
Bearer (API token)

Computes what the rule would move without creating it. Allocation is evaluated at query time, so enabling a rule restates history immediately.

Needs a token with viewCostAllocation on the workspace.

Preview an allocation rule › Request Body

workspaceId
​WorkspacePublicId · minLength: 1 · pattern: ^wsp_[A-Za-z0-9_-]{2… · required
startDate
​string · date · required
endDate
​string · date · required
filter
​string · required
segmentId
​SegmentPublicId · minLength: 1 · pattern: ^seg_[A-Za-z0-9_-]{2… · required
priority
​integer · int32

Preview an allocation rule › Responses

Success

billingCurrency
​string · pattern: ^[A-Z]{3}$ · required
movedCost
​string · decimal · pattern: ^-?[0-9]+(\.[0-9]{1,… · required
movedRecordCount
​integer · int64 · required
coverageBefore
​number · double · required
coverageAfter
​number · double · required
​AllocationDryRunSegmentChangeResponse[] · required