# Remove the agent from a TikTok account

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

Group: TikTok. Page: https://www.nabrah.ai/en/docs/api-reference/tiktok/remove-the-agent-from-a-tiktok-account

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

## Effect

After unassigning, incoming TikTok direct messages on that account are no longer answered automatically by an AI agent.

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

## Choosing the TikTok account

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

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

List the accounts and their ids with GET /api/ext/omni_v2/tiktok/inboxes.

## Errors

- **409 Conflict**: Another change to the same account's agent is still being saved. Wait a moment, then try again; GET /api/ext/omni_v2/tiktok/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 TikTok account to use, from GET /api/ext/omni_v2/tiktok/inboxes. Use `inboxes[].id` (a UUID), not the numeric `inboxes[].inbox_id`. Optional while the project has one TikTok account; required once it has more than one.

## Response

### 200 Successful Response

Content type: `application/json`

```json
0
```

### 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/tiktok/unassign_chatbot' \
  --header 'X-API-Key: <your-api-key>'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/omni_v2/tiktok/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/tiktok/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/tiktok/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))
}
```
