Skip to main content
GET
/
api
/
v1
/
keys
/
{keyId}
/
usage
Fetch from logged-in browser
// Session-cookie auth — make sure you're logged in to socdefenders.ai
const r = await fetch('/api/v1/keys/<uuid>/usage?days=30', { credentials: 'include' });
const { data } = await r.json();
console.log(`p95 latency: ${data.latency_p95_ms}ms`);
console.log(`Daily peak: ${data.rate_limit_peak_per_day} requests`);
curl --request GET \
--url https://socdefenders.ai/api/v1/keys/{keyId}/usage \
--cookie sb-access-token=
import requests

url = "https://socdefenders.ai/api/v1/keys/{keyId}/usage"

headers = {"cookie": "sb-access-token="}

response = requests.get(url, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://socdefenders.ai/api/v1/keys/{keyId}/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_COOKIE => "sb-access-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://socdefenders.ai/api/v1/keys/{keyId}/usage"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("cookie", "sb-access-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://socdefenders.ai/api/v1/keys/{keyId}/usage")
.header("cookie", "sb-access-token=")
.asString();
require 'uri'
require 'net/http'

url = URI("https://socdefenders.ai/api/v1/keys/{keyId}/usage")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["cookie"] = 'sb-access-token='

response = http.request(request)
puts response.read_body
{
  "data": {
    "key_id": "00000000-0000-4000-8000-000000000123",
    "window_days": 30,
    "total_requests": 142587,
    "successful": 139214,
    "client_errors": 3128,
    "server_errors": 245,
    "success_rate": 0.9763,
    "avg_response_time_ms": 287,
    "latency_p50_ms": 195,
    "latency_p95_ms": 612,
    "latency_p99_ms": 1240,
    "rate_limit_peak_per_minute": 87,
    "rate_limit_peak_per_day": 8430,
    "top_endpoints": [
      {
        "path": "/api/v1/articles",
        "count": 89234
      },
      {
        "path": "/api/v1/iocs",
        "count": 38765
      },
      {
        "path": "/api/v1/lookup",
        "count": 14588
      }
    ],
    "by_status": {
      "200": 139214,
      "400": 1245,
      "401": 12,
      "403": 89,
      "404": 1576,
      "429": 206,
      "500": 245
    },
    "daily": [
      {
        "date": "2026-05-16",
        "requests": 4823,
        "errors": 67
      },
      {
        "date": "2026-05-15",
        "requests": 5102,
        "errors": 89
      }
    ],
    "rate_limit_hits_by_hour": [
      {
        "hour": "2026-05-16T14:00:00Z",
        "count": 12
      }
    ]
  }
}
{
"error": {
"code": "missing_api_key",
"message": "API key is required. Include it in the Authorization header as \"Bearer sk_live_...\"",
"request_id": "req_abc123"
}
}
{
"error": {
"code": "not_found",
"message": "The requested resource was not found",
"request_id": "req_abc123"
}
}

Authorizations

sb-access-token
string
cookie
required

Session cookie (for API key management endpoints)

Path Parameters

keyId
string<uuid>
required

API key ID (UUID from the list endpoint)

Example:

"00000000-0000-4000-8000-000000000123"

Query Parameters

days
integer
default:7

Lookback window in days (1–90). The time-series in the response has one bucket per day.

Required range: 1 <= x <= 90
Example:

30

Response

Usage statistics for the requested key

data
object