Guides détaillés
La référence complète de chaque brique, sur GitHub :
Documentation
Guides, API reference and examples in the most used languages. A sandbox key is enough to start.
La référence complète de chaque brique, sur GitHub :
Three steps: create a room from your backend, issue a participant token, connect your client.
// Côté serveur (Node) : créer une salle + token participant const res = await fetch("https://streamche.com/api/v1/rtc/rooms", { method: "POST", headers: { Authorization: `Bearer ${STREAMCHE_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ name: "consult-42" }), }); const room = await res.json(); const tok = await fetch( `https://streamche.com/api/v1/rtc/rooms/${room.id}/tokens`, { method: "POST", headers: { Authorization: `Bearer ${STREAMCHE_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ identity: "user-7", role: "publisher" }), }).then(r => r.json()); // Côté client : SDK JavaScript import { StreamcheChat } from "streamche"; const chat = new StreamcheChat({ token: userToken, wsUrl: tok.ws_url }); await chat.connect();
use Illuminate\Support\Facades\Http; $room = Http::withToken($STREAMCHE_KEY) ->post('https://streamche.com/api/v1/rtc/rooms', ['name' => 'consult-42'])->json(); $token = Http::withToken($STREAMCHE_KEY) ->post("https://streamche.com/api/v1/rtc/rooms/{$room['id']}/tokens", ['identity' => 'user-7', 'role' => 'publisher']) ->json('token');
import requests KEY = os.environ["STREAMCHE_KEY"] H = {"Authorization": f"Bearer {KEY}", "Content-Type": "application/json"} room = requests.post("https://streamche.com/api/v1/rtc/rooms", json={"name": "consult-42"}, headers=H).json() tok = requests.post( f"https://streamche.com/api/v1/rtc/rooms/{room['id']}/tokens", json={"identity": "user-7", "role": "publisher"}, headers=H).json() # tok["token"] → à transmettre au client final
# 1. Créer une salle curl -X POST https://streamche.com/api/v1/rtc/rooms \ -H "Authorization: Bearer $STREAMCHE_KEY" \ -d '{"name":"consult-42"}' # 2. Token participant (≤ 15 min) curl -X POST https://streamche.com/api/v1/rtc/rooms/{id}/tokens \ -H "Authorization: Bearer $STREAMCHE_KEY" \ -d '{"identity":"user-7","role":"publisher"}' # 3. Envoyer un message (idempotent) curl -X POST https://streamche.com/api/v1/conversations/{id}/messages \ -H "Authorization: Bearer $STREAMCHE_KEY" \ -d '{"sender_ref":"user-7","body":"Bonjour","client_message_id":"m1"}'
import 'package:http/http.dart' as http; final res = await http.post( Uri.parse('https://streamche.com/api/v1/rtc/rooms'), headers: {'Authorization': 'Bearer $streamcheKey', 'Content-Type': 'application/json'}, body: jsonEncode({'name': 'consult-42'}), ); final roomId = jsonDecode(res.body)['id']; final tok = await http.post( Uri.parse('https://streamche.com/api/v1/rtc/rooms/$roomId/tokens'), headers: {'Authorization': 'Bearer $streamcheKey'}, body: jsonEncode({'identity': 'user-7'}), ); // Le SDK Flutter streamche rejoindra la salle avec ce token.
Two key levels: the secret key (server only) and the user token (end client, 5-15 min).
# Clé secrète (serveur) — composite, affichée une seule fois Authorization: Bearer rt_secret_rt_pub_xxxx_yyyy… # Token utilisateur (client final) — JWT HS256, 5-15 min POST /api/v1/users/tokens {"user_id":"user-7","ttl_minutes":10} → { "token": "eyJhbGci…", "ws_url": "wss://ws.streamche.com/ws" }
JSON protocol on wss://ws.streamche.com/ws: auth, subscribe, message.send, message.read, typing, replay.
// Connexion et authentification ws.send(JSON.stringify({ type: "auth", token: userToken })); // → { type: "auth.ok", user_id, env } // S'abonner à une conversation puis envoyer ws.send(JSON.stringify({ type: "subscribe", conversation_id: id })); ws.send(JSON.stringify({ type: "message.send", conversation_id: id, body: "Bonjour !", client_message_id: "m-42" // idempotence })); // Reprise après coupure : rejoue les événements manquants ws.send(JSON.stringify({ type: "replay", conversation_id: id, last_event_id: 128 })); // Frappe et accusés de lecture ws.send(JSON.stringify({ type: "typing", conversation_id: id, typing: true })); ws.send(JSON.stringify({ type: "message.read", conversation_id: id, message_id: mid }));
Headers X-ST-Signature (t=…,v1=…), X-ST-Event, X-ST-Timestamp, X-ST-Delivery-Id. Replay tolerance: 5 minutes.
// Vérification de signature (Node/Express) const crypto = require("crypto"); function verify(req, secret) { const [t, v1] = req.headers["x-st-signature"].split(",") .map(s => s.split("=")[1]); if (Math.abs(Date.now()/1000 - Number(t)) > 300) return false; const expected = crypto.createHmac("sha256", secret) .update(`${t}.${req.rawBody}`).digest("hex"); return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(v1)); } // Événements : message.created/updated/deleted, conversation.created, // room.started/ended, participant.joined/left, recording.completed, quota.warning // Dédupe : event_id (at-least-once)
Two-step upload: presigned URL (PUT), then attachment to the message.
# 1. Préparer (25 Mo max, liste blanche de MIME) POST /api/v1/attachments {"conversation_id":"…","filename":"photo.jpg", "content_type":"image/jpeg","size":204800} → { "attachment_id", "upload_url" } # PUT présigné, 15 min # 2. Uploader le binaire curl -X PUT "$upload_url" -H "Content-Type: image/jpeg" --data-binary @photo.jpg # 3. Rattacher au message POST /api/v1/conversations/{id}/messages {"sender_ref":"user-7","body":"Voici la photo","attachment_id":"…"}
Daily aggregates per metric; Feexpay prepaid checkout; server status as source of truth.
GET /api/v1/usage?from=2026-10-01&to=2026-10-31&metric=rtc.minute
→ { "data": [{ "metric", "day", "total", "events" }],
"totals": [{ "metric": "rtc.minute", "total": 1240.5 }] }
POST /api/v1/billing/checkout
{"amount":5000,"currency":"XOF","operator":"MTN","phone_number":"+229…"}
→ { "reference", "checkout_url" } # Feexpay : mobile money / carte
GET /api/v1/billing/payments/{reference} # source de vérité serveur
Single error format, correlated request_id, per-environment rate limits (300 req/min sandbox, 1,000 in production).
{
"error": {
"code": "rate_limited", // missing_api_key, invalid_api_key,
"message": "Too many requests", // room_closed, message_quota_exceeded,
"request_id": "req_01J…", // spending_cap_reached, validation_failed…
"retry_after": 12
}
}