KEYSENTRY AI

Reports API reference

Read-only access to your organization’s credential, spend, security and audit data, for Power BI, Tableau, spreadsheets and scripts.

Basics

Base URL: https://www.getkeysentry.com

Authentication: create an API key in KeySentry under Settings, API & Webhooks, and send it as a Bearer token.

curl -H "Authorization: Bearer kf_live_..." "https://www.getkeysentry.com/api/v1/reports/credentials?format=csv"

Keys with read-only scopes (reports:read, audit:read) may instead pass api_key= in the query string. That exists for Power BI’s Web API credential; prefer the header everywhere else, because URLs can end up in logs.

ScopeGrants
reports:readAll /api/v1/reports endpoints
audit:read/api/v1/audit/events
cli:vault, cli:scanThe KeySentry CLI (not the Reports API)
webhooks:manage/api/v1/hooks (instant triggers for Zapier and similar tools)
usage:writePOST /api/v1/usage (push spend, register custom platforms)

Paging: limit (1 to 5,000, default 1,000) and cursor. JSON responses include nextCursor (null on the last page); CSV responses send it in the x-next-cursor header.

Format: format=json (default, rows in data) or format=csv. Times are ISO 8601 in UTC.

Limits and errors: 120 requests per minute per key. 400 invalid parameters, 401 missing, invalid or expired key, 403 missing scope or IP not allowed, 429 rate limit.

Endpoints

GET/api/v1/reports/credentialsreports:read

One row per credential. Metadata only; key values are never returned.

Columns:

idnameplatformenvironmentstatusteamcost_centerauto_rotaterotation_daysrotation_dueexpires_atcreated_at
GET/api/v1/reports/gateway-usage-dailyreports:read

Gateway traffic per UTC day, provider, model, team, cost center and user.

Filters: from, to: YYYY-MM-DD (default: last 31 days; at most 366 days)

Columns:

dayprovidermodelteamcost_centeruser_emailrequestsinput_tokensoutput_tokenscost_usd
GET/api/v1/reports/spend-monthlyreports:read

Spend per month and platform, captured nightly from live connectors or manual entries. The current month updates daily.

Filters: from, to: YYYY-MM (default: last 12 months)

Columns:

monthplatformspend_usdtokensrequestsbudget_usdbudget_used_pctsourcecaptured_at
GET/api/v1/reports/rotation-schedulereports:read

Rotation and expiry status per credential, as day counts so you can apply your own thresholds.

Columns:

idnameplatformenvironmentstatusteamcost_centerauto_rotaterotation_daysrotation_duedays_until_dueexpires_atdays_until_expiry
GET/api/v1/reports/anomaliesreports:read

Anomaly alerts from KeySentry's detectors.

Filters: from, to: YYYY-MM-DD (default: last 90 days)

Columns:

idcreated_atdetectorsubjectmetricseveritycurrent_valuebaseline_meanz_scoredismisseddismissed_bywindow_startwindow_endmessage
GET/api/v1/reports/darkweb-findingsreports:read

Dark Web findings: leaked keys and breach exposures.

Filters: from, to: YYYY-MM-DD (default: last 366 days)

Columns:

iddiscovered_attypeplatformsubjectseveritystatusmatch_typematched_credential_idsourcesource_urlpassword_exposedauto_remediatedremediated_at

Privacy: for breach exposures, subject is the email domain only, never the person's address. For leaked keys, subject is the stored masked prefix.

GET/api/v1/reports/federation-trustsreports:read

Federation trusts with health score and open issues.

Columns:

idnameprovidertrust_typecloudstatushealth_scoreissue_countissueslast_token_exchangetoken_exchangesscopescreated_at
GET/api/v1/audit/eventsaudit:read

Audit log entries, newest first, with actor email and credential name.

Filters: from, to: YYYY-MM-DD (default: last 30 days; at most 366 days); action: prefix filter, e.g. security. or credential.

Columns:

idcreated_atactionactor_emailcredential_idcredential_namemetadata

Power BI

1. In KeySentry, create a key with the Reporting purpose.

2. In Power BI Desktop: Get data, Blank query, Advanced editor, and paste:

let Source = Json.Document(Web.Contents("https://www.getkeysentry.com/api/v1/reports/gateway-usage-daily", [ApiKeyName = "api_key"])), Rows = Table.FromRecords(Source[data]) in Rows

