# Update WhatsApp inbox

> PATCH https://api.nabrah.ai/api/ext/omni_v2/whatsapp/inboxes

Group: WhatsApp. Page: https://www.nabrah.ai/en/docs/api-reference/whatsapp/update-whatsapp-inbox

Update the configuration of one of the project's WhatsApp inboxes, such as its WhatsApp Cloud API credentials, phone number details, webhook verify token, auto-assignment behavior, and display name. `api_key`, `business_account_id`, `phone_number_id` and `phone_number` are required on every update; leave out `name` or `enable_auto_assignment` to keep their current values. Leave out `webhook_verify_token` to keep the current token, or send a new value to change it. The response returns the updated inbox summary (`id`, `inbox_type`, `project_id`, `name`, `config`, `created_at`) and the agent answering on it (`chatbot_agent_id`, `chatbot_agent_name`).

## Configuration fields

These map to the WhatsApp Cloud API connection for the inbox.

- **WhatsApp Cloud API credentials**: `api_key` is the Meta access token, `business_account_id` is the WhatsApp Business Account (WABA) id, `phone_number_id` is the Cloud API phone number id, and `phone_number` is the human-readable number. Fields: `api_key`, `business_account_id`, `phone_number_id`, `phone_number`.
- **webhook_verify_token**: The verify token used when Meta validates the webhook subscription. Leave it out to keep the current token, or send a new value to change it. Fields: `webhook_verify_token`.
- **Behavior**: `enable_auto_assignment` toggles automatic assignment of new conversations to agents; `name` sets the inbox display name. Leave `enable_auto_assignment` out to keep the current setting. Fields: `enable_auto_assignment`, `name`.
- **Duplicate numbers**: Changing `phone_number_id` or `phone_number` to a number already connected to another WhatsApp inbox of the project returns 409. Fields: `phone_number_id`, `phone_number`.

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

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

## Body (application/json)

### Example: Update inbox config

```json
{
  "api_key": "EAAGm0PX4ZCpsBA...",
  "business_account_id": "104958611234567",
  "phone_number_id": "109876543210987",
  "phone_number": "+966512345678",
  "webhook_verify_token": "my-verify-token",
  "enable_auto_assignment": true,
  "name": "Support WhatsApp"
}
```

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "id": "00000000-0000-4000-8000-000000000000",
  "inbox_type": "whatsapp",
  "project_id": "00000000-0000-4000-8000-000000000000",
  "name": "string",
  "config": {},
  "created_at": "2026-01-15T12:00:00.000Z",
  "inbox_id": 0,
  "chatbot_agent_id": "00000000-0000-4000-8000-000000000000",
  "chatbot_agent_name": "string"
}
```

### 422 Validation Error

Content type: `application/json`

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

## Request examples

### cURL

```bash
curl --request PATCH \
  --url 'https://api.nabrah.ai/api/ext/omni_v2/whatsapp/inboxes' \
  --header 'X-API-Key: <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "api_key": "EAAGm0PX4ZCpsBA...",
  "business_account_id": "104958611234567",
  "phone_number_id": "109876543210987",
  "phone_number": "+966512345678",
  "webhook_verify_token": "my-verify-token",
  "enable_auto_assignment": true,
  "name": "Support WhatsApp"
}'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/omni_v2/whatsapp/inboxes"
headers = {
    "X-API-Key": "<your-api-key>",
}
payload = {
    "api_key": "EAAGm0PX4ZCpsBA...",
    "business_account_id": "104958611234567",
    "phone_number_id": "109876543210987",
    "phone_number": "+966512345678",
    "webhook_verify_token": "my-verify-token",
    "enable_auto_assignment": True,
    "name": "Support WhatsApp"
}

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

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/omni_v2/whatsapp/inboxes", {
  method: "PATCH",
  headers: {
    "X-API-Key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "api_key": "EAAGm0PX4ZCpsBA...",
    "business_account_id": "104958611234567",
    "phone_number_id": "109876543210987",
    "phone_number": "+966512345678",
    "webhook_verify_token": "my-verify-token",
    "enable_auto_assignment": true,
    "name": "Support WhatsApp"
  }),
});

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

### Go

```go
package main

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

func main() {
	payload := strings.NewReader(`{
  "api_key": "EAAGm0PX4ZCpsBA...",
  "business_account_id": "104958611234567",
  "phone_number_id": "109876543210987",
  "phone_number": "+966512345678",
  "webhook_verify_token": "my-verify-token",
  "enable_auto_assignment": true,
  "name": "Support WhatsApp"
}`)

	req, _ := http.NewRequest("PATCH", "https://api.nabrah.ai/api/ext/omni_v2/whatsapp/inboxes", payload)
	req.Header.Set("X-API-Key", "<your-api-key>")
	req.Header.Set("Content-Type", "application/json")

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

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