Get usage
curl --request GET \
--url https://api.datalyr.com/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.datalyr.com/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.datalyr.com/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 => [
"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.datalyr.com/v1/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.datalyr.com/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/usage")
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{
"events_used": 123,
"events_limit": 123,
"postbacks_used": 123,
"postbacks_limit": 123,
"period_start": "<string>",
"period_end": "<string>",
"plan": "<string>",
"complete": true,
"rate_limit": {
"max": 123,
"window_seconds": 60,
"source": "key",
"bucket": "<string>"
},
"api_usage": {
"today": {
"total": 123,
"internal": 123,
"external": 123
},
"last_7_days": [
{
"total": 123,
"internal": 123,
"external": 123,
"date": "<string>"
}
]
}
}Workspace
Get usage
GET
/
usage
Get usage
curl --request GET \
--url https://api.datalyr.com/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.datalyr.com/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.datalyr.com/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 => [
"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.datalyr.com/v1/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.datalyr.com/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/usage")
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{
"events_used": 123,
"events_limit": 123,
"postbacks_used": 123,
"postbacks_limit": 123,
"period_start": "<string>",
"period_end": "<string>",
"plan": "<string>",
"complete": true,
"rate_limit": {
"max": 123,
"window_seconds": 60,
"source": "key",
"bucket": "<string>"
},
"api_usage": {
"today": {
"total": 123,
"internal": 123,
"external": 123
},
"last_7_days": [
{
"total": 123,
"internal": 123,
"external": 123,
"date": "<string>"
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Response
200 - application/json
Successful response.
64-bit count. Serialized as a string when it exceeds the safe integer range.
0 when no plan limit is known.
Billing-period start. Falls back to 30 days ago when the billing provider does not answer, in which case the counts cover that fallback window.
unknown when the billing provider did not answer.
The request budget of the credential that made this call.
Show child attributes
Show child attributes
Requests made against this API. Omitted entirely when the metering store is briefly unreachable — it is never reported as zero, because "you made no calls" and "we could not read the counter" are different answers.
Show child attributes
Show child attributes
Was this page helpful?