Server API
This page describes Room server-side public APIs. Your application server uses the Token API to request short-lived room credentials, then securely delivers the returned peer_id and token to the device. For device-side connection, see Device Integration.
Authentication (TGV1-HMAC-SHA256)
The signing method is the same as Tange Cloud OpenAPI server-side signing. See Server API Signature Algorithm Demo.
Issue Room Token
POST /v1/token/room
Headers
| Header | Required | Description |
|---|---|---|
Content-Type | Yes | Fixed to application/json. |
X-Tg-App-Id | Yes | Application ID. |
Authorization | Yes | TGV1 server-side signature in the format TGV1-HMAC-SHA256 Credential=..., SignedHeaders=..., Signature=.... |
Request Body
json
{
"room_id": "order-20260611-001",
"device_id": "device-001"
}| Field | Type | Required | Description |
|---|---|---|---|
room_id | string | Yes | Business logical room ID. |
device_id | string | Yes | Device ID. The default participant can map to device_{device_id}. |
Example Response
json
{
"peer_id": "room_peer_order_20260611_001_device_001",
"token": "v1.{claimB64}.{sig}"
}peer_id is the device connection target identifier. The application server should not parse or rewrite it. When the device calls TiRTC TiRtcWhipConnect, it should pass this peer_id and token together.
Common Errors
| HTTP status | Description |
|---|---|
400 | Invalid request parameters, such as empty room_id or device_id. |
401 | App authentication failed. Check the application ID, TGV1 signature time, signed headers, and Body SHA-256. |
403 | The application or device does not have permission to join the room. |
429 | Room participant limit exceeded. |
503 | The service is temporarily unavailable. Retry later or contact technical support. |