Real-Time Integration
The Deadlock Draft API provides real-time draft data via WebSockets, ideal for creating overlays, streams, and companion applications.
Read-Only Access
This API is designed for read-only integration. Draft modifications are only allowed through the web interface. Each draft has a unique WebSocket endpoint accessed via the draft ID.
Authentication & Sessions
WebSocket connections use session-based authentication with HTTP cookies. Sessions are automatically created when you first connect. Admin users have additional permissions for managing drafts and viewing logs.
Breaking Change: Authentication Migration
Important: The API has migrated from localStorage-based authentication to session-based authentication. If your app was using localStorage tokens, you must update to use HTTP cookies and handle auth events. See the Migration Guide section below for details.
Draft Lifecycle
Drafts have a limited lifespan. Completed drafts are automatically deleted after 48 hours. Empty drafts are removed after 2 hours of inactivity.
Getting Started
Connect to our WebSocket API to receive real-time updates about a draft session.
WebSocket Connection
ws://localhost:3201/draft/[draftId]
Replace [draftId] with the ID of the draft you want to monitor. Authentication is handled automatically via HTTP cookies.
Key Steps
- Connect to the WebSocket endpoint
- Request draft data with
get_draft
message - Listen for real-time updates
- Handle draft completion or deletion
Available Data
Information you can display in your application
- TeamsTeam names and status
- Picks & BansSelected and banned heroes
- Turn TimerCurrent turn and remaining time
- Draft StatusWaiting, countdown, in progress, or completed
- Countdown TimerTime until draft begins
Migration Guide
How to update your external app from token-based to session-based authentication
Breaking Changes
OLD: localStorage tokens + Authorization headers
NEW: HTTP cookies + session authentication
Required Changes
- Remove localStorage authentication:
// ❌ OLD - Don't use this anymore localStorage.getItem('authToken')
- Use session-based authentication:
Visit the main app first to establish a session, then connect to WebSocket with cookies.
- Handle new auth events:
// ✅ NEW - Listen for these events case 'auth_success': // Authentication successful case 'auth_failed': // Authentication failed
- Include cookies in WebSocket connection:
Ensure your WebSocket client sends cookies automatically.
Quick Fix for External Apps
Option 1: Anonymous Read-Only Access (For OBS Overlays)
- Connect directly to WebSocket without authentication
- Anonymous users get read-only access to public drafts
- No session required - works seamlessly for overlays
Option 2: Session-based (For Interactive Apps)
- Open the main app (localhost:3000) in the same browser
- This establishes a session with cookies
- Your external app will now authenticate automatically
Option 3: External App Token (Coming Soon)
A dedicated token system for external applications is in development.