# Remove the agent from a WhatsApp number

> DELETE https://api.nabrah.ai/api/ext/omni_v2/whatsapp/unassign_chatbot

Group: WhatsApp. Page: https://www.nabrah.ai/en/docs/api-reference/whatsapp/remove-the-agent-from-a-whatsapp-number

Remove the agent from one of the project's WhatsApp numbers, stopping automatic AI replies on that number. The agent keeps answering on its other numbers with their settings unchanged. The response is an object confirming the operation.

## Effect

After unassigning, incoming WhatsApp messages on that number are no longer answered automatically by an AI agent.

Check the current assignment first with GET /api/ext/omni_v2/whatsapp/get_chatbot, and re-attach later with POST /api/ext/omni_v2/whatsapp/assign_chatbot.

## Choosing the WhatsApp number

A project can connect more than one WhatsApp number. `inbox_id` selects the number this call works on.

- **One number**: `inbox_id` is optional; the project's only WhatsApp number is used.
- **More than one number**: `inbox_id` is required and the call returns 400 without it. An id that is not one of the project's WhatsApp numbers returns 404. Fields: `inbox_id`.

List the numbers and their ids with GET /api/ext/omni_v2/whatsapp/inboxes.

## Errors

- **409 Conflict**: Another change to the same number's agent is still being saved. Wait a moment, then try again; GET /api/ext/omni_v2/whatsapp/get_chatbot shows the result once it is saved.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Query parameters

- `inbox_id` (string, optional): The `id` of the WhatsApp number to use, from GET /api/ext/omni_v2/whatsapp/inboxes. Use `inboxes[].id` (a UUID), not the numeric `inboxes[].inbox_id`. Optional while the project has one WhatsApp number; required once it has more than one.

## Response

### 200 Successful Response

Content type: `application/json`

### 422 Validation Error

Content type: `application/json`

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

## Request examples

### cURL

```bash
curl --request DELETE \
  --url 'https://api.nabrah.ai/api/ext/omni_v2/whatsapp/unassign_chatbot' \
  --header 'X-API-Key: <your-api-key>'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/omni_v2/whatsapp/unassign_chatbot"
headers = {"X-API-Key": "<your-api-key>"}

response = requests.delete(url, headers=headers)
response.raise_for_status()
print(response.json())
```

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/omni_v2/whatsapp/unassign_chatbot", {
  method: "DELETE",
  headers: { "X-API-Key": "<your-api-key>" },
});

const data = await response.json();
console.log(data);
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("DELETE", "https://api.nabrah.ai/api/ext/omni_v2/whatsapp/unassign_chatbot", nil)
	req.Header.Set("X-API-Key", "<your-api-key>")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```
