API Documentation

Integrate risk detection into any application. Send customer text, get back structured risk assessments in under 2 seconds.

Overview

The RiskDetect API analyzes customer interactions (emails, call transcripts, chat messages) and returns a risk assessment with a numerical score, detected signals, summary, recommended action, and urgency level.

All responses are JSON. All endpoints accept POST requests with JSON bodies.

Authentication

API keys are included in the Authorization header:

Authorization: Bearer rd_your_api_key_here

Get your API key from the dashboard settings. The live demo does not require authentication.

Base URL

https://riskdetect.app/api

Analyze Interaction

The primary endpoint. Accepts any customer text and returns a full risk assessment.

POST /api/analyze
{
  "content": "This is my third email about this issue...",
  "type": "email",           // optional: "email", "call_transcript", "chat"
  "subject": "RE: Urgent",   // optional
  "from": "customer@co.com", // optional
  "customerName": "Sarah J"  // optional
}

Request Parameters

ParameterTypeDescription
contentstringrequiredThe customer interaction text to analyze
typestringoptionalInteraction type: email, call_transcript, chat. Auto-detected if omitted.
subjectstringoptionalEmail subject line (provides additional context)
fromstringoptionalSender email or identifier
customerNamestringoptionalCustomer name for personalized recommendations

Response

{
  "analysis": {
    "risk_score": 85,
    "risk_level": "high",
    "signals": [
      "BBB complaint threatened",
      "Legal counsel mentioned",
      "Competitor comparison"
    ],
    "summary": "Customer is highly frustrated...",
    "recommended_action": "Escalate to senior manager...",
    "urgency": "today",
    "category": "email"
  },
  "metadata": {
    "model": "gpt-4o-mini",
    "processingMs": 1842
  }
}

Analyze Email (Legacy)

Backward-compatible endpoint for email-only analysis. Use /api/analyze for new integrations.

POST /api/analyze-email
{ "email": "Customer email body text..." }

Batch Analyze

Analyze up to 50 interactions in a single request. Results are returned sorted by risk score (highest first).

POST /api/batch-analyze
{
  "emails": [
    { "id": "email-001", "content": "First email...", "from": "alice@co.com" },
    { "id": "email-002", "content": "Second email...", "from": "bob@co.com" }
  ]
}

Response includes a results array sorted by risk score, plus summary with counts by level and the highest risk item.

Inbound Email Webhook

Webhook endpoint for email forwarding services (SendGrid Inbound Parse, Cloudflare Email Workers, etc.).

POST /api/inbound-email
// JSON format
{ "text": "Email body...", "subject": "RE: Issue", "from": "customer@co.com" }

// Also accepts SendGrid multipart form data

Risk Levels

LevelScoreDescription
critical80-100Immediate intervention required. Legal threats, formal complaints.
high60-79Respond today. Competitor evaluation, escalation demands.
medium30-59Address this week. Growing frustration, repeat contacts.
low0-29Routine. No significant risk signals detected.

Signal Types

RiskDetect tracks 30+ risk signals across these categories:

  • Legal: Attorney mention, BBB complaint, regulatory threat, contract review
  • Competition: Competitor named, comparison language, switching intent
  • Escalation: Manager request, deadline ultimatum, repeated contact
  • Sentiment: Declining tone, frustration language, all-caps, profanity
  • Behavioral: Usage decline, team downsizing, contract non-renewal
  • Financial: Billing dispute, refund request, overcharge claim

Rate Limits

PlanLimitNotes
Starter100/mo~3/day
Growth1,000/mo~33/day, burst up to 50/hr
ScaleUnlimitedFair use policy, 100/min burst

Rate limit headers included in every response: X-RateLimit-Remaining, X-RateLimit-Reset.