-
Notifications
You must be signed in to change notification settings - Fork 5
REST API
im-pingo edited this page Mar 26, 2026
·
2 revisions
English | 中文
LiveForge provides a management REST API for stream control, server monitoring, and health checks.
api:
enabled: true
listen: ":8090"
# tls: null
auth:
bearer_token: "${API_TOKEN}"
console:
username: "admin"
password: "admin"| Field | Type | Default | Description |
|---|---|---|---|
enabled |
bool | true |
Enable/disable the API module |
listen |
string | ":8090" |
HTTP listen address |
tls |
*bool | (null) | Per-module TLS override |
auth.bearer_token |
string | "" |
Bearer token for API authentication. Supports ${ENV_VAR} expansion. |
console.username |
string | "admin" |
Web console login username |
console.password |
string | "admin" |
Web console login password |
Requests to /api/* require one of:
-
Bearer token in the
Authorizationheader:Authorization: Bearer <token> - Session cookie obtained from the console login
If auth.bearer_token is empty, API endpoints are accessible without authentication.
The web console uses session-based authentication:
- Open
/consolein a browser -- redirects to login if not authenticated - Submit credentials via
POST /console/login - A session cookie is set for subsequent requests
| Method | Path | Description |
|---|---|---|
GET |
/api/v1/streams |
List all active streams with stats |
GET |
/api/v1/streams/{app}/{key} |
Get details for a specific stream |
DELETE |
/api/v1/streams/{app}/{key} |
Delete a stream (stop all publishers and subscribers) |
POST |
/api/v1/streams/{app}/{key}/kick |
Kick the publisher from a stream |
GET |
/api/v1/server/info |
Server version, uptime, modules, endpoints |
GET |
/api/v1/server/stats |
Total stream and connection counts |
GET |
/api/v1/server/health |
Health check (returns {"status": "healthy"}) |
GET |
/console |
Web console (HTML) |
GET |
/console/login |
Console login page |
POST |
/console/login |
Submit console login credentials |
All API responses use a standard JSON envelope:
{
"code": 0,
"message": "ok",
"data": { ... }
}On error:
{
"code": 404,
"message": "stream not found"
}curl -H "Authorization: Bearer ${API_TOKEN}" \
http://localhost:8090/api/v1/streamsResponse:
{
"code": 0,
"message": "ok",
"data": {
"streams": [
{
"key": "live/stream1",
"state": "publishing",
"publisher": "rtmp-abc123",
"video_codec": "H264",
"audio_codec": "AAC",
"gop_cache_len": 42,
"gop_video_frames": 30,
"gop_audio_frames": 12,
"gop_duration_ms": 1200,
"subscribers": {
"rtmp": 2,
"flv": 5,
"hls": 10
},
"stats": {
"bytes_in": 15728640,
"video_frames": 7500,
"audio_frames": 9375,
"uptime_sec": 300,
"bitrate_kbps": 4096,
"fps": 25.0
}
}
]
}
}curl -X POST -H "Authorization: Bearer ${API_TOKEN}" \
http://localhost:8090/api/v1/streams/live/stream1/kickResponse:
{
"code": 0,
"message": "ok"
}curl http://localhost:8090/api/v1/server/healthResponse:
{
"code": 0,
"message": "ok",
"data": {
"status": "healthy"
}
}