> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revreply.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete an Agent

> Deletes an existing agent.

<Badge color="red">DELETE</Badge> `https://api.revreply.com/v1/agent/{agent}`

<Note>
  This endpoint requires authentication.
</Note>

## Try it

Use the following request to delete an agent:

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X DELETE "https://api.revreply.com/v1/agent/123" \
      -H "Authorization: Bearer <YOUR_JWT>" \
      -H "Accept: application/json" \
      -H "Content-Type: application/json"
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const agentId = 123;

    const response = await fetch(
      `https://api.revreply.com/v1/agent/${agentId}`,
      {
        method: "DELETE",
        headers: {
          "Authorization": "Bearer <YOUR_JWT>",
          "Accept": "application/json",
          "Content-Type": "application/json"
        }
      }
    );
    const data = await response.json();
    console.log(data);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    agent_id = 123

    response = requests.delete(
        f"https://api.revreply.com/v1/agent/{agent_id}",
        headers={
            "Authorization": "Bearer <YOUR_JWT>",
            "Accept": "application/json",
            "Content-Type": "application/json",
        },
    )
    data = response.json()
    print(data)
    ```
  </Tab>

  <Tab title="PHP">
    ```php theme={null}
    <?php
    $agentId = 123;

    $ch = curl_init("https://api.revreply.com/v1/agent/" . $agentId);

    curl_setopt_array($ch, [
        CURLOPT_CUSTOMREQUEST => "DELETE",
        CURLOPT_HTTPHEADER => [
            "Authorization: Bearer <YOUR_JWT>",
            "Accept: application/json",
            "Content-Type: application/json",
        ],
        CURLOPT_RETURNTRANSFER => true,
    ]);

    $response = curl_exec($ch);
    curl_close($ch);
    echo $response;
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    package main

    import (
        "fmt"
        "net/http"
    )

    func main() {
        req, _ := http.NewRequest(
            "DELETE",
            "https://api.revreply.com/v1/agent/123",
            nil,
        )

        req.Header.Set("Authorization", "Bearer <YOUR_JWT>")
        req.Header.Set("Accept", "application/json")
        req.Header.Set("Content-Type", "application/json")

        client := &http.Client{}
        response, _ := client.Do(req)
        fmt.Println(response.Status)
    }
    ```
  </Tab>
</Tabs>

## Authentication

This endpoint uses Bearer authentication with a JWT.

## Request

### Headers

| Header          | Type     | Required | Description                                                    |
| --------------- | -------- | -------- | -------------------------------------------------------------- |
| `Authorization` | `string` | Yes      | Bearer token used to authenticate the request.                 |
| `Accept`        | `string` | Yes      | Specifies that the client expects the response in JSON format. |
| `Content-Type`  | `string` | Yes      | Specifies that the request body is formatted as JSON.          |

```http theme={null}
Authorization: Bearer <YOUR_JWT>
Accept: application/json
Content-Type: application/json
```

### Path parameters

| Parameter | Type      | Required | Description                 | Example |
| --------- | --------- | -------- | --------------------------- | ------- |
| `agent`   | `integer` | Yes      | Agent/persona ID to delete. | `123`   |

### Request structure

This endpoint does not require a request body or query parameters.

### Request examples

The request is a `DELETE` request to:

```text theme={null}
https://api.revreply.com/v1/agent/123
```

## Response

### Response structure

A successful request returns an object containing a `success` value.

| Field     | Type      | Required | Description                                                           |
| --------- | --------- | -------- | --------------------------------------------------------------------- |
| `success` | `integer` | Yes      | Indicates whether the agent was successfully deleted. Success is `1`. |

### Response example

```json theme={null}
{
  "success": 1
}
```

## Errors

### 404 — Agent not found

Returned when the specified agent does not exist.

```json theme={null}
{
  "success": 0,
  "message": "Something went wrong"
}
```

### 500 — Server or integration error

Returned when the agent cannot be deleted because of a server or integration failure.

```json theme={null}
{
  "success": 0,
  "message": "Something went wrong"
}
```
