curl --request POST \
--url https://api.wave.sa/v1/webrtc/config \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"identity": "1001"
}
'import requests
url = "https://api.wave.sa/v1/webrtc/config"
payload = { "identity": "1001" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({identity: '1001'})
};
fetch('https://api.wave.sa/v1/webrtc/config', 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.wave.sa/v1/webrtc/config",
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([
'identity' => '1001'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.wave.sa/v1/webrtc/config"
payload := strings.NewReader("{\n \"identity\": \"1001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.wave.sa/v1/webrtc/config")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"identity\": \"1001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wave.sa/v1/webrtc/config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"identity\": \"1001\"\n}"
response = http.request(request)
puts response.read_body{
"wcs": "<string>",
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"expires_in_seconds": 123,
"wss_url": "<string>",
"sip_user": "<string>",
"sip_password": "<string>",
"sip_domain": "<string>",
"ice_servers": [
{}
],
"session_type": "agent",
"identity": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}Open a Web Calling session
Opens a browser calling session for the Wave Web Calling SDK and returns its SIP credentials. The SDK calls this for you. Two kinds of session:
- Agent session — send an
identity(a name you choose for the agent, for example1001). The browser registers as that identity, so a queue login or a callflow<Dial>with the same name rings it. Wave creates the identity’s SIP user on first use and gives it a new password for every session. Opening a new session for an identity ends the older one (the newest session wins). - Caller session — send no
identity, for example for a website visitor who calls your business. The session can only call out. Wave gives it a temporary SIP user and deletes that user when the session ends.
identity rules: 1–64 characters from A–Z, a–z, 0–9, ., _ and -. Identities that start with p_ (portal members) or c_ (caller sessions) are reserved. An identity that already names a SIP user Wave did not create (for example your desk phone) is refused with 409 IDENTITY_CONFLICT. Sandbox keys ignore identity and always open a caller session. The request Origin must be in the project’s allowed origins. Requires the webrtc:write scope.
curl --request POST \
--url https://api.wave.sa/v1/webrtc/config \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"identity": "1001"
}
'import requests
url = "https://api.wave.sa/v1/webrtc/config"
payload = { "identity": "1001" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({identity: '1001'})
};
fetch('https://api.wave.sa/v1/webrtc/config', 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.wave.sa/v1/webrtc/config",
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([
'identity' => '1001'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.wave.sa/v1/webrtc/config"
payload := strings.NewReader("{\n \"identity\": \"1001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.wave.sa/v1/webrtc/config")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"identity\": \"1001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wave.sa/v1/webrtc/config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"identity\": \"1001\"\n}"
response = http.request(request)
puts response.read_body{
"wcs": "<string>",
"session_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"call_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"expires_at": "2023-11-07T05:31:56Z",
"expires_in_seconds": 123,
"wss_url": "<string>",
"sip_user": "<string>",
"sip_password": "<string>",
"sip_domain": "<string>",
"ice_servers": [
{}
],
"session_type": "agent",
"identity": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}{
"error_code": "INVALID_API_KEY",
"message": "<string>",
"message_ar": "<string>",
"request_id": "<string>",
"docs_url": "<string>"
}Authorizations
Your API key from the Wave dashboard. Sandbox keys start sk_sandbox_; production keys start sk_live_. Send as Authorization: Bearer <key>. Some endpoints require a production key and specific scopes.
Body
The web-calling identity for an agent session. Omit it for a caller session.
^[A-Za-z0-9._-]{1,64}$"1001"
Response
The session was opened
The session token. Refresh it with POST /v1/webrtc/config/refresh before it expires.
The SIP-over-WebSocket URL.
The SIP user to register as (the identity, for an agent session).
The SIP password for this session. Returned once; never stored in plain text.
agent — registered as a web-calling identity, can receive calls. caller — can only call out.
agent, caller The identity of an agent session. Absent for a caller session.

