Docs/API Reference/Governance Trending

Governance Trending API

Retrieve time-series governance metrics for dashboards and analytics — API calls, scores, PII detections, violations, and latency over configurable time periods.

Endpoint

GET/v1/admin/trendingGet time-series governance data

Authentication

Requires API key authentication. Subject to admin-level rate limiting.

Query Parameters

ParameterTypeDefaultDescription
metricstringcallsMetric to retrieve (see available metrics below)
periodstring30dTime period: 7d, 30d, or 90d

Available Metrics

MetricDescriptionData Points
callsTotal governance API calls over timedate, total, allow, redact, deny
scoresAverage TORKING-X governance scoresdate, average, min, max
piiPII detections by typedate, emails, phones, ssns, credit_cards, other
violationsPolicy violation countsdate, total, by_severity
latencyAPI response latency percentilesdate, p50, p95, p99
use_casesTop use cases by call volumeuse_case, count, percentage
score_distributionDistribution of governance scoresrange, count, percentage

Examples

API Call Trends (30 days)

bash
curl "https://api.tork.network/v1/admin/trending?metric=calls&period=30d" \
  -H "x-tork-api-key: tork_sk_your_api_key"
json
{
  "metric": "calls",
  "period": "30d",
  "data": [
    { "date": "2026-01-14", "total": 1250, "allow": 980, "redact": 210, "deny": 60 },
    { "date": "2026-01-15", "total": 1340, "allow": 1050, "redact": 225, "deny": 65 },
    { "date": "2026-01-16", "total": 1180, "allow": 920, "redact": 195, "deny": 65 }
  ]
}

PII Detection Trends (7 days)

bash
curl "https://api.tork.network/v1/admin/trending?metric=pii&period=7d" \
  -H "x-tork-api-key: tork_sk_your_api_key"
json
{
  "metric": "pii",
  "period": "7d",
  "data": [
    { "date": "2026-02-06", "emails": 45, "phones": 12, "ssns": 3, "credit_cards": 1, "other": 8 },
    { "date": "2026-02-07", "emails": 52, "phones": 15, "ssns": 1, "credit_cards": 0, "other": 11 }
  ]
}

Latency Percentiles (90 days)

bash
curl "https://api.tork.network/v1/admin/trending?metric=latency&period=90d" \
  -H "x-tork-api-key: tork_sk_your_api_key"
json
{
  "metric": "latency",
  "period": "90d",
  "data": [
    { "date": "2026-01-01", "p50": 6, "p95": 18, "p99": 42 },
    { "date": "2026-01-02", "p50": 5, "p95": 16, "p99": 38 }
  ]
}

Error Responses

StatusDescription
400Invalid metric or period value
401Missing or invalid API key
429Rate limit exceeded
500Internal server error