> ## Documentation Index
> Fetch the complete documentation index at: https://xchangeapi.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# WebSocket API Quickstart

> Start using our WebSocket API in minutes

<Steps>
  <Step title="Get your API key">
    You'll need an API key to authenticate your requests. You can create one in [Profile -> Keys](https://xchangeapi.com/profile/keys).

    More information about API keys can be found on the [Authentication](/docs/authentication) page.
  </Step>

  <Step title="Install WebSocket client">
    We recommend using [websocat](https://github.com/vi/websocat) for testing WebSocket connections.

    <CodeGroup>
      ```bash macOS theme={null}
      brew install websocat
      ```

      ```bash Linux theme={null}
      wget -qO websocat https://github.com/vi/websocat/releases/latest/download/websocat.x86_64-unknown-linux-musl
      chmod a+x websocat
      sudo mv websocat /usr/local/bin/
      ```

      ```bash Windows theme={null}
      Pre-built binaries for Windows, OS X and Android are available on the releases page: https://github.com/vi/websocat/releases
      ```
    </CodeGroup>
  </Step>

  <Step title="Connect">
    Connect to the WebSocket API using your API key. Replace `<YOUR_API_KEY>` with your actual key.

    ```bash theme={null}
    websocat -H='api-key: <YOUR-API-KEY>' wss://api.xchangeapi.com/websocket/live
    ```

    <Note>
      You won't receive a confirmation message upon connecting. You can proceed directly to the next step.
    </Note>
  </Step>

  <Step title="Subscribe">
    Once connected, paste the following JSON message to subscribe to currency pairs:

    ```json theme={null}
    {"pairs": ["EURUSD", "GBPUSD"]}
    ```
  </Step>

  <Step title="Receive Data">
    You will receive an initial message followed by live updates.

    ```json theme={null}
    0{"session_uid":"572733aab7e148cb852564cd5eef5d14","time_mult":1000,"start_time":1766933673.1651759148,"order":["name","ask","bid","time"],"mapping":{"1":"GBPUSD","0":"EURUSD"}}
    10|1.17714|1.17680|-14373540
    11|1.35004|1.34965|-14373539
    ```
  </Step>
</Steps>

## What's Next

Now that you're connected, check out these resources to build your integration:

<CardGroup cols={2}>
  <Card title="Protocol Overview" icon="book" href="/docs/websocket/protocol">
    Learn about the WebSocket protocol details and message format.
  </Card>

  <Card title="Example Implementation" icon="code" href="/docs/websocket/example-implementation">
    See a complete example implementation in JavaScript and Node.js.
  </Card>
</CardGroup>
