Get Costs
Returns the same usage as /api/billing/usage priced at the account’s rates, for the window and per interval and meter, before the plan’s included credits and base price: the cost of what was used, not what will be invoiced. Summed over the billing period it is the usage line of the invoice; /api/billing/summary applies the plan’s base price and included credits on top. Money is in integer cents. On a plan that prices no usage, priced is false and every cost is zero.
curl --request GET \
--url https://control.green.us-east-1.aws.prod.archil.com/api/billing/costs \
--header 'Authorization: Bearer <token>'import requests
url = "https://control.green.us-east-1.aws.prod.archil.com/api/billing/costs"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://control.green.us-east-1.aws.prod.archil.com/api/billing/costs', 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://control.green.us-east-1.aws.prod.archil.com/api/billing/costs",
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://control.green.us-east-1.aws.prod.archil.com/api/billing/costs"
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://control.green.us-east-1.aws.prod.archil.com/api/billing/costs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/billing/costs")
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{
"success": true,
"data": {
"granularity": "1d",
"timezone": "<string>",
"currency": "<string>",
"priced": true,
"ratesCentsPerUnit": {},
"window": {
"start": 123,
"end": 123,
"costCents": 123,
"features": {}
},
"intervals": [
{
"start": 123,
"end": 123,
"costCents": 123,
"features": {}
}
],
"billingPeriod": {
"start": 123,
"end": 123
}
}
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}Authorizations
Archil API key, including its key- prefix
Query Parameters
Start of the window, inclusive: an RFC 3339 timestamp, or a YYYY-MM-DD date taken at midnight in timezone. Defaults to seven days (hourly: 24 hours) before end. Not with for.
"2026-10-13"
End of the window, exclusive, in the same forms as start. Defaults to now. Not with for.
"2026-10-20"
A named window relative to now in timezone, instead of start and end. Weeks start on Monday. A window may run past now; the intervals after it are left out.
today, yesterday, this-week, last-week, this-month, last-month Width of each interval. Days are aligned to timezone; hours are UTC.
1d, 1h IANA timezone that day intervals and dates are aligned to.
"America/Los_Angeles"
Was this page helpful?
curl --request GET \
--url https://control.green.us-east-1.aws.prod.archil.com/api/billing/costs \
--header 'Authorization: Bearer <token>'import requests
url = "https://control.green.us-east-1.aws.prod.archil.com/api/billing/costs"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://control.green.us-east-1.aws.prod.archil.com/api/billing/costs', 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://control.green.us-east-1.aws.prod.archil.com/api/billing/costs",
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://control.green.us-east-1.aws.prod.archil.com/api/billing/costs"
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://control.green.us-east-1.aws.prod.archil.com/api/billing/costs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/billing/costs")
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{
"success": true,
"data": {
"granularity": "1d",
"timezone": "<string>",
"currency": "<string>",
"priced": true,
"ratesCentsPerUnit": {},
"window": {
"start": 123,
"end": 123,
"costCents": 123,
"features": {}
},
"intervals": [
{
"start": 123,
"end": 123,
"costCents": 123,
"features": {}
}
],
"billingPeriod": {
"start": 123,
"end": 123
}
}
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}{
"success": false,
"error": "Invalid request parameters",
"code": "<string>"
}