# Interrupt the agent (/en/api-reference/api-ref/conversational-ai/interrupt)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Interrupts a specified agent while it is speaking or thinking.

- OpenAPI: /openapi/conversational-ai/rest-api.en.yaml
- Operation ID: agent-interrupt
- Method: POST
- Path: /v2/projects/{appid}/agents/{agentId}/interrupt
- Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/interrupt

## Servers

- https://api.agora.io/api/conversational-ai-agent

Use this endpoint to interrupt the specified agent while speaking or thinking.


## Authorization

This endpoint requires authentication.

- `tokenAuth`
- `basicAuth`

## Parameters

- `appid` (path, required, string) - The App ID of the project.
- `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join).

### Request body

The request body is empty.


## Request body

No request body.

## Request examples

### curl

```bash
curl --request POST \
  --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/interrupt \
  --header 'Authorization: Basic <credentials>' \
  --data '{}'
```

### Python

```python
import requests

url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/interrupt"

payload = {}
headers = {"Authorization": "Basic <credentials>"}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

### Node.js

```javascript
const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/interrupt';
const options = {
  method: 'POST',
  headers: {Authorization: 'Basic <credentials>'},
  body: JSON.stringify({})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```


### Response

- If the returned status code is `200`, the request was successful. The response body contains agent information and the agent stops talking and thinking immediately.
- If the returned status code is not `200`, the request failed. The response body includes the error code and description. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure.


## Responses

### 200

The request was successful. The response body contains agent information and the agent stops talking and thinking immediately.

No schema.
### default

The request failed. The response body includes the error details.

- `detail` (string) - Detailed error information.
- `reason` (string) - The reason for the failure.
