Skip to main content
DELETE
/
segments
/
{segment_token}
Delete segment
curl --request DELETE \
  --url https://api.vantage.sh/v2/segments/{segment_token} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.vantage.sh/v2/segments/{segment_token}"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.text)
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.vantage.sh/v2/segments/{segment_token}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.vantage.sh/v2/segments/{segment_token}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.vantage.sh/v2/segments/{segment_token}"

req, _ := http.NewRequest("DELETE", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.delete("https://api.vantage.sh/v2/segments/{segment_token}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.vantage.sh/v2/segments/{segment_token}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "token": "<string>",
  "title": "OPEX",
  "parent_segment_token": "<string>",
  "description": "Operating expenses",
  "track_unallocated": false,
  "priority": 100,
  "filter": "<string>",
  "created_at": "2021-07-09T00:00:00Z",
  "workspace_token": "<string>",
  "report_token": "<string>",
  "report_settings": {
    "include_credits": true,
    "include_refunds": true,
    "include_discounts": true,
    "include_tax": true,
    "amortize": true
  }
}
{
"errors": [
"<string>"
],
"links": {
"self": "<string>",
"first": "<string>",
"next": "<string>",
"last": "<string>",
"prev": "<string>"
}
}

Authorizations

Authorization
string
header
required

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

Path Parameters

segment_token
string
required

Response

Segment model

token
string
required
title
string
required

The title of the Segment.

Example:

"OPEX"

parent_segment_token
string | null
required

The token of the parent Segment of this Segment.

description
string
required

The description of the Segment.

Example:

"Operating expenses"

track_unallocated
boolean
required

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

Example:

false

priority
integer<int32>
required

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

Example:

100

filter
string | null
required

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

created_at
string
required

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

Example:

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

workspace_token
string
required

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

report_token
string | null
required

The token for the Report the Segment has generated.

report_settings
object

Report settings configurable on top-level Segments.