Skip to content

Get STUN/TURN servers

GET
/v1/Accounts/{auth_id}/IceServers
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.

auth_id
required
string

Your Auth ID, or a direct sub-account’s.

The servers and when their credentials expire.

Media type application/json
object
data

The servers and how long their credentials stay valid.

object
expires_at

Until when the TURN credentials accept new allocations (RFC 3339, UTC).

string
ice_servers

The RTCIceServer entries, ready for RTCPeerConnection’s iceServers.

Array<object>
object
credential

TURN password; absent for STUN-only entries.

string
urls

Stun:, turn: or turns: URLs of the server.

Array<string>
username

TURN user name; absent for STUN-only entries.

string
provider

Which TURN provider issued the set: cloudflare or xirsys.

string
Allowed values: cloudflare xirsys
ttl

Seconds until expires_at.

integer
status

Always “success”.

string

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.

Media type application/json
string

Example generated

example

The request did not come through the API gateway with an authenticated account.

Media type application/json
object
error

The underlying error text. Only some 400 responses of the tenant list carry it.

string
message

What went wrong, in English.

string
status

Always “failed”.

string

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.

Media type application/json
object
error

The underlying error text. Only some 400 responses of the tenant list carry it.

string
message

What went wrong, in English.

string
status

Always “failed”.

string

Example

{
"error": "sql: connection is already closed",
"message": "Account Details not found",
"status": "failed"
}

Too many requests; see Retry-After.

Media type application/json
object
error

The underlying error text. Only some 400 responses of the tenant list carry it.

string
message

What went wrong, in English.

string
status

Always “failed”.

string

Example

{
"error": "sql: connection is already closed",
"message": "Account Details not found",
"status": "failed"
}

The account could not be checked.

Media type application/json
object
error

The underlying error text. Only some 400 responses of the tenant list carry it.

string
message

What went wrong, in English.

string
status

Always “failed”.

string

Example

{
"error": "sql: connection is already closed",
"message": "Account Details not found",
"status": "failed"
}

ICE servers are not configured or unavailable; see Retry-After.

Media type application/json
object
error

The underlying error text. Only some 400 responses of the tenant list carry it.

string
message

What went wrong, in English.

string
status

Always “failed”.

string

Example

{
"error": "sql: connection is already closed",
"message": "Account Details not found",
"status": "failed"
}