Skip to main content

Admin API Reference

Protected endpoints for tenant and token management. Requires x-admin-key header.

Authentication

The admin key is validated against the SHA-256 hash stored in the ADMIN_API_KEY Wrangler secret.

Tenant Management

GET /admin/tenants/TENANT_ID

Read tenant configuration.

PUT /admin/tenants/TENANT_ID

Create or update tenant configuration.

POST /admin/auth

Register a new tenant bearer token.

Token Management

PUT /admin/tokens/TENANT_ID/PROVIDER/ACCOUNT_ID

Store a token directly.

POST /admin/seed-oauth

Configure a Durable Object with OAuth credentials for automatic token refresh.

Billing

GET /admin/usage/TENANT_ID

Get usage summary for a tenant.

PUT /admin/billing/TENANT_ID

Update billing configuration.

Audit Log

GET /admin/audit

Query KV audit log. Supports filters: tenant, action, source, key, since, limit.

GET /admin/audit/stats

Aggregated audit statistics (24h, 7d, 30d breakdowns).

Agent Schedules

GET /admin/agent-schedules

List all scheduled agent jobs.

PUT /admin/agent-schedules/JOB_ID

Create or update a scheduled agent job.

DELETE /admin/agent-schedules/JOB_ID

Delete a scheduled job.

Daily Brief

GET /admin/daily-brief

Retrieve the latest AI-generated daily GTM intelligence brief.

POST /admin/daily-brief/trigger

Manually trigger a daily brief generation.

System

POST /admin/run-cron

Manually trigger a cron job. Body: {"cron": "*/5 * * * *"}.

GET /admin/system-health

Returns the latest system health snapshot from KV.

POST /admin/replay

Replay a failed request from the error ledger.

Approval Gates

GET /admin/approvals

List pending quality gate approvals.

POST /admin/approvals/APPROVAL_ID/approve

Approve a pending gate.

POST /admin/approvals/APPROVAL_ID/reject

Reject a pending gate with a reason.