For the complete documentation index, see llms.txt. This page is also available as Markdown.

Websocket API

All insights are available in websocket. They are refreshed every 15 or 35 seconds depending on the asset. Websocket server will push the new version at each refresh. An API credit is then consume at each server push.

Base URL

Base URL
wss://api.synthdata.co/ws

Authentication

All requests require an API key in the query parameters:

apikey=YOUR_API_KEY

Example

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Synth WebSocket API</title>
  </head>

  <body>
    <p id="output"></p>

    <script>
      const apiKey = prompt("Enter your API key") || "";
      const uri = `wss://api.synthdata.co/ws/insights/liquidation?asset=SOL&apikey=${encodeURIComponent(apiKey)}`;

      ws = new WebSocket(uri);

      ws.onopen = function () {
        console.log("Connected");
      };

      ws.onmessage = function (evt) {
        var out = document.getElementById("output");
        out.innerHTML += evt.data + "<br>";
      };

      ws.onerror = function (err) {
        console.error("WebSocket error:", err);
      };

      ws.onclose = function (evt) {
        console.log("WebSocket closed:", evt.code, evt.reason);
      };
    </script>
  </body>
</html>

Last updated