Militant API wiki

Quick Start

Supporting pages, examples and technical details in a cleaner layout.

1. Install the API

mkdir -p militant-api-install
cd militant-api-install
curl -fsSLO https://gitlab.com/militant1/api-installer/-/raw/main/militant-api
chmod +x militant-api
./militant-api

2. Check that the API responds

curl http://localhost:9082/v1/index.php

3. Create a token

curl -X POST http://localhost:9082/v1/auth.php \
  -H "Content-Type: application/json" \
  -d '{"username":"your_username","password":"your_password"}'

4. Use an endpoint

curl http://localhost:9082/v1/posts.php \
  -H "Authorization: Bearer YOUR_TOKEN"

LiveKit (optional)

Set LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET (environment or config/livekit.local.php via /admin/livekit.php). Test a token:

curl -X POST "http://localhost:9082/v1/lives.php?path=token" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"roomName":"test","identity":"user-1","name":"Test","canPublish":false}'

The /admin/livekit.php UI (LiveKit secrets) is technicians only: same rule as Militant (users.is_admin = 1, Technicians tab in admin.php).

Configure WEBRTC_TURN_URLS, WEBRTC_TURN_AUTH_SECRET, WEBRTC_TURN_TTL, WEBRTC_TURN_REALM (environment or config/turn.local.php via /admin/turn.php).

/v1/settings.php then returns stun_servers, turn_servers, and webrtc_ice_servers. If WEBRTC_TURN_AUTH_SECRET is present, the API generates temporary HMAC TURN credentials compatible with coturn use-auth-secret.

5. Update

./militant-api update

6. Uninstall

./militant-api uninstall

More details: README.md and DOCKER.md