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

# Reconnect Instance

> Reactivates the whatsmeow client without invalidating the session (no QR re-scan required)

**Auth:** `TokenAccount` or `TokenInstance` • **Rate-limit:** `Global` (100/min) • **Idempotent:** partial

## Description

Reuses the whatsmeow session already stored to re-establish the connection **without a new QR/pairing**. Works if the instance has been connected at least once (session saved in whatsmeow\_device).

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://ryzeapi.cloud/api/instance/reconnect/my-instance" \
    -H "token: $Token_Instance"
  ```

  ```javascript JavaScript theme={null}
  await fetch("https://ryzeapi.cloud/api/instance/reconnect/my-instance", {
    method: "POST",
    headers: {
      "token": process.env.Token_Instance
    }
  });
  ```

  ```python Python theme={null}
  import os, requests

  requests.post(
      "https://ryzeapi.cloud/api/instance/reconnect/my-instance",
      headers={
          "token": os.environ["Token_Instance"]
      }
  )
  ```

  ```go Go theme={null}
  package main

  import (
      "net/http"
      "os"
  )

  func main() {
      req, _ := http.NewRequest("POST", "https://ryzeapi.cloud/api/instance/reconnect/my-instance", nil)
      req.Header.Set("token", os.Getenv("Token_Instance"))
      http.DefaultClient.Do(req)
  }
  ```
</CodeGroup>

## Success response

```json 200 OK theme={null}
{
  "success": true,
  "message": "Reconnect initiated",
  "status": "connecting"
}
```

After the call, poll [`GET /api/instance/list?instanceName=<name>`](/en/api/instance/list) to detect when the state becomes `connected`. The `instance.state` event is also emitted via webhook/WebSocket.

## Path parameters

<ParamField path="instance" type="string" required>
  Instance name.
</ParamField>

## Headers

<ParamField header="token" type="string" required>
  TokenAccount or TokenInstance.
</ParamField>

<Note>
  Body is accepted but **ignored**, you can send it empty.
</Note>

## Errors

| HTTP | `error.message`                                      | When                                                              |
| :--: | ---------------------------------------------------- | ----------------------------------------------------------------- |
|  400 | `Instance has no saved session, call /connect first` | No session to reuse (instance never connected or was logged out). |
|  401 | `Invalid token`                                      | Token missing or invalid.                                         |
|  404 | `Instance not found`                                 | Name does not exist.                                              |
|  429 | `Rate limit exceeded. Try again later.`              | More than 100 req/min.                                            |
|  500 | `Failed to reconnect: <reason>`                      | Failure in `Connect()` (network, proxy, DNS).                     |

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Instance has no saved session, call /connect first"
  }
}
```

## Notes

<Note>
  **Difference from `connect`**: `connect` always (re)creates a new client and generates QR/pairing. `reconnect` reuses an existing session, **does not work** if the instance has never connected or was logged out from the phone side.
</Note>

<Warning>
  If WhatsApp logged out the device (`loggedout` state), `reconnect` fails with 400. Use [`connect`](/en/api/instance/connect) to generate a new QR.
</Warning>

## Next

<CardGroup cols={2}>
  <Card title="Connect (QR/pairing)" icon="qrcode" href="/en/api/instance/connect">
    To reconnect when the session has been lost.
  </Card>

  <Card title="Logout" icon="right-from-bracket" href="/en/api/instance/logout">
    Logs the device out of WhatsApp while keeping the instance.
  </Card>
</CardGroup>
