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

# Partially Update an Agent

> Partially updates an existing agent with the specified configuration.

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

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

## Try it

Use the following request to partially update an agent:

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X PATCH "https://api.revreply.com/v1/agent/123" \
      -H "Authorization: Bearer <YOUR_JWT>" \
      -H "Accept: application/json" \
      -H "Content-Type: application/json" \
      -d '{
        "agent_name": "Updated Sales Agent",
        "status": 1
      }'
    ```
  </Tab>

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

    const response = await fetch(
      `https://api.revreply.com/v1/agent/${agentId}`,
      {
        method: "PATCH",
        headers: {
          "Authorization": "Bearer <YOUR_JWT>",
          "Accept": "application/json",
          "Content-Type": "application/json"
        },
        body: JSON.stringify({
          agent_name: "Updated Sales Agent",
          status: 1
        })
      }
    );
    const data = await response.json();
    console.log(data);
    ```
  </Tab>

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

    agent_id = 123

    response = requests.patch(
        f"https://api.revreply.com/v1/agent/{agent_id}",
        headers={
            "Authorization": "Bearer <YOUR_JWT>",
            "Accept": "application/json",
            "Content-Type": "application/json",
        },
        json={
            "agent_name": "Updated Sales Agent",
            "status": 1,
        },
    )
    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 => "PATCH",
        CURLOPT_HTTPHEADER => [
            "Authorization: Bearer <YOUR_JWT>",
            "Accept: application/json",
            "Content-Type: application/json",
        ],
        CURLOPT_POSTFIELDS => json_encode([
            "agent_name" => "Updated Sales Agent",
            "status" => 1,
        ]),
        CURLOPT_RETURNTRANSFER => true,
    ]);

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

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

    import (
        "bytes"
        "fmt"
        "net/http"
    )

    func main() {
        body := []byte(`{
          "agent_name": "Updated Sales Agent",
          "status": 1
        }`)

        req, _ := http.NewRequest(
            "PATCH",
            "https://api.revreply.com/v1/agent/123",
            bytes.NewBuffer(body),
        )

        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. | `123`   |

### Body

The request body uses the `UpdateAgentRequest` schema. The schema inherits the fields from `CreateAgentRequest`; `agent_name` is required by the schema, while the other fields are optional.

| Field                | Type      | Required | Description                                                                          |
| -------------------- | --------- | -------- | ------------------------------------------------------------------------------------ |
| `agent_name`         | `string`  | Yes      | Name of the agent. Maximum length: 25 characters.                                    |
| `first_name`         | `string`  | No       | Agent's first name. Maximum length: 25 characters.                                   |
| `last_name`          | `string`  | No       | Agent's last name. Maximum length: 25 characters.                                    |
| `email`              | `string`  | No       | Agent email address. Must be a valid email address and is limited to 100 characters. |
| `company`            | `string`  | No       | Company name. Maximum length: 75 characters.                                         |
| `company_website`    | `string`  | No       | Company website. Maximum length: 100 characters.                                     |
| `generate_profile`   | `boolean` | No       | Whether to generate the agent profile. Defaults to `false`.                          |
| `company_overview`   | `string`  | No       | Description of the company.                                                          |
| `context`            | `string`  | No       | Additional context about the company or product.                                     |
| `tone`               | `integer` | No       | Agent tone value from `0` to `6`.                                                    |
| `agent_objective`    | `integer` | No       | Agent objective: `1` for Schedule Meeting or `2` for Other.                          |
| `timezone`           | `string`  | No       | Agent timezone identifier.                                                           |
| `office_hours_from`  | `string`  | No       | Office start time in `HH:MM` format.                                                 |
| `office_hours_to`    | `string`  | No       | Office end time in `HH:MM` format.                                                   |
| `exclude_weekends`   | `boolean` | No       | Whether weekends should be excluded.                                                 |
| `objective`          | `string`  | No       | Agent objective or instructions. Maximum length: 500 characters.                     |
| `soft_no`            | `boolean` | No       | Whether soft-no handling is enabled.                                                 |
| `soft_no_response`   | `string`  | No       | Response used for soft-no handling. Maximum length: 200 characters.                  |
| `meeting_link`       | `string`  | No       | Meeting URL. Maximum length: 100 characters.                                         |
| `calendar_link`      | `string`  | No       | Calendar URL. Maximum length: 100 characters.                                        |
| `status`             | `integer` | No       | Agent status, from `0` to `1`.                                                       |
| `followup_days1`     | `integer` | No       | Number of days before the first follow-up.                                           |
| `followup_days2`     | `integer` | No       | Number of days before the second follow-up.                                          |
| `followup_days3`     | `integer` | No       | Number of days before the third follow-up.                                           |
| `followup_intervals` | `array`   | No       | Follow-up interval configuration. Maximum 5 items.                                   |
| `google`             | `object`  | No       | Google calendar credentials.                                                         |
| `outlook`            | `object`  | No       | Outlook calendar credentials.                                                        |
| `calendly`           | `object`  | No       | Calendly credentials.                                                                |

### Request structure

For a partial update, include only the fields that need to be changed.

```json theme={null}
{
  "agent_name": "Updated Sales Agent",
  "status": 1
}
```

### Request examples

The request is a `PATCH` request to:

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

## Response

### Response structure

A successful request returns an object containing the updated agent.

| Field     | Type      | Required | Description                                     |
| --------- | --------- | -------- | ----------------------------------------------- |
| `success` | `integer` | Yes      | Indicates whether the operation was successful. |
| `data`    | `object`  | Yes      | The updated agent.                              |

### Response example

```json theme={null}
{
  "success": 1,
  "data": {
    "id": 123,
    "name": "Updated Sales Agent",
    "status": 1,
    "agent_objective": "Schedule Meeting",
    "timezone": "America/New_York",
    "office_hours_from": "09:00",
    "office_hours_to": "17:00",
    "exclude_weekends": true,
    "calendar_link": "https://calendly.com/example",
    "meeting_link": "https://zoom.us/j/123456",
    "objective": "Generate qualified sales meetings",
    "tone": "Professional"
  }
}
```

## Errors

### 404 — Agent not found

Returned when the specified agent does not exist.

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

### 422 — Validation error

Returned when one or more request fields fail validation.

```json theme={null}
{
  "success": 0,
  "message": "Validation failed",
  "errors": {}
}
```

### 500 — Server or integration error

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

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