curl --request GET \
--url https://gateway.prem.io/analytics/api_keys \
--header 'Authorization: <api-key>'import requests
url = "https://gateway.prem.io/analytics/api_keys"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://gateway.prem.io/analytics/api_keys', 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://gateway.prem.io/analytics/api_keys",
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: <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://gateway.prem.io/analytics/api_keys"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<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://gateway.prem.io/analytics/api_keys")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.prem.io/analytics/api_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": 200,
"data": {
"core_metrics": {
"total_requests": 4,
"requests_per_second": 0,
"total_success": 3,
"total_errors": 1,
"success_rate_pct": 75,
"avg_latency_ms": 67.5,
"pct_under_100ms": 100,
"pct_under_500ms": 100,
"pct_under_1s": 100,
"unique_endpoints": 1,
"distinct_api_keys": 2
},
"prev_core_metrics": {
"total_requests": 10,
"requests_per_second": 2,
"total_success": 8,
"total_errors": 2,
"success_rate_pct": 80,
"avg_latency_ms": 120,
"pct_under_100ms": 70,
"pct_under_500ms": 90,
"pct_under_1s": 95,
"unique_endpoints": 3,
"distinct_api_keys": 4
},
"most_used_api_keys": [
{
"auth": "Test auth",
"usage_count": 3
}
],
"ip_metrics": [
{
"ip": "343.221.232.123",
"total_requests": 3,
"total_errors": 1,
"error_rate": 33.33
},
{
"ip": "234.122.99.012",
"total_requests": 1,
"total_errors": 0,
"error_rate": 0
}
],
"hourly_metrics": [
{
"hour": "2025-07-30 15:00:00",
"total_requests": 3,
"error_count": 1,
"error_rate_pct": 33.33,
"avg_latency_ms": 71.33
},
{
"hour": "2025-07-31 15:00:00",
"total_requests": 1,
"error_count": 0,
"error_rate_pct": 0,
"avg_latency_ms": 56
}
],
"api_key_metrics_30d": [
{
"api_key_id": null,
"total_requests": 4
}
],
"latency_breakdown": {
"total_requests": 500,
"less_than_100ms": 233,
"less_than_500ms": 100,
"less_than_1s": 50,
"more_than_1s": 2
},
"latency": {
"min": 0,
"max": 0,
"avg": 0,
"p50": 0,
"p90": 0,
"p95": 0,
"p99": 0
}
},
"error": null,
"log": null,
"validator": null,
"support_id": null,
"message": null,
"env": "development"
}{
"status": 401,
"error": "<string>",
"message": null,
"log": "<string>",
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {},
"validator": {}
}{
"status": 403,
"error": "<string>",
"message": null,
"log": "<string>",
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {},
"validator": {}
}Get API key analytics
Get analytics data for API key usage
curl --request GET \
--url https://gateway.prem.io/analytics/api_keys \
--header 'Authorization: <api-key>'import requests
url = "https://gateway.prem.io/analytics/api_keys"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://gateway.prem.io/analytics/api_keys', 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://gateway.prem.io/analytics/api_keys",
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: <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://gateway.prem.io/analytics/api_keys"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<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://gateway.prem.io/analytics/api_keys")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.prem.io/analytics/api_keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": 200,
"data": {
"core_metrics": {
"total_requests": 4,
"requests_per_second": 0,
"total_success": 3,
"total_errors": 1,
"success_rate_pct": 75,
"avg_latency_ms": 67.5,
"pct_under_100ms": 100,
"pct_under_500ms": 100,
"pct_under_1s": 100,
"unique_endpoints": 1,
"distinct_api_keys": 2
},
"prev_core_metrics": {
"total_requests": 10,
"requests_per_second": 2,
"total_success": 8,
"total_errors": 2,
"success_rate_pct": 80,
"avg_latency_ms": 120,
"pct_under_100ms": 70,
"pct_under_500ms": 90,
"pct_under_1s": 95,
"unique_endpoints": 3,
"distinct_api_keys": 4
},
"most_used_api_keys": [
{
"auth": "Test auth",
"usage_count": 3
}
],
"ip_metrics": [
{
"ip": "343.221.232.123",
"total_requests": 3,
"total_errors": 1,
"error_rate": 33.33
},
{
"ip": "234.122.99.012",
"total_requests": 1,
"total_errors": 0,
"error_rate": 0
}
],
"hourly_metrics": [
{
"hour": "2025-07-30 15:00:00",
"total_requests": 3,
"error_count": 1,
"error_rate_pct": 33.33,
"avg_latency_ms": 71.33
},
{
"hour": "2025-07-31 15:00:00",
"total_requests": 1,
"error_count": 0,
"error_rate_pct": 0,
"avg_latency_ms": 56
}
],
"api_key_metrics_30d": [
{
"api_key_id": null,
"total_requests": 4
}
],
"latency_breakdown": {
"total_requests": 500,
"less_than_100ms": 233,
"less_than_500ms": 100,
"less_than_1s": 50,
"more_than_1s": 2
},
"latency": {
"min": 0,
"max": 0,
"avg": 0,
"p50": 0,
"p90": 0,
"p95": 0,
"p99": 0
}
},
"error": null,
"log": null,
"validator": null,
"support_id": null,
"message": null,
"env": "development"
}{
"status": 401,
"error": "<string>",
"message": null,
"log": "<string>",
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {},
"validator": {}
}{
"status": 403,
"error": "<string>",
"message": null,
"log": "<string>",
"support_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {},
"validator": {}
}Authorizations
Send your access token as header Authorization: Bearer {accessToken}
Your API key that starts with sk_live or sk_test. You can create yours at go.prem.io/api-keys.
Response
Successful API key analytics response
Status code of the response
200, 201, 202 Response data containing the requested object
Show child attributes
Show child attributes
Message of the response, human readable
"Resource created successfully"
API environment
development, production Error message of the response, human readable
"Invalid email address"
Useful informaiton, not always present, to debug the response
{ "request_id": "req_1234567890" }
"Some pertinent log message"
Validator response object, each key is the field name and value is the error message
{
"email": "Invalid email address",
"password": "Password is required"
}
Support ID linked to the response, used to identify it when talking with our team
"support_uuidv7-something-else"

