Fetch ICE servers for a browser call (data plane)
curl --request POST \
--url https://api.goyappr.com/turn-credentialsimport requests
url = "https://api.goyappr.com/turn-credentials"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.goyappr.com/turn-credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/turn-credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/turn-credentials"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/turn-credentials")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/turn-credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"iceServers": [
{
"urls": "<string>",
"username": "<string>",
"credential": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}Browser calls
TURN Credentials
The mint’s connection.turn_credentials_url: short-lived STUN and TURN servers for the browser’s peer connection, fetched before the offer. Authorized like the offer - the session token as x-yappr-web-token, a shared link or a sign-in - and it does not spend the token. GET answers the same.
POST
/
turn-credentials
Fetch ICE servers for a browser call (data plane)
curl --request POST \
--url https://api.goyappr.com/turn-credentialsimport requests
url = "https://api.goyappr.com/turn-credentials"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.goyappr.com/turn-credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/turn-credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/turn-credentials"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/turn-credentials")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/turn-credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"iceServers": [
{
"urls": "<string>",
"username": "<string>",
"credential": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}The browser data plane: the mint’s
It is authorized like the offer - the session token as
connection.turn_credentials_url. It answers
short-lived STUN and TURN servers for the browser’s peer connection, in the shape
RTCPeerConnection takes, so a caller behind a strict network still connects. Fetch them
before you build the peer connection and send the offer; @goyappr/client does it for you.
curl -X POST https://api.goyappr.com/turn-credentials \
-H "x-yappr-web-token: wcs_…"
{
"iceServers": [
{ "urls": "stun:stun.l.google.com:19302" },
{ "urls": ["turn:turn.example.net:3478?transport=udp"], "username": "…", "credential": "…" }
]
}
x-yappr-web-token, a shared link as x-share-token, or a dashboard sign-in - and it
does not spend the token. GET answers exactly as POST does, with the same
refusals. The credentials last an hour; fetch new ones for a new call.
| Status | Code | When |
|---|---|---|
401 | UNAUTHORIZED | No token, link or sign-in; a token or link that is not ours; or a session token that was already used or has expired. Mint a new session. |
403 | WEB_SESSION_CANCELLED | The token was taken back with its cancel_url. Mint a new session. |
405 | METHOD_NOT_ALLOWED | Use POST or GET. |