curl --request POST \
--url https://app.base44.com/api/service/socket-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"app_ids": [
"6a2024af837c7a06c83021c1"
]
}
'import requests
url = "https://app.base44.com/api/service/socket-sessions"
payload = { "app_ids": ["6a2024af837c7a06c83021c1"] }
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({app_ids: ['6a2024af837c7a06c83021c1']})
};
fetch('https://app.base44.com/api/service/socket-sessions', 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://app.base44.com/api/service/socket-sessions",
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([
'app_ids' => [
'6a2024af837c7a06c83021c1'
]
]),
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://app.base44.com/api/service/socket-sessions"
payload := strings.NewReader("{\n \"app_ids\": [\n \"6a2024af837c7a06c83021c1\"\n ]\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://app.base44.com/api/service/socket-sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"app_ids\": [\n \"6a2024af837c7a06c83021c1\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/service/socket-sessions")
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 \"app_ids\": [\n \"6a2024af837c7a06c83021c1\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"session_id": "3f9a1c0e7b2d4e8f9a6b5c4d3e2f1a0b",
"session_token": "b44ws_Jd8lQ2v0mX4rT9yK1pN6sB3hW7cF5gA0eZ2uL8oI4qR",
"socket_url": "https://ws.base44.com",
"socket_path": "/ws/socket.io/",
"expires_in": 3600
}Create socket session
Opens a live-updates session for the apps a page shows, and returns the token the builder’s browser connects with. Call it from your server each time a page opens, with a workspace API key that has the Watch app builder updates permission.
Available to white-label workspaces with live builder updates turned on. Your onboarding contact turns them on for your workspace.
Every app in app_ids must be one the key can watch, or no session opens. A session watches up to 8 apps for 60 minutes and is never extended, so open a new one rather than reusing a token. Return session_token and socket_url to the browser, and keep session_id on your server to change or end the session later.
A key holds up to 5,000 live sessions at once. A retry after a lost response opens another session, which counts toward that number until it expires. Session calls are limited to 600 requests a minute per workspace. Some workspaces have a different limit. Every request that counts against the limit gets X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix time in seconds) headers, and a 429 also gets Retry-After in seconds.
curl --request POST \
--url https://app.base44.com/api/service/socket-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"app_ids": [
"6a2024af837c7a06c83021c1"
]
}
'import requests
url = "https://app.base44.com/api/service/socket-sessions"
payload = { "app_ids": ["6a2024af837c7a06c83021c1"] }
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({app_ids: ['6a2024af837c7a06c83021c1']})
};
fetch('https://app.base44.com/api/service/socket-sessions', 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://app.base44.com/api/service/socket-sessions",
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([
'app_ids' => [
'6a2024af837c7a06c83021c1'
]
]),
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://app.base44.com/api/service/socket-sessions"
payload := strings.NewReader("{\n \"app_ids\": [\n \"6a2024af837c7a06c83021c1\"\n ]\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://app.base44.com/api/service/socket-sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"app_ids\": [\n \"6a2024af837c7a06c83021c1\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/service/socket-sessions")
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 \"app_ids\": [\n \"6a2024af837c7a06c83021c1\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"session_id": "3f9a1c0e7b2d4e8f9a6b5c4d3e2f1a0b",
"session_token": "b44ws_Jd8lQ2v0mX4rT9yK1pN6sB3hW7cF5gA0eZ2uL8oI4qR",
"socket_url": "https://ws.base44.com",
"socket_path": "/ws/socket.io/",
"expires_in": 3600
}Authorizations
Workspace API key, sent as Authorization: Bearer <key>.
Body
IDs of the apps the session may watch, up to 8. The key must be able to watch every one.
1 - 8 elements^[0-9a-f]{24}$["6a2024af837c7a06c83021c1"]
Response
Session opened.
ID of the session, for changing its apps or ending it. Keep it on your server. It can't open a connection.
"3f9a1c0e7b2d4e8f9a6b5c4d3e2f1a0b"
Secret the browser connects with, as auth.session_token. Pass it to the browser and don't store it.
"b44ws_Jd8lQ2v0mX4rT9yK1pN6sB3hW7cF5gA0eZ2uL8oI4qR"
Origin the browser connects to.
"https://ws.base44.com"
Socket.IO path on that origin.
"/ws/socket.io/"
Seconds until the session and its token expire. A session is never extended.
3600
Was this page helpful?