Skip to main content
POST
/
segments
Create segment
curl --request POST \
  --url https://api.vantage.sh/v2/segments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "description": "<string>",
  "priority": 123,
  "track_unallocated": false,
  "report_settings": {
    "include_credits": true,
    "include_refunds": true,
    "include_discounts": true,
    "include_tax": true,
    "amortize": true
  },
  "workspace_token": "<string>",
  "filter": "<string>",
  "parent_segment_token": "<string>"
}
'
{
  "token": "fltr_sgmt_a22e3e52e9a93a75",
  "title": "New Segment",
  "parent_segment_token": "fltr_sgmt_7f1af73e92e5e156",
  "description": "I'm a Segment.",
  "track_unallocated": false,
  "priority": 100,
  "filter": "costs.provider = 'aws' AND costs.service = 'Amazon Simple Storage Service'",
  "created_at": "2024-05-14T14:34:24Z",
  "workspace_token": "wrkspc_f75aec7671a72dd3",
  "report_token": null
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json

Create a Segment.

title
string
required

The title of the Segment.

description
string

The description of the Segment.

priority
integer<int32>

The priority of the Segment.

track_unallocated
boolean
default:false

Track Unallocated Costs which are not assigned to any of the created Segments.

report_settings
object

Report settings configurable on top-level Segments.

workspace_token
string

The token of the Workspace to add the Segment to. Ignored if 'segment_token' is set. Required if the API token is associated with multiple Workspaces.

filter
string

The filter query language to apply to the Segment. Additional documentation available at https://docs.vantage.sh/vql.

parent_segment_token
string

The token of the parent Segment this new Segment belongs to. Determines the Workspace the segment is assigned to.

Response

Segment model

token
string
title
string

The title of the Segment.

Example:

"OPEX"

parent_segment_token
string

The token of the parent Segment of this Segment.

description
string

The description of the Segment.

Example:

"Operating expenses"

track_unallocated
boolean

Track Unallocated Costs which are not assigned to any of the created Segments.

Example:

false

report_settings
object

Report settings configurable on top-level Segments.

priority
integer<int32>

Costs are assigned in priority order across all Segments with assigned filters.

Example:

100

filter
string

The filter applied to the Segment. Additional documentation available at https://docs.vantage.sh/vql.

created_at
string

The date and time, in UTC, the Segment was created. ISO 8601 Formatted.

Example:

"2021-07-09T00:00:00Z"

workspace_token
string

The token for the Workspace the Segment is a part of.

report_token
string

The token for the Report the Segment has generated.