Get STUN/TURN servers
const url = 'https://api.siprtc.io/v1/Accounts/example/IceServers';const options = {method: 'GET', headers: {Authorization: 'Basic <credentials>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.siprtc.io/v1/Accounts/example/IceServers \ --header 'Authorization: Basic <credentials>'Returns the STUN and TURN servers for WebRTC calls, ready to pass as iceServers to RTCPeerConnection, with short-lived TURN credentials. The credentials accept new allocations until expires_at (ttl seconds from now; normally at least 45 minutes), so ask again before then; the web SDK asks at start and about every 30 minutes. provider names the TURN provider that issued the set. One set is shared by all callers and refreshed ahead of its expiry, so replies are fast. The reply is not cacheable.
{auth_id} must be the authenticated account or one of its direct sub-accounts (404 otherwise). Each caller may make 20 requests in a burst, then one every 2 seconds; beyond that the reply is 429 with Retry-After: 10. When no TURN provider is configured or none answers, the reply is 503 with Retry-After: 30.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Your Auth ID, or a direct sub-account’s.
Responses
Section titled “ Responses ”The servers and when their credentials expire.
object
The servers and how long their credentials stay valid.
object
Until when the TURN credentials accept new allocations (RFC 3339, UTC).
The RTCIceServer entries, ready for RTCPeerConnection’s iceServers.
object
TURN password; absent for STUN-only entries.
Stun:, turn: or turns: URLs of the server.
TURN user name; absent for STUN-only entries.
Which TURN provider issued the set: cloudflare or xirsys.
Seconds until expires_at.
Always “success”.
Example
{ "data": { "expires_at": "2026-11-27T09:30:00Z", "ice_servers": [ { "credential": "example-turn-credential", "urls": [ "turn:turn.example.com:3478?transport=udp" ], "username": "example-turn-username" } ], "provider": "cloudflare", "ttl": 86000 }, "status": "success"}Authentication failed: wrong or missing credentials, a disabled account, or an {auth_id} that is neither you nor your direct sub-account.
Example generated
exampleThe request did not come through the API gateway with an authenticated account.
object
The underlying error text. Only some 400 responses of the tenant list carry it.
What went wrong, in English.
Always “failed”.
Example
{ "error": "sql: connection is already closed", "message": "Account Details not found", "status": "failed"}{auth_id} is neither the authenticated account nor its direct sub-account.
object
The underlying error text. Only some 400 responses of the tenant list carry it.
What went wrong, in English.
Always “failed”.
Example
{ "error": "sql: connection is already closed", "message": "Account Details not found", "status": "failed"}Too many requests; see Retry-After.
object
The underlying error text. Only some 400 responses of the tenant list carry it.
What went wrong, in English.
Always “failed”.
Example
{ "error": "sql: connection is already closed", "message": "Account Details not found", "status": "failed"}The account could not be checked.
object
The underlying error text. Only some 400 responses of the tenant list carry it.
What went wrong, in English.
Always “failed”.
Example
{ "error": "sql: connection is already closed", "message": "Account Details not found", "status": "failed"}ICE servers are not configured or unavailable; see Retry-After.
object
The underlying error text. Only some 400 responses of the tenant list carry it.
What went wrong, in English.
Always “failed”.
Example
{ "error": "sql: connection is already closed", "message": "Account Details not found", "status": "failed"}