3. When asked for credentials, choose Web API and paste the key. The key is stored in Power BI’s credential store, never in the query, and scheduled refresh works in the Power BI service without a gateway.

4. Repeat with other endpoints (for example spend-monthly, credentials) and relate them on platform, team or cost_center.

Tableau

Use Tableau’s REST API Connector from Tableau Exchange (Tableau 2023.3 or later; it creates extracts).

URL: https://www.getkeysentry.com/api/v1/reports/credentials?format=csv (or any endpoint above). Authentication: Bearer token, with your Reporting key.

Usage ingestion

Push monthly spend for any AI vendor, including ones KeySentry has no connector for. Requires a key with the usage:write scope (Settings, API keys, purpose “Usage ingestion”).

POST https://www.getkeysentry.com/api/v1/usage Authorization: Bearer kf_live_... Content-Type: application/json { "entries": [ { "platform": "cohere", "platformName": "Cohere", "month": "2026-10", "spend": 412.50, "tokens": 18200000, "requests": 9100 }, { "platform": "openai", "month": "2026-09", "spend": 1650, "budget": 2500 } ] }

Rules: up to 100 entries per request; month defaults to the current month and may go back 36 months; each entry replaces the value for that platform and month. If any entry is invalid, nothing is saved and the response lists the problems.

Custom platforms: any platform other than anthropic, openai, aws-bedrock, google-ai or azure-openai is registered for your organization on first use (up to 20), using platformName and optional color (#rrggbb). It then appears in Usage & Spend, the spend history and the spend-monthly report.

Note: for a built-in platform with a live billing connector, the live figure is shown for the current month; pushed values still fill the history.

Webhooks

Add endpoints in KeySentry under Settings, API & Webhooks. Each endpoint chooses its events and gets its own signing secret (whsec_...), shown once.

Headers: X-KeySentry-Event, X-KeySentry-Delivery (unique per attempt series), X-KeySentry-Timestamp (Unix seconds), X-KeySentry-Signature.

Payload:

{ "id": "evt uuid", "event": "credential.rotated", "timestamp": "2026-10-29T22:08:08Z", "organization": "org_...", "data": { ... } }

Signature: t=<unix>,v1=<hex>, where v1 is HMAC-SHA256 of <t>.<raw body> with your secret. Verify against the raw request body, before parsing it, and reject timestamps older than 5 minutes.

Node.js:

import crypto from "crypto"; function verify(rawBody, header, secret, tolerance = 300) { const parts = Object.fromEntries(header.split(",").map(p => p.split("="))); const t = Number(parts.t); if (!t || Math.abs(Date.now() / 1000 - t) > tolerance) return false; const expected = crypto.createHmac("sha256", secret).update(t + "." + rawBody).digest("hex"); const got = parts.v1 || ""; return got.length === expected.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(got)); }

Python:

import hmac, hashlib, time def verify(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool: parts = dict(p.split("=", 1) for p in header.split(",")) t = int(parts.get("t", "0")) if abs(time.time() - t) > tolerance: return False expected = hmac.new(secret.encode(), str(t).encode() + b"." + raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, parts.get("v1", ""))

Delivery: respond with any 2xx within 5 seconds. Failures retry after 1 minute, 5 minutes, 30 minutes, 2 hours and 12 hours; after 20 consecutive failures the endpoint is disabled and admins are emailed. Use id to ignore duplicates. Only public HTTPS URLs are accepted.

Events:

credential.createdcredential.deletedcredential.rotatedcredential.expiringscan.findingscan.auto_rotateddarkweb.findinganomaly.detectedspend.threshold_warningspend.budget_exceededspend.platform_lockedspend.lock_liftedsecurity.emergency_rotationsecurity.sessions_revokedsecurity.reveals_suspendedsecurity.platform_revocationsecurity.break_glass_usedapi_key.expiringwebhook.testagent.anomaly (soon)agent.suspended (soon)agent.resumed (soon)

Key hygiene

Give each integration its own key with only the scopes it needs. Set an expiry; owners and admins get reminders 14 and 3 days before a key expires. Add allowed IP ranges for fixed servers. Revoke keys you no longer use; revoked keys stop working immediately.

Questions: support@getkeysentry.com