Query SDK estimated spend
curl --request GET \
--url https://api.brello.app/v1/spend \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.brello.app/v1/spend"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.brello.app/v1/spend', 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.brello.app/v1/spend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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.brello.app/v1/spend"
req, _ := http.NewRequest("GET", 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.get("https://api.brello.app/v1/spend")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brello.app/v1/spend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"period": {
"from": "2023-12-25",
"to": "2023-12-25",
"timeZone": "UTC",
"endExclusive": true
},
"environment": "all",
"total": {
"currency": "USD",
"costSource": "sdk_estimate",
"requestCount": "<string>",
"knownEstimatedCostMicros": "<string>",
"estimatedCostMicros": "<string>",
"unpricedRequestCount": "<string>"
},
"groups": [
{
"currency": "USD",
"costSource": "sdk_estimate",
"requestCount": "<string>",
"knownEstimatedCostMicros": "<string>",
"estimatedCostMicros": "<string>",
"unpricedRequestCount": "<string>",
"dimension": "<string>"
}
],
"pagination": {
"limit": 123,
"offset": 123,
"hasMore": true
},
"groupBy": "day"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}Read API
Query spend
Requires spend:read. Filters are intersected. UTC dates use an exclusive end, at most 366 days apart. key groups and sdkKeyId refer to Brello ingestion keys. Retained daily totals are included with date and environment filters and have a null dimension when grouped by anything other than day. Filters by provider, model, key, end user, or feature use retained request details only. This is SDK estimated usage.
Query SDK estimated spend
curl --request GET \
--url https://api.brello.app/v1/spend \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.brello.app/v1/spend"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.brello.app/v1/spend', 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.brello.app/v1/spend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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.brello.app/v1/spend"
req, _ := http.NewRequest("GET", 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.get("https://api.brello.app/v1/spend")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brello.app/v1/spend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"period": {
"from": "2023-12-25",
"to": "2023-12-25",
"timeZone": "UTC",
"endExclusive": true
},
"environment": "all",
"total": {
"currency": "USD",
"costSource": "sdk_estimate",
"requestCount": "<string>",
"knownEstimatedCostMicros": "<string>",
"estimatedCostMicros": "<string>",
"unpricedRequestCount": "<string>"
},
"groups": [
{
"currency": "USD",
"costSource": "sdk_estimate",
"requestCount": "<string>",
"knownEstimatedCostMicros": "<string>",
"estimatedCostMicros": "<string>",
"unpricedRequestCount": "<string>",
"dimension": "<string>"
}
],
"pagination": {
"limit": 123,
"offset": 123,
"hasMore": true
},
"groupBy": "day"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"requestId": "<string>"
}
}Requires
spend:read. Use groupBy to break down spend. The total covers all matching requests, and pagination applies to groups.
See Query usage and reports for filters, units, and unknown costs.Authorizations
Query Parameters
Was this page helpful?