> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.brevo.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.brevo.com/_mcp/server.

# Update a message sent by an agent

PUT https://api.brevo.com/v3/conversations/messages/{id}
Content-Type: application/json

Update the text of a message sent by an agent. Only messages of type `agent` can be edited. The `text` and `html` fields of the message will be updated.

Reference: https://developers.brevo.com/reference/update-a-message-sent-by-an-agent

## Authentication

- `api-key` header (required) — The API key should be passed in the request headers as `api-key` for authentication.

## Request

### Path parameters

- `id` (string, required) — ID of the message

### Body (application/json)

This endpoint expects an object.

- `text` (string, required) — The new message text.

## Response

### 200

Updated message is returned as a response.

- `agentId` (string, optional) — ID of the agent on whose behalf the message was sent (only in messages sent by an agent).
- `agentName` (string, optional) — Agent’s name as displayed to the visitor. Only in the messages sent by an agent.
- `agentUserpic` (string, optional) — Only set if the agent has uploaded a profile picture.
- `attachments` (list of object, optional) — An array of file attachments.
  - `name` (string, optional) — The name of the file.
  - `link` (string, optional) — The URL of the file.
  - `mimeType` (string, optional) — The MIME type of the file.
  - `isImage` (boolean, optional) — `true` for images.
  - `isSticker` (boolean, optional) — `true` for sticker files.
  - `isInline` (boolean, optional) — `true` for inline files.
  - `inlineId` (string, optional) — The ID of the inline file.
  - `size` (long, optional) — The size of the file in bytes.
  - `imageInfo` (object, optional) — Image information (only present for image files).
    - `width` (long, optional) — Width of the image in pixels.
    - `height` (long, optional) — Height of the image in pixels.
    - `previewLink` (string, optional) — URL of the image preview.
  - `isAllowedFileType` (boolean, optional) — Whether the file extension is allowed for download.
- `bcc` (list of object, optional) — An array containing details of the blind carbon copy (BCC) recipients (applicable only to messages in email threads).
  - `email` (string, optional)
  - `name` (string, optional)
- `cc` (list of object, optional) — An array containing details of the carbon copy (CC) recipients (applicable only to messages in email threads).
  - `email` (string, optional)
  - `name` (string, optional)
- `createdAt` (long, optional) — Timestamp in milliseconds.
- `file` (object, optional)
  - `name` (string, optional) — Name of the file.
  - `link` (string, optional) — URL of the file.
  - `mimeType` (string, optional) — MIME type of the file.
  - `isImage` (boolean, optional) — Whether the file is an image.
  - `isSticker` (boolean, optional) — Whether the file is a sticker.
  - `isInline` (boolean, optional) — Whether the file is inline.
  - `inlineId` (string, optional) — The ID of the inline file.
  - `size` (long, optional) — Size in bytes.
  - `imageInfo` (object, optional) — Image info, present when the file is an image.
    - `width` (long, optional) — Width of the image in pixels.
    - `height` (long, optional) — Height of the image in pixels.
    - `previewLink` (string, optional) — URL of the image preview.
  - `isAllowedFileType` (boolean, optional) — Whether the file extension is allowed for download.
- `forwardedToSourceStatus` (object, optional) — Status of the message forwarding to the source.
  - `error` (string, optional)
  - `isSuccess` (boolean, optional)
- `from` (object, optional) — An object containing details about the email sender (applicable only to messages in email threads).
  - `email` (string, optional)
  - `name` (string, optional)
