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

# Connect Session

> Start a WhatsApp session connection

Initialize a connection to WhatsApp servers. If no existing session, it will generate a QR code for pairing.

## Request Body

<ParamField body="subscribe" type="string[]">
  Event types to receive via webhook. Options:

  * `Message` - Incoming messages
  * `ReadReceipt` - Read receipts
  * `HistorySync` - Chat history
  * `ChatPresence` - Online/typing status
</ParamField>

<ParamField body="immediate" type="boolean">
  If `false`, waits 10 seconds to verify successful login. Default: `true`
</ParamField>

## Response Fields

<ResponseField name="data.jid" type="string">
  Your WhatsApp JID if logged in
</ResponseField>

<ResponseField name="data.events" type="string">
  Subscribed event types
</ResponseField>

<ResponseField name="data.webhook" type="string">
  Configured webhook URL
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.livchat.ai/v1/session/connect \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "subscribe": ["Message", "ReadReceipt"],
      "immediate": false
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://api.livchat.ai/v1/session/connect", {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      subscribe: ["Message", "ReadReceipt"],
      immediate: false,
    }),
  });
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "code": 200,
    "data": {
      "details": "Connected!",
      "events": "Message,ReadReceipt",
      "jid": "5511999999999.0:52@s.whatsapp.net",
      "webhook": "https://your-site.com/webhook"
    }
  }
  ```
</ResponseExample>
