Connect a browser call (data plane)
curl --request POST \
--url https://api.goyappr.com/web-call \
--header 'Content-Type: application/json' \
--data '
{
"sdp": "<string>",
"type": "offer"
}
'import requests
url = "https://api.goyappr.com/web-call"
payload = {
"sdp": "<string>",
"type": "offer"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({sdp: '<string>', type: 'offer'})
};
fetch('https://api.goyappr.com/web-call', 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/web-call",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sdp' => '<string>',
'type' => 'offer'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/web-call"
payload := strings.NewReader("{\n \"sdp\": \"<string>\",\n \"type\": \"offer\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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/web-call")
.header("Content-Type", "application/json")
.body("{\n \"sdp\": \"<string>\",\n \"type\": \"offer\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/web-call")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"sdp\": \"<string>\",\n \"type\": \"offer\"\n}"
response = http.request(request)
puts response.read_body{
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sdp": "<string>",
"type": "answer",
"pc_id": "<string>",
"agent_name": "<string>",
"ice_candidate_url": "<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>"
}
]
}{
"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
Connect a Browser Call
The browser data plane: the mint’s connection.web_call_url, where @goyappr/client posts the browser’s SDP offer for a session minted with protocol: "offer". Authorized by the session token as x-yappr-web-token (a shared link’s page sends x-share-token, the dashboard its own sign-in), never the secret key. The token is single-use: the first offer spends it, and the call it starts is the session’s call_id. An agent whose mint answers protocol: "call_request" is a workflow agent (steps or not) the workflow engine runs, and is refused here before the token is spent; use the call request below.
POST
/
web-call
Connect a browser call (data plane)
curl --request POST \
--url https://api.goyappr.com/web-call \
--header 'Content-Type: application/json' \
--data '
{
"sdp": "<string>",
"type": "offer"
}
'import requests
url = "https://api.goyappr.com/web-call"
payload = {
"sdp": "<string>",
"type": "offer"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({sdp: '<string>', type: 'offer'})
};
fetch('https://api.goyappr.com/web-call', 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/web-call",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sdp' => '<string>',
'type' => 'offer'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/web-call"
payload := strings.NewReader("{\n \"sdp\": \"<string>\",\n \"type\": \"offer\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
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/web-call")
.header("Content-Type", "application/json")
.body("{\n \"sdp\": \"<string>\",\n \"type\": \"offer\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/web-call")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"sdp\": \"<string>\",\n \"type\": \"offer\"\n}"
response = http.request(request)
puts response.read_body{
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sdp": "<string>",
"type": "answer",
"pc_id": "<string>",
"agent_name": "<string>",
"ice_candidate_url": "<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>"
}
]
}{
"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, not the secret-key API: the mint’s
Every refusal is the one
connection.web_call_url,
where the browser posts its SDP offer for a session minted with
protocol: "offer" by POST /calls with "type": "web".
@goyappr/client makes this call for you; call it yourself only if you build the peer
connection without the SDK.
It is authorized by the session token as x-yappr-web-token (a shared link’s page sends
x-share-token, the dashboard its own sign-in) - never your secret key, so the browser
calls it directly.
curl -X POST https://api.goyappr.com/web-call \
-H "x-yappr-web-token: wcs_…" \
-H "Content-Type: application/json" \
-d '{ "sdp": "v=0…", "type": "offer" }'
{
"call_id": "75a8e137-…",
"agent_name": "Front desk",
"sdp": "v=0…",
"type": "answer",
"pc_id": "…",
"ice_candidate_url": "https://voice.goyappr.com/api/web-call/offer"
}
One offer per token
The token is single-use: the first offer spends it, and the call it starts is the session’scall_id - the one the mint already answered with. Fetch the ICE servers
first with TURN Credentials, which does not
spend it. After the answer, trickle candidates to ice_candidate_url with pc_id, and
DELETE that URL with pc_id to hang up.
An agent whose mint answered protocol: "call_request" is a workflow agent, with or without
steps; a one-shot offer starts no workflow run, so the call would run without its tools. Its
offer is refused with 409 workflow_preparation_required before the token is spent:
create the call with Create Browser Call Request
using the same token instead.
Refusals
| Status | Code | What to do |
|---|---|---|
400 | BAD_REQUEST | The body is not JSON, or has no sdp and type. |
401 | UNAUTHORIZED | No session token, share link or sign-in, or one that is not ours. |
403 | WEB_SESSION_CANCELLED | The token was taken back with its cancel_url. Mint a new session. |
403 | FORBIDDEN | The token was already used or has expired, or the shared link was revoked or has expired. Mint a new session. |
409 | workflow_preparation_required | This agent runs on the workflow engine, which a one-shot offer cannot start. Create a browser call request with the same token; nothing was spent. |
502 | VOICE_CONNECTION_REFUSED | The voice server refused the offer. The call is recorded failed and the token is spent; mint a new session rather than resending the offer. |
503 | VOICE_UNAVAILABLE | The voice server did not take the offer, or every line was busy. The call is recorded failed and the token is spent; mint a new session and try again in a moment. |
Error body, {error, code}. Branch on code.Body
application/json