# Stop a Real-time STT agent (/en/api-reference/api-ref/speech-to-text/leave)

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

Stops a Real-time STT task and leaves the channel.

- OpenAPI: /openapi/speech-to-text/v7.en.yaml
- Operation ID: leave
- Method: POST
- Path: /api/speech-to-text/v1/projects/{appid}/agents/{agentId}/leave
- Endpoint: https://api.agora.io/api/speech-to-text/v1/projects/{appid}/agents/{agentId}/leave

## Servers

- https://api.agora.io

Use this method to leave the channel and stop Real-time STT.


## Authorization

This endpoint requires authentication.

- `BasicAuth`

## Parameters

- `appid` (path, required, string) - The App ID of the project.
- `agentId` (path, required, string) - The unique identifier of the agent you received in the response body of the `join` method.

## Request body

No request body.

## Request examples

### curl

```bash
curl --request POST \
  --url https://api.agora.io/api/speech-to-text/v1/projects/:appid/agents/:agentId/leave \
  --header 'Authorization: Basic <credentials>'
```

### Python

```python
import requests

url = "https://api.agora.io/api/speech-to-text/v1/projects/:appid/agents/:agentId/leave"

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

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

print(response.text)
```

### Node.js

```javascript
const url = 'https://api.agora.io/api/speech-to-text/v1/projects/:appid/agents/:agentId/leave';
const options = {method: 'POST', headers: {Authorization: 'Basic <credentials>'}};

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.

- If the returned status code is not `200`, the request failed.


## Responses

### 200

OK

No schema.
### default

Error response.

No schema.
