DocsQuickstart

Quickstart

Issue a key, authenticate one REST call, then open the public WebSocket and subscribe — all in a few minutes.

1. Get an API key

Sign up, verify your email if prompted, then open Dashboard → API key. Use the reveal control to view and copy your key again when available. If an older key cannot be revealed, keep using your saved copy or contact support before replacing it.

2. Authenticate

REST uses a header; WebSocket uses the upgrade URL:

  • REST: x-api-key: <YOUR_API_KEY> header on every request.
  • WebSocket: wss://stream.tickerlayer.com/?apiKey=<YOUR_API_KEY> — see Connection.

Server-side, native, curl, and Postman usage is unaffected by browser CORS. Browser-based apps may only call the REST API from approved origins — contact us to allowlist your domain. See Authentication for the full guide.

3. First REST call

Fetch the latest BTC/USD quote with a single curl command:

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

4. Open a WebSocket

Connect to the public stream, wait for the ready event, then subscribe to a channel:

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
});

The first frame you receive after connect is always: { "type": "system", "event": "ready", "ts": <unix_ms> }