Skip to main content

Introduction

The DispatchAI API provides real-time emergency call processing, transcription, risk analysis, and dispatch queue management. The API is built with FastAPI and supports both HTTP REST endpoints and WebSocket connections for live audio streaming.

Base URL

http://localhost:8000

Authentication

Currently, the API is designed for internal use and does not require authentication headers. External integrations with Telnyx and Deepgram use API keys stored as environment variables.

Required Environment Variables

TELNYX_API_KEY
string
required
API key for Telnyx telephony service
DEEPGRAM_API_KEY
string
required
API key for Deepgram speech-to-text service
WS_PUBLIC_URL
string
required
Public WebSocket URL for audio streaming (e.g., wss://your-domain.com/ws)
APP_ENV
string
default:"dev"
Application environment (dev or prod)

Response Format

All API responses are JSON-formatted. The API uses standard HTTP status codes:
  • 200 - Success
  • 404 - Resource not found
  • 400 - Bad request
  • 500 - Internal server error

Core Concepts

Call Lifecycle

  1. Incoming Call: Telnyx webhook triggers POST /api/v1/call/incoming
  2. Call Initiated: System answers call and starts audio streaming
  3. Live Processing: Audio streams via WebSocket, real-time transcription
  4. Call Hangup: Final analysis generates risk assessment and queue item
  5. Dispatch Queue: Call appears in queue for dispatcher action

Risk Levels

Calls are automatically classified into risk levels:
  • CRITICAL - Immediate life-threatening emergency
  • ELEVATED - Serious but not immediately life-threatening
  • NORMAL - Standard emergency response needed
  • LOW - Non-urgent or informational

Queue Status

Queue items progress through the following statuses:
  • OPEN - New call awaiting dispatcher review
  • IN_PROGRESS - Dispatcher is handling the call
  • DISPATCHED - Emergency services dispatched
  • RESOLVED - Call handled and closed
  • CANCELLED - Call cancelled or invalid

Service Categories

Calls are classified into emergency service types:
  • EMS - Emergency Medical Services
  • FIRE - Fire department
  • POLICE - Law enforcement
  • OTHER - Other services or unclear

Rate Limits

No rate limiting is currently implemented. This is an internal API designed for real-time emergency call processing.

Webhooks

DispatchAI receives webhooks from Telnyx for telephony events. See the Webhooks documentation for details.

WebSocket Protocol

For real-time audio streaming, DispatchAI uses a WebSocket endpoint that accepts audio data from Telnyx. See the WebSocket documentation for the protocol specification.

Build docs developers (and LLMs) love