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

# Quickstart

> Sign up, create your first app, and sync your first document in minutes.

## 1. Sign Up

Create your WireSocket account at [dashboard.wiresocket.com](https://dashboard.wiresocket.com).

Your tenant account is free. No credit card required to get started.

***

## 2. Create an OAuth 2 Application

To connect to the WireSocket dataplane, a **JWT access token** is required. Tokens are issued through an **OAuth 2 Machine-to-Machine (M2M)** flow — to set this up, first create an OAuth 2 app in the dashboard.

<Steps>
  <Step title="Open the Apps section">
    Navigate to **Apps** in the dashboard sidebar and click **Add Application**.
  </Step>

  <Step title="Name your app">
    Give your app a name that identifies the product or service connecting to WireSocket (e.g. `my-editor-prod`).
  </Step>

  <Step title="Set the License Region">
    Choose the **License Region** for this app. This defines where your app's license and plan data is stored.

    <Warning>
      The License Region is a "set-once" property. These regions are prefixed with `aws-` (e.g., `aws-us-east-1`). Choose the one closest to your primary user base.
    </Warning>
  </Step>

  <Step title="Save your credentials">
    After creation, copy your **Client ID** and **Client Secret** immediately. The secret is shown only once.

    <Warning>
      Never expose your `client_secret` in browser code or public repositories. It is a server-side credential only.
    </Warning>
  </Step>
</Steps>

***

## 3. Activate a Plan

Your app cannot connect to the WireSocket dataplane until a plan is active.

Open your app from the **Apps** list and go to the **Plans** tab. Select the plan that fits your needs — including **Free** — and click **Subscribe** to activate it.

<Warning>
  Each app requires its own plan. An app without an active plan cannot issue
  tokens or connect to the dataplane.
</Warning>

<Info>
  Only one app per account can be on the Free plan. Additional apps require a
  paid plan to activate dataplane access.
</Info>

***

## 4. Get an Access Token

Exchange your credentials for a JWT access token from your **backend server**.

```bash theme={null}
curl -X POST https://api.wiresocket.com/connect/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_CLIENT_SECRET" \
  -d "scope=WireSocket.API offline_access"
```

**Response:**

```json theme={null}
{
  "access_token": "eyJ...",
  "refresh_token": "eyJ...",
  "token_type": "Bearer",
  "expires_in": 900
}
```

<Info>
  Access tokens are valid for **15 minutes**. Use the `refresh_token` to obtain
  a new access token without re-authenticating. See [Token
  Renewal](/authentication) for implementation guidance.
</Info>

The JWT contains your app's plan limits. The WireSocket dataplane reads these claims directly — no database lookup required.

***

## 5. Connect to the Dataplane

Pass the access token when connecting your Yjs provider to the WireSocket dataplane. Two methods are supported:

<Tabs>
  <Tab title="WebSocket Subprotocol (Recommended)">
    ```js theme={null}
    import * as Y from 'yjs'
    import { WebsocketProvider } from 'y-websocket'

    const ydoc = new Y.Doc()

    const provider = new WebsocketProvider(
    'wss://eu-central-1.wiresocket.net',
    'your-document-id',
    ydoc,
    {
    protocols: ['Bearer', 'YOUR_ACCESS_TOKEN']
    }
    )

    ```

    Preferred — keeps the token out of server access logs and browser history.
  </Tab>

  <Tab title="URL Parameter">
    ```js theme={null}
    import * as Y from 'yjs'
    import { WebsocketProvider } from 'y-websocket'

    const ydoc = new Y.Doc()

    const provider = new WebsocketProvider(
      'wss://eu-central-1.wiresocket.net?access_token=YOUR_ACCESS_TOKEN',
      'your-document-id',
      ydoc
    )
    ```
  </Tab>
</Tabs>

***

## You're Connected

Your Yjs document is now syncing through WireSocket. Any changes made by connected clients are propagated in real-time.

<CardGroup cols={2}>
  <Card title="Token Renewal & Auth" icon="key-skeleton" href="/authentication">
    Implement refresh token rotation and keep connections alive beyond 15
    minutes.
  </Card>

  <Card title="Dataplane & Editor Setup" icon="plug" href="/dataplane">
    Handle regions, reconnection logic, and editor integration.
  </Card>
</CardGroup>
