Documentation Index
Fetch the complete documentation index at: https://teambattles.gg/docs/llms.txt
Use this file to discover all available pages before exploring further.
Battles Record provides a REST API and WebSocket endpoint for programmatic control and monitoring.
Base URL
| Deployment | Base URL |
|---|
| Local | http://localhost:8080/api |
| Docker | http://{host}:8080/api |
Authentication
All endpoints require authentication via API key or JWT token.
API Key
curl -H "Authorization: Bearer YOUR_API_KEY" \
http://localhost:8080/api/channels
JWT Token
Obtain a token via login:
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "yourpassword"}'
Refresh Token
Refresh an expired or near-expiry token. Tokens can be refreshed for up to 1 hour after expiry (grace period).
Response:
{
"token": "eyJhbGciOiJIUzI1NiIs...",
"expires_at": "2026-02-04T14:30:00Z"
}
Channels
List Channels
Response:
{
"channels": [
{
"id": "ch_abc123",
"platform": "twitch",
"name": "shroud",
"enabled": true,
"quality": "source",
"status": "offline"
}
]
}
Get Channel
Add Channel
Body:
{
"platform": "twitch",
"name": "shroud",
"quality": "source",
"enabled": true
}
Update Channel
Body:
{
"quality": "1080p60",
"enabled": false
}
Delete Channel
DELETE /api/channels/{id}
Check Channel Live Status
POST /api/channels/{id}/check
Trigger an immediate live check for a channel.
Stop Channel Recording
POST /api/channels/{id}/stop-recording
Stop an active recording and pause the channel.
Channel Images
Get Channel Profile
GET /api/channels/{id}/profile
Returns channel profile data including image URLs.
POST /api/channels/{id}/images/fetch-platform
Re-download profile and banner images from the streaming platform.
Profile Image
GET /api/channels/{id}/images/profile
POST /api/channels/{id}/images/profile
DELETE /api/channels/{id}/images/profile
Get, upload (multipart), or delete the custom profile image.
Banner Image
GET /api/channels/{id}/images/banner
POST /api/channels/{id}/images/banner
DELETE /api/channels/{id}/images/banner
Get, upload (multipart), or delete the custom banner image.
Recordings
List Recordings
Query Parameters:
| Parameter | Description |
|---|
channel | Filter by channel ID |
platform | Filter by platform |
status | Filter by status |
from | Start date (ISO 8601) |
to | End date (ISO 8601) |
limit | Results per page (default: 50) |
offset | Pagination offset |
Response:
{
"recordings": [
{
"id": "rec_xyz789",
"channel_id": "ch_abc123",
"channel_name": "shroud",
"platform": "twitch",
"title": "Valorant Ranked",
"status": "complete",
"started_at": "2026-02-02T14:30:00Z",
"duration": 10800,
"file_size": 5368709120,
"file_path": "/recordings/shroud/2026-02-02_Valorant Ranked.mp4"
}
],
"total": 150,
"limit": 50,
"offset": 0
}
Get Recording
Delete Recording
DELETE /api/recordings/{id}
Query Parameters:
| Parameter | Description |
|---|
delete_file | Also delete the file (default: true) |
Re-process Recording
POST /api/recordings/{id}/reprocess
Active Recordings
List Active
GET /api/recordings/active
Response:
{
"active": [
{
"id": "rec_active123",
"channel_name": "shroud",
"platform": "twitch",
"title": "Valorant Ranked",
"started_at": "2026-02-02T14:30:00Z",
"duration": 3600,
"segments": 720,
"quality": "1080p60"
}
]
}
Stop Recording
POST /api/recordings/{id}/stop
Pause Recording
POST /api/recordings/{id}/pause
Resume Recording
POST /api/recordings/{id}/resume
Storage
Get Storage Info
Response:
{
"total_used": 107374182400,
"total_available": 536870912000,
"quota": 214748364800,
"quota_used_percent": 50,
"by_channel": {
"ch_abc123": 53687091200
}
}
Trigger Cleanup
POST /api/storage/cleanup
Runs retention policies immediately.
Settings
Get Settings
Update Settings
Body:
{
"output_directory": "/new/path",
"max_concurrent_recordings": 5
}
System
Health Check
Response:
{
"status": "healthy",
"version": "1.0.0",
"uptime": 86400
}
Logs
Query Parameters:
| Parameter | Description |
|---|
level | Filter by level (error, warn, info, debug) |
from | Start timestamp |
to | End timestamp |
limit | Results per page |
System Dependencies
GET /api/system/dependencies
Check status of system dependencies (FFmpeg, Bun, yt-dlp).
GET /api/auth/platforms
GET /api/auth/platforms/{platform}
PUT /api/auth/platforms/{platform}
DELETE /api/auth/platforms/{platform}
POST /api/auth/platforms/{platform}/test
POST /api/auth/platforms/{platform}/oauth/start
POST /api/auth/platforms/{platform}/oauth/callback
POST /api/auth/platforms/youtube/cookies
GET /api/auth/platforms/oauth/availability
Manage platform authentication credentials, OAuth flows, and YouTube cookie uploads.
Graceful Shutdown (Local-Only)
Gracefully shut down the daemon. Only available in local-only mode (desktop sidecar).
WebSocket
Connect for real-time updates:
const ws = new WebSocket("ws://localhost:8080/api/ws");
ws.onopen = () => {
// Authenticate
ws.send(
JSON.stringify({
type: "auth",
token: "YOUR_API_KEY"
})
);
};
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
console.log(message);
};
Event Types
| Event | Description |
|---|
connected | Initial connection with full state |
channel_status | Channel status changed |
channel_error | Channel encountered an error |
recording_started | New recording began |
segment_downloaded | Segment captured |
recording_ended | Recording finished |
processing_started | Post-processing began |
processing_progress | Processing progress update |
processing_complete | Processing finished successfully |
processing_failed | Processing encountered error |
schedule_skip | Stream skipped due to schedule |
filter_skip | Stream skipped due to content filters |
quota_skip | Stream skipped due to storage quota |
quota_status_changed | Channel quota status changed |
disk_warning | Disk space warning threshold exceeded |
config_reloaded | Configuration file reloaded |
platform_auth_updated | Platform auth connected or refreshed |
platform_auth_expired | Platform auth expired (refresh failed) |
Event Payload
{
"type": "recording.started",
"timestamp": "2026-02-02T14:30:00Z",
"data": {
"id": "rec_xyz789",
"channel": "shroud",
"platform": "twitch",
"title": "Valorant Ranked"
}
}
Subscribe to Channels
Filter events by channel:
{
"type": "subscribe",
"channels": ["ch_abc123", "ch_def456"]
}
Unsubscribe
{
"type": "unsubscribe",
"channels": ["ch_abc123"]
}
Error Responses
All errors return consistent format:
{
"error": {
"code": "CHANNEL_NOT_FOUND",
"message": "Channel with ID ch_invalid does not exist"
}
}
Error Codes
| Code | HTTP Status | Description |
|---|
UNAUTHORIZED | 401 | Missing or invalid auth |
FORBIDDEN | 403 | Insufficient permissions |
NOT_FOUND | 404 | Resource not found |
VALIDATION_ERROR | 400 | Invalid request body |
CONFLICT | 409 | Resource already exists |
INTERNAL_ERROR | 500 | Server error |
Rate Limiting
| Endpoint | Limit |
|---|
| Auth endpoints | 10 req/min |
| Read endpoints | 100 req/min |
| Write endpoints | 30 req/min |
Rate limit headers:
X-RateLimit-Limit: Max requests
X-RateLimit-Remaining: Remaining requests
X-RateLimit-Reset: Reset timestamp