X-Service-Quota Header
Every successful API response includes an X-Service-Quota header with your live credit usage, so you can monitor consumption programmatically without extra API calls. If you prefer to get this information via an API, you can use Account Info API, which doesn't consume credits.
Header format
http header
X-Service-Quota: call-usage=5; available=49942; reset=1738279565; overage-allowed=true; overage-enabled=true; overage-value=0; overage-limit=250000;Fields
| Field | Type | Description |
|---|---|---|
call-usage | Integer | Credits consumed by this request |
available | Integer | Credits currently available on your plan |
reset | Timestamp | Unix timestamp of when your credits next reset |
overage-allowed | Boolean | True if overage is allowed on your subscription plan |
overage-enabled | Boolean | True if you have enabled the overage option |
overage-value | Integer | Overage credits consumed so far in this billing cycle |
overage-limit | Integer | Maximum overage credits you can consume in a billing cycle |
Parsing example
The header is a simple semicolon-separated list of key=value pairs:
quota_header = "call-usage=5; available=49942; reset=1738279565; overage-allowed=true;"
quota = {}
for pair in quota_header.split(";"):
pair = pair.strip()
if not pair:
continue
key, value = pair.split("=", 1)
quota[key] = value
print(quota["available"]) # 49942php
$quotaHeader = 'call-usage=5; available=49942; reset=1738279565; overage-allowed=true;';
$quota = [];
foreach (explode(';', $quotaHeader) as $pair) {
$pair = trim($pair);
if ($pair === '') continue;
[$key, $value] = explode('=', $pair, 2);
$quota[$key] = $value;
}
echo $quota['available']; // 49942const quotaHeader = "call-usage=5; available=49942; reset=1738279565; overage-allowed=true;";
const quota = {};
for (const pair of quotaHeader.split(";")) {
const trimmed = pair.trim();
if (!trimmed) continue;
const i = trimmed.indexOf("=");
quota[trimmed.slice(0, i)] = trimmed.slice(i + 1);
}
console.log(quota.available); // 49942package main
import (
"fmt"
"strings"
)
func main() {
quotaHeader := "call-usage=5; available=49942; reset=1738279565; overage-allowed=true;"
quota := map[string]string{}
for _, pair := range strings.Split(quotaHeader, ";") {
pair = strings.TrimSpace(pair)
if pair == "" {
continue
}
key, value, _ := strings.Cut(pair, "=")
quota[key] = value
}
fmt.Println(quota["available"]) // 49942
}import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
String quotaHeader = "call-usage=5; available=49942; reset=1738279565; overage-allowed=true;";
Map<String, String> quota = new HashMap<>();
for (String pair : quotaHeader.split(";")) {
pair = pair.trim();
if (pair.isEmpty()) continue;
String[] kv = pair.split("=", 2);
quota.put(kv[0], kv[1]);
}
System.out.println(quota.get("available")); // 49942
}
}