---
title: Connecting
description: Establish a WebSocket connection and authenticate with the API.
---

# Connecting

## Endpoints

Choose the region closest to your deployment, then choose the endpoint family that matches your channels.

| Endpoint family | Use for | Singapore | Europe |
| --- | --- | --- | --- |
| `book` | `BLOCK_BOOK_SNAPSHOT` | `wss://ap-sin3.ws.api.kiyotaka.ai/ws` | `wss://eu-de3.ws.api.kiyotaka.ai/ws` |
| `nonbook` | All other channels | `wss://ap-sin3.ws.api.kiyotaka.ai/nonbook/ws` | `wss://eu-de3.ws.api.kiyotaka.ai/nonbook/ws` |

If you need both orderbook and non-orderbook feeds, open one connection to each endpoint family.
For public API integrations, append `?encoding=json` to the endpoint you use and send JSON messages:

<CodeBlock lang="Endpoints">
<pre><span class="s-s">wss://ap-sin3.ws.api.kiyotaka.ai/ws?encoding=json</span>
<span class="s-s">wss://ap-sin3.ws.api.kiyotaka.ai/nonbook/ws?encoding=json</span></pre>
</CodeBlock>

## Authentication

Authenticate immediately after connecting by sending your API key:

<CodeBlock lang="JSON">
<pre>{
  <span class="s-p">"method"</span>: <span class="s-s">"public/authenticate"</span>,
  <span class="s-p">"params"</span>: {
    <span class="s-p">"token"</span>: <span class="s-s">"YOUR_API_KEY"</span>
  }
}</pre>
</CodeBlock>

You must authenticate before subscribing to any channels.