Skip to content
API

REST API reference

Base URL: https://api.denpex.com. All requests require a Bearer token in the Authorization header. See the agent docs for how to create a key, or generate one in your dashboard.

Authentication

# All authenticated requests
Authorization: Bearer dpx_...

Tokens are JWTs issued by the auth worker. They expire 30 days after issue. Rotation is supported by creating a new key and deleting the old one.

Endpoints

POST/api/diagnoseBearer token

Diagnose a training log. Returns root cause, classification, originating rank (if distributed), and the exact fix.

Request
{ logs: string, jobName?: string }
Response
{ success: true, diagnosisTimeMs: number, fix: { summary, action, resumeFrom? }, meta: { failureType, confidence, source, ... } }
GET/api/diagnose/historyBearer token

Recent diagnoses for the authenticated user. Default limit 50.

Response
{ history: Diagnosis[] }
GET/api/diagnose/quotaBearer token

Remaining diagnoses for today. Free plan only; paid plans return unlimited.

Response
{ quota: { remaining, limit, used } }
POST/api/diagnosis/feedbackBearer token

Thumbs-up / thumbs-down feedback on a diagnosis. Confirmed fixes are added to the team knowledge base.

Request
{ id: string, helpful: boolean, comment?: string }
POST/api/ingest/heartbeatBearer token

Agent heartbeat. Reports job status every 30s.

Request
{ jobName, hostname, status, ts }
POST/api/ingest/crashBearer token

Agent crash report. Ships the last 500 log lines on non-zero exit. Mass-crash safe: reports sharing a cluster + failure signature within 5 minutes coalesce into ONE diagnosis — followers return the shared fix with coalesced: true and consume no quota. See Rate limits for details.

Request
{ runId?, jobName, logs, exitCode, meta? }
Response
{ success: true, diagnosisId, coalesced?, crashCount?, fix: { summary, action, fallbackAction?, emergencyAction?, resumeFrom? }, meta: { failureType, confidence } }
GET/api/keysBearer token

List API keys for the authenticated user.

Response
{ keys: ApiKey[] }
POST/api/keysBearer token

Create a new API key. The full key is returned only once.

Request
{ label?: string }
GET/api/jobsBearer token

List jobs the agent has reported heartbeats for.

Response
{ jobs: Job[] }
GET/api/alerts/channelsBearer token

List alert channels for the authenticated user.

Response
{ channels: AlertChannel[] }
POST/api/alerts/channelsBearer token

Add a new alert channel.

Request
{ channelType: 'slack' | 'webhook' | 'sms' | 'pagerduty' | 'email', config: object, enabled?: boolean }
DELETE/api/alerts/channelsBearer token

Remove an alert channel.

Request
{ id: number }
POST/api/billing/checkoutBearer token

Start a Stripe Checkout Session for a paid plan.

Request
{ plan: 'team' | 'scale' }
Response
{ url: string }
GET/api/billing/subscriptionBearer token

Current subscription, including plan, status, and period end.

Response
{ plan, subscription: { id, plan, status, currentPeriodEnd, cancelAtPeriodEnd }, trial: { ... } | null }
POST/api/billing/portalBearer token

Open the Stripe customer portal for self-service plan changes and invoice downloads.

Response
{ url: string }
POST/api/billing/webhookStripe signature

Stripe webhook. Handles checkout.session.completed and customer.subscription.* events.

POST/api/redeemBearer token

Redeem a trial code. Each account may redeem one code.

Request
{ code: string }