DocsQuickstart

Quickstart

Issue a key and make your first REST call in a few minutes, then stream over WebSocket on a paid plan or a trial.

Open .md
  1. Get an API key

    Sign up (verify your email if asked), then open Dashboard → API key and reveal the key to copy it. If an older key cannot be revealed, keep using your saved copy or contact support before replacing it.

  2. Authenticate

    SurfaceSend the key as
    RESTx-api-key: <YOUR_API_KEY> header on every request
    WebSocketwss://stream.tickerlayer.com/?apiKey=<YOUR_API_KEY> on the upgrade URL (Connection)

    Servers, native apps, curl and Postman need nothing more. A browser app can call REST only from an approved origin: contact us to allowlist your domain. Full guide: Authentication.

  3. Make your first REST call

    The latest BTC/USD quote:

    curl -sS "https://api.tickerlayer.com/crypto/quote/BTCUSD" \
      -H "x-api-key: <YOUR_API_KEY>"
    Response 200
    {
      "symbol": "BTCUSD",
      "bid": 84210.12,
      "ask": 84210.45,
      "bid_size": 1.2,
      "ask_size": 0.8,
      "timestamp": 1743512400000
    }
  4. Open a WebSocket

    WebSocket comes with the Individual and Business plans (Perpetuals streams on Business). On the Free plan the connection is refused with 403 and WS_NOT_INCLUDED; request a 7-day trial from the dashboard, under Plan & access.

    Connect, wait for the ready frame, then subscribe. The first frame is always { "type": "system", "event": "ready", "ts": <unix_ms> }.

    Node.js
    const key = "<YOUR_API_KEY>";
    const ws = new WebSocket(
      "wss://stream.tickerlayer.com/?apiKey=" + encodeURIComponent(key)
    );
    
    ws.addEventListener("message", (ev) => {
      const msg = JSON.parse(String(ev.data));
      if (msg.type === "system" && msg.event === "ready") {
        ws.send(JSON.stringify({
          action: "subscribe",
          channels: ["crypto.quotes"],
          symbols: ["BTCUSD"],
        }));
        return;
      }
      console.log(msg); // quote | trade | system | error
    });

Next steps