Get credit usage over a date range
curl --request GET \
--url https://api.fetchin.io/api/v1/usage \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.fetchin.io/api/v1/usage"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.fetchin.io/api/v1/usage', 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.fetchin.io/api/v1/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 => [
"X-API-Key: <api-key>"
],
]);
$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.fetchin.io/api/v1/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
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.fetchin.io/api/v1/usage")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fetchin.io/api/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"from": "2026-10-01",
"to": "2026-10-03",
"creditsRemaining": 684230,
"subscriptionCreditsRemaining": 184230,
"paygCreditsRemaining": 500000,
"requests": 30482,
"billableRequests": 30214,
"creditsUsed": 32154,
"endpoints": [
{
"endpoint": "/api/v1/profile",
"requests": 28377,
"billableRequests": 28154,
"creditsUsed": 28154,
"statusCodes": { "200": 26401, "404": 1753, "429": 211, "503": 12 }
},
{
"endpoint": "/api/v1/post/engagement",
"requests": 2105,
"billableRequests": 2060,
"creditsUsed": 4000,
"statusCodes": { "200": 1940, "404": 120, "429": 45 }
}
],
"days": [
{ "date": "2026-10-01", "requests": 9850, "billableRequests": 9771, "creditsUsed": 10411 },
{ "date": "2026-10-02", "requests": 10412, "billableRequests": 10305, "creditsUsed": 10978 },
{ "date": "2026-10-03", "requests": 10220, "billableRequests": 10138, "creditsUsed": 10765 }
]
}
{
"error": "from must be on or before to.",
"code": "INVALID_PARAMETER"
}
{
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}
{
"error": "Service temporarily unable to serve this request. Please retry.",
"code": "SERVICE_UNAVAILABLE"
}
Account
Get Usage
Your current balance and the credits you used over a date range, per endpoint and per day
GET
/
api
/
v1
/
usage
Get credit usage over a date range
curl --request GET \
--url https://api.fetchin.io/api/v1/usage \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.fetchin.io/api/v1/usage"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.fetchin.io/api/v1/usage', 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.fetchin.io/api/v1/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 => [
"X-API-Key: <api-key>"
],
]);
$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.fetchin.io/api/v1/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
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.fetchin.io/api/v1/usage")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fetchin.io/api/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"from": "2026-10-01",
"to": "2026-10-03",
"creditsRemaining": 684230,
"subscriptionCreditsRemaining": 184230,
"paygCreditsRemaining": 500000,
"requests": 30482,
"billableRequests": 30214,
"creditsUsed": 32154,
"endpoints": [
{
"endpoint": "/api/v1/profile",
"requests": 28377,
"billableRequests": 28154,
"creditsUsed": 28154,
"statusCodes": { "200": 26401, "404": 1753, "429": 211, "503": 12 }
},
{
"endpoint": "/api/v1/post/engagement",
"requests": 2105,
"billableRequests": 2060,
"creditsUsed": 4000,
"statusCodes": { "200": 1940, "404": 120, "429": 45 }
}
],
"days": [
{ "date": "2026-10-01", "requests": 9850, "billableRequests": 9771, "creditsUsed": 10411 },
{ "date": "2026-10-02", "requests": 10412, "billableRequests": 10305, "creditsUsed": 10978 },
{ "date": "2026-10-03", "requests": 10220, "billableRequests": 10138, "creditsUsed": 10765 }
]
}
{
"error": "from must be on or before to.",
"code": "INVALID_PARAMETER"
}
{
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}
{
"error": "Service temporarily unable to serve this request. Please retry.",
"code": "SERVICE_UNAVAILABLE"
}
Endpoint
GET /api/v1/usage
Authentication
Include your API key in the request header:X-API-Key: your-api-key-here
Parameters
First day of the range,
YYYY-MM-DD, included. Days are UTC calendar days.
Defaults to the first day of the current month.Last day of the range,
YYYY-MM-DD, included: the whole UTC day is counted.
Defaults to today. A range covers at most 366 days.Response
Your balance now, whatever the range: everything you can still spend, plan
allowance plus pay-as-you-go credits. Same figure as on
GET /api/v1/subscription.Every request made with your API keys over the range, whatever its outcome,
refusals (
402, 429) and errors included.The requests that cost credits: a delivered response, or a
404 for a record that
does not exist. See What is billed.Credits those billable requests used. Higher than
billableRequests when you
called endpoints that cost more than one credit.The same three figures per endpoint, busiest first, with the requests split by
HTTP status.
Example Request
curl -X GET "https://api.fetchin.io/api/v1/usage?from=2026-10-01&to=2026-10-31" \
-H "X-API-Key: your-api-key-here"
const params = new URLSearchParams({ from: '2026-10-01', to: '2026-10-31' });
const response = await fetch(
`https://api.fetchin.io/api/v1/usage?${params}`,
{
headers: {
'X-API-Key': 'your-api-key-here'
}
}
);
const usage = await response.json();
console.log(usage.creditsUsed, usage.creditsRemaining);
import requests
response = requests.get(
'https://api.fetchin.io/api/v1/usage',
headers={'X-API-Key': 'your-api-key-here'},
params={'from': '2026-10-01', 'to': '2026-10-31'}
)
usage = response.json()
print(usage['creditsUsed'], usage['creditsRemaining'])
<?php
$apiKey = 'your-api-key-here';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.fetchin.io/api/v1/usage?from=2026-10-01&to=2026-10-31");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
$usage = json_decode($response, true);
curl_close($ch);
print_r($usage);
?>
Example Response
{
"from": "2026-10-01",
"to": "2026-10-03",
"creditsRemaining": 684230,
"subscriptionCreditsRemaining": 184230,
"paygCreditsRemaining": 500000,
"requests": 30482,
"billableRequests": 30214,
"creditsUsed": 32154,
"endpoints": [
{
"endpoint": "/api/v1/profile",
"requests": 28377,
"billableRequests": 28154,
"creditsUsed": 28154,
"statusCodes": { "200": 26401, "404": 1753, "429": 211, "503": 12 }
},
{
"endpoint": "/api/v1/post/engagement",
"requests": 2105,
"billableRequests": 2060,
"creditsUsed": 4000,
"statusCodes": { "200": 1940, "404": 120, "429": 45 }
}
],
"days": [
{ "date": "2026-10-01", "requests": 9850, "billableRequests": 9771, "creditsUsed": 10411 },
{ "date": "2026-10-02", "requests": 10412, "billableRequests": 10305, "creditsUsed": 10978 },
{ "date": "2026-10-03", "requests": 10220, "billableRequests": 10138, "creditsUsed": 10765 }
]
}
{
"error": "from must be on or before to.",
"code": "INVALID_PARAMETER"
}
{
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}
{
"error": "Service temporarily unable to serve this request. Please retry.",
"code": "SERVICE_UNAVAILABLE"
}
Errors
See Error Handling for the full list of error codes and recommended handling.400INVALID_PARAMETER— a date that is notYYYY-MM-DD,fromafterto, or more than 366 days401UNAUTHENTICATED/INVALID_API_KEY429RATE_LIMITED500INTERNAL_ERROR503SERVICE_UNAVAILABLE
Notes
This endpoint is free: it does not consume credits, and it answers even when
you are out of credits. Calls to it and to
GET /api/v1/subscription are left out
of the figures it reports, so checking your consumption never adds to it.Like
/subscription, it runs on its own budget of 1 request per second per
account, separate from your plan’s rate limit and from /subscription’s: it
returns X-RateLimit-Cost: 0 and never spends plan throughput. See
Rate Limits.Today’s figures are live: a request shows up within about a minute. To follow a
month as it goes, call this endpoint without parameters — it defaults to the
current month to date. Consumption is recorded from 16 July 2026; earlier days
report
0.Query Parameters
Response
Current balance and consumption over the range