- `html` (string, optional) — The HTML content of the message.
- `id` (string, optional) — Message ID. It can be used for further manipulations with the message.
- `integrations` (object, optional) — Integration details.
- `isBot` (boolean, optional) — `true` for automated messages generated by an AI bot.
- `isMissed` (boolean, optional) — `true` for missed and offline messages.
- `isMissedByVisitor` (boolean, optional) — `true` for unread agent’s messages in finished chats.
- `isPushed` (boolean, optional) — `true` for pushed messages
- `isTrigger` (boolean, optional) — `true` for automatic messages from “Targeted chats & triggers” and API (https://developers.brevo.com/docs/javascript-api-reference#sendautomessage)
- `rawUnsafeHtml` (string, optional) — Unescaped HTML content of the message (may include unsafe HTML).
- `receivedFrom` (string, optional) — In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop.
- `replyTo` (object, optional) — An object containing details of the reply-to email address (applicable only to messages in email threads).
  - `email` (string, optional)
  - `name` (string, optional)
- `sourceMessageId` (string, optional) — The ID of the message assigned by the integration source.
- `subject` (string, optional) — The subject line of the email message (only for messages sent to email threads).
- `text` (string, optional) — Message text or name of the attached file
- `to` (list of object, optional) — An array containing details of the recipients (applicable only to messages in email threads).
  - `email` (string, optional)
  - `name` (string, optional)
- `type` (enum, optional) — `"agent"` for agents’ messages, `"visitor"` for visitors’ messages.
  - Allowed values: `agent`, `visitor`
- `isSentViaJsApi` (boolean, optional) — ‘`true` if the message was sent via JavaScript API.’
- `messageType` (string, optional) — The type of message content (e.g. for integration-specific message types).
- `isForward` (boolean, optional) — ‘`true` if the message is a forwarded message.’
- `source` (object, optional) — Source information for the message.
- `visitorId` (string, optional) — visitor’s ID

## Errors

### 400 Bad Request Error

bad request

- `code` (enum, required) — Error code displayed in case of a failure
  - Allowed values: `invalid_parameter`, `missing_parameter`, `out_of_range`, `campaign_processing`, `campaign_sent`, `document_not_found`, `not_enough_credits`, `permission_denied`, `duplicate_parameter`, `duplicate_request`, `method_not_allowed`, `unauthorized`, `account_under_validation`, `not_acceptable`, `bad_request`, `unprocessable_entity`, `Domain does not exist`, `Contact email not found`, `Attribute not found`, `Category id not found`, `Invalid parameters passed`, `Record(s) for identifier not found`, `Returned when query params are invalid`, `Returned when invalid data posted`, `Feed not found`, `Campaign ID not found`, `api-key not found`, `DMARC policy requires domain authentication`, `DNS records not properly configured`, `Invalid OTP code provided`, `OTP code has expired`, `Domain already exists in your account`, `The sum of all IP weights must equal 100`, `Authentication failed`, `Insufficient credits`, `Request already processed`
- `message` (string, required) — Readable message associated to the failure

### 404 Not Found Error

Returned when the message is not found.

- `message` (string, required) — Readable message associated to the failure
- `code` (string, optional) — Error code displayed in case of a failure

## Examples

### edited message

**Request**

```json
undefined
```

**Response**

```json
{
  "agentId": "d9nKoegKSjmCtyK78",
  "createdAt": 1482512803740,
  "html": "Good morning! How can I help you?",
  "id": "eYBEm3gq3zc5ayE2g",
  "isMissed": false,
  "isMissedByVisitor": false,
  "isPushed": false,
  "isTrigger": false,
  "receivedFrom": "SuperAwesomeHelpdesk",
  "text": "Good morning! How can I help you?",
  "type": "agent",
  "visitorId": "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg"
}
```

**SDK Code**

```typescript edited message
import { BrevoClient } from "@getbrevo/brevo";

async function main() {
    const client = new BrevoClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.conversations.updateAMessageSentByAnAgent({
        id: "id",
    });
}
main();

```

```python edited message
from brevo import Brevo

client = Brevo(
    api_key="YOUR_API_KEY_HERE",
)

client.conversations.update_a_message_sent_by_an_agent(
    id="id",
)

```

```php edited message
<?php

namespace Example;

use Brevo\Brevo;
use Brevo\Conversations\Requests\PutConversationsMessagesIdRequest;

$client = new Brevo(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->conversations->updateAMessageSentByAnAgent(
    'id',
    new PutConversationsMessagesIdRequest([]),
);

```

```go edited message
package main

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

func main() {

	url := "https://api.brevo.com/v3/conversations/messages/id"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby edited message
require 'uri'
require 'net/http'

url = URI("https://api.brevo.com/v3/conversations/messages/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java edited message
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.brevo.com/v3/conversations/messages/id")
  .header("api-key", "<apiKey>")
  .asString();
```

```csharp edited message
using RestSharp;

var client = new RestClient("https://api.brevo.com/v3/conversations/messages/id");
var request = new RestRequest(Method.PUT);
request.AddHeader("api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift edited message
import Foundation

let headers = ["api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.brevo.com/v3/conversations/messages/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### edition

**Request**

```json
{
  "text": "Good morning! How can I help you?"
}
```

**Response**

```json
{
  "agentId": "d9nKoegKSjmCtyK78",
  "createdAt": 1482512803740,
  "html": "Good morning! How can I help you?",
  "id": "eYBEm3gq3zc5ayE2g",
  "isMissed": false,
  "isMissedByVisitor": false,
  "isPushed": false,
  "isTrigger": false,
  "receivedFrom": "SuperAwesomeHelpdesk",
  "text": "Good morning! How can I help you?",
  "type": "agent",
  "visitorId": "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg"
}
```

**SDK Code**

```typescript edition
import { BrevoClient } from "@getbrevo/brevo";

async function main() {
    const client = new BrevoClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.conversations.updateAMessageSentByAnAgent({
        id: "id",
        text: "Good morning! How can I help you?",
    });
}
main();

```

```python edition
from brevo import Brevo

client = Brevo(
    api_key="YOUR_API_KEY_HERE",
)

client.conversations.update_a_message_sent_by_an_agent(
    id="id",
    text="Good morning! How can I help you?",
)

```

```php edition
<?php

namespace Example;

use Brevo\Brevo;
use Brevo\Conversations\Requests\PutConversationsMessagesIdRequest;

$client = new Brevo(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->conversations->updateAMessageSentByAnAgent(
    'id',
    new PutConversationsMessagesIdRequest([
        'text' => 'Good morning! How can I help you?',
    ]),
);

```

```go edition
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.brevo.com/v3/conversations/messages/id"

	payload := strings.NewReader("{\n  \"text\": \"Good morning! How can I help you?\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby edition
require 'uri'
require 'net/http'

url = URI("https://api.brevo.com/v3/conversations/messages/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"text\": \"Good morning! How can I help you?\"\n}"

response = http.request(request)
puts response.read_body
```

```java edition
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.brevo.com/v3/conversations/messages/id")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"text\": \"Good morning! How can I help you?\"\n}")
  .asString();
```

```csharp edition
using RestSharp;

var client = new RestClient("https://api.brevo.com/v3/conversations/messages/id");
var request = new RestRequest(Method.PUT);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"text\": \"Good morning! How can I help you?\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift edition
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["text": "Good morning! How can I help you?"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.brevo.com/v3/conversations/messages/id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```