> ## 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.

# Delete Instance

> Removes the instance and all of its data. Irreversible operation

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

<Warning>
  **Irreversible operation.** It logs out from WhatsApp, removes the whatsmeow session and wipes every record from the database (settings, webhook, websocket, chatwoot, settings, S3 and the instance itself). Back up anything you need beforehand.
</Warning>

<Note>
  Does not accept **TokenInstance**, an instance cannot ask for its own removal. Use the **TokenAccount** of the owner account.
</Note>

## Example

Sends a `DELETE` to the instance path using the **TokenAccount**. The operation is irreversible: it terminates the whatsmeow session, logs out from WhatsApp and removes every record from the database (settings, webhook, websocket, chatwoot, proxy, S3 and the instance itself).

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

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

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

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

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

  import (
      "net/http"
      "os"
  )

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

## Success response

```json 200 OK theme={null}
{
  "success": true,
  "message": "Instance deleted",
  "instance": {
    "status": "deleted"
  }
}
```

## Path parameters

<ParamField path="instance" type="string" required>
  Name of the instance to delete.
</ParamField>

## Headers

<ParamField header="token" type="string" required>
  Your **TokenAccount** (only the instance owner can delete it).
</ParamField>

## What happens on delete

* If the instance was connected, RyzeAPI performs a **WhatsApp logout** (the device disappears from the linked-devices list on the phone).
* Webhooks, WebSocket, Chatwoot integration and settings are removed.
* All instance records are wiped from the database.
* If you had S3 configured, **files already uploaded to the bucket are not deleted**, manage the bucket separately.

## Errors

| HTTP | `error.message`                         | When                                                      |
| :--: | --------------------------------------- | --------------------------------------------------------- |
|  401 | `Invalid token`                         | Token missing, invalid or a TokenInstance (not accepted). |
|  404 | `Instance not found`                    | Name does not exist.                                      |
|  429 | `Rate limit exceeded. Try again later.` | More than 100 req/min.                                    |
|  500 | `Failed to delete instance: <reason>`   | Internal failure during teardown.                         |

```json theme={null}
{
  "success": false,
  "error": {
    "message": "Failed to delete instance: <reason>"
  }
}
```

## Notes

<Warning>
  After deletion, creating a new instance with the **same name** may occasionally conflict with the asynchronous whatsmeow cleanup. If that happens, wait a few seconds and try again.
</Warning>

## Next

<CardGroup cols={2}>
  <Card title="Create a new instance" icon="plus" href="/en/api/instance/create">
    Provisions a new one in its place, optionally with inline webhook, websocket and chatwoot.
  </Card>

  <Card title="Logout without deleting" icon="right-from-bracket" href="/en/api/instance/logout">
    If you only want to disconnect from WhatsApp while keeping the instance.
  </Card>
</CardGroup>
