> For the complete documentation index, see [llms.txt](https://sm-fund.gitbook.io/sm-fund-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sm-fund.gitbook.io/sm-fund-docs/get-started/quickstart.md).

# Quickstart

Create an API Key and receive your first SM FUND WebSocket messages.

You need an SM FUND account and a server or local terminal running Node.js or Python. The browser's native WebSocket API cannot set the required `Authorization` header.

## 1. Create an API Key

Sign in to the [dashboard](https://sm.fund/dashboard/), open **API Keys**, and create a key. Copy it when it is shown and store it in your local environment or secret manager. The full key is only displayed once.

Normal active accounts start on Free, with a 500 ms added delivery delay. You can follow this quickstart without subscribing.

## 2. Request a connection Ticket

Send the API Key in `X-API-Key` to `POST https://sm.fund/v1/wss/tickets`:

```http
POST /v1/wss/tickets HTTP/1.1
Host: sm.fund
Content-Type: application/json
X-API-Key: YOUR_API_KEY

{"feed":"polymarket"}
```

Use `"raw"` to select the original Polygon pending feed. The response contains `ticket`, `expires_at`, `wss_url`, `feed`, and `subprotocol`. The [Ticket reference](/sm-fund-docs/reference/tickets.md) includes the response and error details.

Treat the Ticket as a secret. Request it immediately before connecting; `expires_at` is the deadline for the handshake, normally about 60 seconds after issuance. Each Ticket can establish a connection once.

## 3. Connect and receive

Use the response's `wss_url`, `feed`, and `subprotocol` exactly. Production responses use the `wss://stream.sm.fund/ws` endpoint; do not hardcode that URL, construct a feed URL, or substitute the requested feed or protocol. Send the ticket as:

```http
Authorization: Bearer YOUR_TICKET
```

Do not put the API Key or Ticket in the URL. Do not send a JSON-RPC subscribe message: delivery starts automatically when the connection opens. Text or binary messages sent by the client close the connection with code `1008`.

Run either complete example; both request a fresh Ticket and then receive three messages before closing:

* [Node.js with `ws`](/sm-fund-docs/examples/nodejs.md)
* [Python with `websockets`](/sm-fund-docs/examples/python.md)

## 4. Prepare your application

Your account has one connection across both feeds and all keys. Running an example while another client is connected replaces that client with code `4001`. Stop automatic retries on `4001` so clients do not repeatedly replace each other.

For longer-running clients, follow the [connection lifecycle](/sm-fund-docs/guides/connection-lifecycle.md) and [pending data](/sm-fund-docs/guides/pending-data.md) guides. A successful connection receives new observations; it does not replay earlier transactions or confirm their execution.
