curl --request GET \
--url https://api.paywithlocus.com/api/credits/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paywithlocus.com/api/credits/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.paywithlocus.com/api/credits/analytics', 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.paywithlocus.com/api/credits/analytics",
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.paywithlocus.com/api/credits/analytics"
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.paywithlocus.com/api/credits/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paywithlocus.com/api/credits/analytics")
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,
"analytics": {
"days": 7,
"bucket": "hour",
"filter": {
"initiator": {
"type": "oauth_member",
"id": "<string>"
},
"provider": "<string>",
"endpoint": "<string>"
},
"timezone": "UTC",
"periodStart": "2023-11-07T05:31:56Z",
"periodEndExclusive": "2023-11-07T05:31:56Z",
"priorPeriodStart": "2023-11-07T05:31:56Z",
"priorPeriodEndExclusive": "2023-11-07T05:31:56Z",
"summary": {
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
},
"priorSummary": {
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
},
"series": [
{
"start": "2023-11-07T05:31:56Z",
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
}
],
"daily": [
{
"date": "2023-12-25",
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
}
],
"services": [
{
"provider": "<string>",
"endpoint": "<string>",
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1,
"spenders": 1
}
],
"providers": [
{
"provider": "<string>",
"spenders": 123,
"endpoints": 123,
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
}
],
"users": [
{
"externalUserId": "<string>",
"usageUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1
}
],
"initiators": [
{
"type": "oauth_member",
"initiatorId": "<string>",
"label": "<string>",
"authMethod": "<string>",
"clients": [
"<string>"
],
"usageUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 123,
"providers": 123,
"source": "<string>",
"customerId": "<string>",
"name": "<string>",
"url": "<string>",
"adminUrl": "<string>"
}
],
"usageDrift": {
"mode": "shadow",
"attributionCoverageRequired": "<string>",
"currentWindowDays": 123,
"baselineWindowDays": 123,
"collecting": 1,
"active": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feature": "<string>",
"appVersion": "<string>",
"status": "SHADOW",
"severity": "INFO",
"mode": "shadow",
"coverageRatio": "<string>",
"baselineSamples": 1,
"currentSamples": 1,
"requiredSamples": 1,
"baseline": {},
"current": {},
"percentageChange": "<string>",
"adjustedPValue": "<string>",
"contributors": {},
"lastEvaluatedAt": "2023-11-07T05:31:56Z",
"ledgerFilterPath": "<string>",
"informational": true,
"firstSeenAt": "2023-11-07T05:31:56Z",
"detectedAt": "2023-11-07T05:31:56Z",
"resolvedAt": "2023-11-07T05:31:56Z"
}
],
"recentResolved": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feature": "<string>",
"appVersion": "<string>",
"status": "SHADOW",
"severity": "INFO",
"mode": "shadow",
"coverageRatio": "<string>",
"baselineSamples": 1,
"currentSamples": 1,
"requiredSamples": 1,
"baseline": {},
"current": {},
"percentageChange": "<string>",
"adjustedPValue": "<string>",
"contributors": {},
"lastEvaluatedAt": "2023-11-07T05:31:56Z",
"ledgerFilterPath": "<string>",
"informational": true,
"firstSeenAt": "2023-11-07T05:31:56Z",
"detectedAt": "2023-11-07T05:31:56Z",
"resolvedAt": "2023-11-07T05:31:56Z"
}
]
},
"customerSources": [
{
"source": "<string>",
"customers": 123,
"usageUsdc": "<string>",
"calls": 123
}
]
}
}Tenant usage analytics
Exact database rollups over captured BURN debits. Accepts either the legacy days=7|30|90 form or an explicit half-open from/to window, optionally bucketed and narrowed to one spender and/or one provider. The prior comparison covers the same elapsed span as the current period, including today’s partial UTC day, and is narrowed by the same filter so deltas stay like-for-like; top-ups, allocations, refunds, and open reservations are excluded. usageDrift is null when the optional detector read is temporarily unavailable.
curl --request GET \
--url https://api.paywithlocus.com/api/credits/analytics \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paywithlocus.com/api/credits/analytics"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.paywithlocus.com/api/credits/analytics', 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.paywithlocus.com/api/credits/analytics",
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.paywithlocus.com/api/credits/analytics"
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.paywithlocus.com/api/credits/analytics")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paywithlocus.com/api/credits/analytics")
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,
"analytics": {
"days": 7,
"bucket": "hour",
"filter": {
"initiator": {
"type": "oauth_member",
"id": "<string>"
},
"provider": "<string>",
"endpoint": "<string>"
},
"timezone": "UTC",
"periodStart": "2023-11-07T05:31:56Z",
"periodEndExclusive": "2023-11-07T05:31:56Z",
"priorPeriodStart": "2023-11-07T05:31:56Z",
"priorPeriodEndExclusive": "2023-11-07T05:31:56Z",
"summary": {
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
},
"priorSummary": {
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
},
"series": [
{
"start": "2023-11-07T05:31:56Z",
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
}
],
"daily": [
{
"date": "2023-12-25",
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
}
],
"services": [
{
"provider": "<string>",
"endpoint": "<string>",
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1,
"spenders": 1
}
],
"providers": [
{
"provider": "<string>",
"spenders": 123,
"endpoints": 123,
"usageUsdc": "<string>",
"baseUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1,
"activeUsers": 1
}
],
"users": [
{
"externalUserId": "<string>",
"usageUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 1
}
],
"initiators": [
{
"type": "oauth_member",
"initiatorId": "<string>",
"label": "<string>",
"authMethod": "<string>",
"clients": [
"<string>"
],
"usageUsdc": "<string>",
"marginUsdc": "<string>",
"calls": 123,
"providers": 123,
"source": "<string>",
"customerId": "<string>",
"name": "<string>",
"url": "<string>",
"adminUrl": "<string>"
}
],
"usageDrift": {
"mode": "shadow",
"attributionCoverageRequired": "<string>",
"currentWindowDays": 123,
"baselineWindowDays": 123,
"collecting": 1,
"active": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feature": "<string>",
"appVersion": "<string>",
"status": "SHADOW",
"severity": "INFO",
"mode": "shadow",
"coverageRatio": "<string>",
"baselineSamples": 1,
"currentSamples": 1,
"requiredSamples": 1,
"baseline": {},
"current": {},
"percentageChange": "<string>",
"adjustedPValue": "<string>",
"contributors": {},
"lastEvaluatedAt": "2023-11-07T05:31:56Z",
"ledgerFilterPath": "<string>",
"informational": true,
"firstSeenAt": "2023-11-07T05:31:56Z",
"detectedAt": "2023-11-07T05:31:56Z",
"resolvedAt": "2023-11-07T05:31:56Z"
}
],
"recentResolved": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"feature": "<string>",
"appVersion": "<string>",
"status": "SHADOW",
"severity": "INFO",
"mode": "shadow",
"coverageRatio": "<string>",
"baselineSamples": 1,
"currentSamples": 1,
"requiredSamples": 1,
"baseline": {},
"current": {},
"percentageChange": "<string>",
"adjustedPValue": "<string>",
"contributors": {},
"lastEvaluatedAt": "2023-11-07T05:31:56Z",
"ledgerFilterPath": "<string>",
"informational": true,
"firstSeenAt": "2023-11-07T05:31:56Z",
"detectedAt": "2023-11-07T05:31:56Z",
"resolvedAt": "2023-11-07T05:31:56Z"
}
]
},
"customerSources": [
{
"source": "<string>",
"customers": 123,
"usageUsdc": "<string>",
"calls": 123
}
]
}
}Authorizations
Query Parameters
Spender reference :, where type is one of oauth_member, end_user, agent_connection, customer, credential, unattributed. The id is the identity analytics ranks by (external user id, Cognito sub, agent-connection id, API key id, or for a customer /, where an id without a slash means no source); unattributed takes no id.