JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const accountUsage = await client.accounts.retrieveUsage('acct_01j9a43avnfqzbjfch6pygv1td', {
end_time: '2026-04-09T16:03:00Z',
start_time: '2026-04-09T15:03:00Z',
});
console.log(accountUsage.end_time);import os
from datetime import datetime
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
account_usage = client.accounts.retrieve_usage(
account_id="acct_01j9a43avnfqzbjfch6pygv1td",
end_time=datetime.fromisoformat("2026-04-09T16:03:00"),
start_time=datetime.fromisoformat("2026-04-09T15:03:00"),
)
print(account_usage.end_time)require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
account_usage = surge.accounts.retrieve_usage(
"acct_01j9a43avnfqzbjfch6pygv1td",
end_time: "2026-04-09T16:03:00Z",
start_time: "2026-04-09T15:03:00Z"
)
puts(account_usage)curl --request GET \
--url https://api.surge.app/accounts/{account_id}/usage \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.surge.app/accounts/{account_id}/usage",
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.surge.app/accounts/{account_id}/usage"
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.surge.app/accounts/{account_id}/usage")
.header("Authorization", "Bearer <token>")
.asString();{
"end_time": "2026-04-09T16:03:00Z",
"line_items": [
{
"category": "sms",
"count": 2,
"item": "Inbound SMS Segments",
"total_price": "$2.00",
"unit": "segment",
"unit_price": "$1.00"
}
],
"start_time": "2026-04-09T15:03:00Z",
"total": "$2.00"
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Accounts
Retrieve account usage
Retrieve priced usage for an account within a specified time range.
GET
/
accounts
/
{account_id}
/
usage
JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const accountUsage = await client.accounts.retrieveUsage('acct_01j9a43avnfqzbjfch6pygv1td', {
end_time: '2026-04-09T16:03:00Z',
start_time: '2026-04-09T15:03:00Z',
});
console.log(accountUsage.end_time);import os
from datetime import datetime
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
account_usage = client.accounts.retrieve_usage(
account_id="acct_01j9a43avnfqzbjfch6pygv1td",
end_time=datetime.fromisoformat("2026-04-09T16:03:00"),
start_time=datetime.fromisoformat("2026-04-09T15:03:00"),
)
print(account_usage.end_time)require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
account_usage = surge.accounts.retrieve_usage(
"acct_01j9a43avnfqzbjfch6pygv1td",
end_time: "2026-04-09T16:03:00Z",
start_time: "2026-04-09T15:03:00Z"
)
puts(account_usage)curl --request GET \
--url https://api.surge.app/accounts/{account_id}/usage \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.surge.app/accounts/{account_id}/usage",
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.surge.app/accounts/{account_id}/usage"
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.surge.app/accounts/{account_id}/usage")
.header("Authorization", "Bearer <token>")
.asString();{
"end_time": "2026-04-09T16:03:00Z",
"line_items": [
{
"category": "sms",
"count": 2,
"item": "Inbound SMS Segments",
"total_price": "$2.00",
"unit": "segment",
"unit_price": "$1.00"
}
],
"start_time": "2026-04-09T15:03:00Z",
"total": "$2.00"
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Authorizations
Query Parameters
Response
Priced usage for the window