Balance WebSocket
curl --request GET \
--url https://synthesis.trade/api/v1/balance/ws \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"wallets": [
{
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"assets": [
"USDC",
"12345"
]
},
{
"address": "7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F"
}
]
}
'import requests
url = "https://synthesis.trade/api/v1/balance/ws"
payload = {
"type": "<string>",
"wallets": [{
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"assets": ["USDC", "12345"]
}, { "address": "7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F" }]
}
headers = {"Content-Type": "application/json"}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
wallets: [
{
address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
assets: ['USDC', '12345']
},
{address: '7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F'}
]
})
};
fetch('https://synthesis.trade/api/v1/balance/ws', 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://synthesis.trade/api/v1/balance/ws",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'wallets' => [
[
'address' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'assets' => [
'USDC',
'12345'
]
],
[
'address' => '7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F'
]
]
]),
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://synthesis.trade/api/v1/balance/ws"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"wallets\": [\n {\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"assets\": [\n \"USDC\",\n \"12345\"\n ]\n },\n {\n \"address\": \"7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F\"\n }\n ]\n}")
req, _ := http.NewRequest("GET", 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.get("https://synthesis.trade/api/v1/balance/ws")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"wallets\": [\n {\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"assets\": [\n \"USDC\",\n \"12345\"\n ]\n },\n {\n \"address\": \"7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://synthesis.trade/api/v1/balance/ws")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"wallets\": [\n {\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"assets\": [\n \"USDC\",\n \"12345\"\n ]\n },\n {\n \"address\": \"7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"response": {
"wallets": [
{
"chain_id": "POL",
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"balances": {
"USDC": "1234.567",
"21742633143463906290569050155826241533067272736897614950488156847949938836455": "150.000"
}
},
{
"chain_id": "SOL",
"address": "7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F",
"balances": {
"USDC": "500.000"
}
}
]
}
}WebSockets
Balance WebSocket
Connect to wss://synthesis.trade/api/v1/balance/ws and send JSON messages over the socket.
Subscription behavior:
- You must send a
walletsarray when subscribing. - On subscribe, current balances are returned and then live balance and order updates are streamed.
- Polygon and Solana addresses can be mixed in the same subscribe request.
Possible order statuses: OPEN, MATCHED, FILLED, PARTIAL, TRIGGERED, CANCELED, FAILED. MATCHED indicates the order has been submitted on-chain but fill confirmation has not yet arrived.
Balance WebSocket
curl --request GET \
--url https://synthesis.trade/api/v1/balance/ws \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"wallets": [
{
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"assets": [
"USDC",
"12345"
]
},
{
"address": "7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F"
}
]
}
'import requests
url = "https://synthesis.trade/api/v1/balance/ws"
payload = {
"type": "<string>",
"wallets": [{
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"assets": ["USDC", "12345"]
}, { "address": "7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F" }]
}
headers = {"Content-Type": "application/json"}
response = requests.get(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
wallets: [
{
address: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
assets: ['USDC', '12345']
},
{address: '7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F'}
]
})
};
fetch('https://synthesis.trade/api/v1/balance/ws', 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://synthesis.trade/api/v1/balance/ws",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'wallets' => [
[
'address' => '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
'assets' => [
'USDC',
'12345'
]
],
[
'address' => '7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F'
]
]
]),
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://synthesis.trade/api/v1/balance/ws"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"wallets\": [\n {\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"assets\": [\n \"USDC\",\n \"12345\"\n ]\n },\n {\n \"address\": \"7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F\"\n }\n ]\n}")
req, _ := http.NewRequest("GET", 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.get("https://synthesis.trade/api/v1/balance/ws")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"wallets\": [\n {\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"assets\": [\n \"USDC\",\n \"12345\"\n ]\n },\n {\n \"address\": \"7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://synthesis.trade/api/v1/balance/ws")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"wallets\": [\n {\n \"address\": \"0x742d35Cc6634C0532925a3b844Bc454e4438f44e\",\n \"assets\": [\n \"USDC\",\n \"12345\"\n ]\n },\n {\n \"address\": \"7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"response": {
"wallets": [
{
"chain_id": "POL",
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"balances": {
"USDC": "1234.567",
"21742633143463906290569050155826241533067272736897614950488156847949938836455": "150.000"
}
},
{
"chain_id": "SOL",
"address": "7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F",
"balances": {
"USDC": "500.000"
}
}
]
}
}Body
application/json
WebSocket message type. Supported values: subscribe or unsubscribe.
Wallet subscription list. Maximum 500 wallet entries total, and no more than 500 total requested assets across all entries.
Show child attributes
Show child attributes
Example:
[
{
"address": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"assets": ["USDC", "12345"]
},
{
"address": "7xKXtg2CWz9P8VxP1Wm2G7x5Q8Y9LwYH6a7b8c9d1e2F"
}
]
Response
101 - application/json
WebSocket connection established
⌘I