Update email message
curl --request PATCH \
--url https://app.gtm-api.com/email/v4/api/email-messages/{sid} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"is_read": true,
"is_flagged": true,
"email_folder_sids": [
"<string>"
],
"client_reference": "<string>"
}
'import requests
url = "https://app.gtm-api.com/email/v4/api/email-messages/{sid}"
payload = {
"is_read": True,
"is_flagged": True,
"email_folder_sids": ["<string>"],
"client_reference": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Team-SID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
Authorization: 'Bearer <token>',
'Team-SID': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
is_read: true,
is_flagged: true,
email_folder_sids: ['<string>'],
client_reference: '<string>'
})
};
fetch('https://app.gtm-api.com/email/v4/api/email-messages/{sid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gtm-api.com/email/v4/api/email-messages/{sid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'is_read' => true,
'is_flagged' => true,
'email_folder_sids' => [
'<string>'
],
'client_reference' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Team-SID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.gtm-api.com/email/v4/api/email-messages/{sid}"
payload := strings.NewReader("{\n \"is_read\": true,\n \"is_flagged\": true,\n \"email_folder_sids\": [\n \"<string>\"\n ],\n \"client_reference\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Team-SID", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://app.gtm-api.com/email/v4/api/email-messages/{sid}")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"is_read\": true,\n \"is_flagged\": true,\n \"email_folder_sids\": [\n \"<string>\"\n ],\n \"client_reference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/email/v4/api/email-messages/{sid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Team-SID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"is_read\": true,\n \"is_flagged\": true,\n \"email_folder_sids\": [\n \"<string>\"\n ],\n \"client_reference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "update",
"item": {
"sid": "<string>",
"team_sid": "<string>",
"email_account_sid": "<string>",
"email_thread_sid": "<string>",
"internet_message_id": "<string>",
"provider_message_id": "<string>",
"direction": "inbound",
"status": "received",
"kind": "regular",
"in_reply_to_email_message_sid": "<string>",
"bounce_type": "hard",
"bounce_code": "<string>",
"bounce_diagnostic": "<string>",
"from": {
"email": "<string>",
"display_name": "<string>"
},
"to": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"cc": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"bcc": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"reply_to": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"subject": "<string>",
"snippet": "<string>",
"is_body_synced": true,
"attachments": [
{
"id": "<string>",
"name": "<string>",
"mime": "<string>",
"size": 1,
"content_id": "<string>",
"is_inline": true
}
],
"has_attachments": true,
"email_folder_sids": [
"<string>"
],
"folder_role": "inbox",
"is_read": true,
"client_reference": "<string>",
"first_opened_at": "<string>",
"opens_count": 123,
"first_clicked_at": "<string>",
"clicks_count": 123,
"unsubscribed_at": "<string>",
"sent_at": "<string>",
"scheduled_at": "<string>",
"created_by": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"body_html": "<string>",
"body_text": "<string>",
"headers": [
{
"name": "<string>",
"value": "<string>"
}
],
"body_html_sanitized": "<string>",
"body_text_unquoted": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"is_flagged": true,
"is_answered": true,
"deleted_at": "<string>"
},
"updated_fields": [
"<string>"
],
"previous_values": {},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}email_messages
Update email message
Change a message’s read state, flag, folders or your own key, in the mailbox at its provider too: the provider is written first and the row follows only when it accepted (503 provider_update_failed leaves the row as it was). email_folder_sids is the full membership wanted: several labels on Gmail, exactly one folder on Microsoft and IMAP. A scheduled message takes client_reference only. The client_reference of an outbound message that was sent or tried is frozen (409 client_reference_frozen), since a repeat of the send is found by it. To take a message out of the inbox use archive_email_message; a whole thread read at once is mark_email_thread_read. Requires can_act_email_messages.
Contract:
- MCP tool
update_email_message, registry packagemcp.email/email_messages, mountemail.messaging. - Operation
update, response envelopeupdate. - Flags: none.
PATCH
/
api
/
email-messages
/
{sid}
Update email message
curl --request PATCH \
--url https://app.gtm-api.com/email/v4/api/email-messages/{sid} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Team-SID: <api-key>' \
--data '
{
"is_read": true,
"is_flagged": true,
"email_folder_sids": [
"<string>"
],
"client_reference": "<string>"
}
'import requests
url = "https://app.gtm-api.com/email/v4/api/email-messages/{sid}"
payload = {
"is_read": True,
"is_flagged": True,
"email_folder_sids": ["<string>"],
"client_reference": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Team-SID": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
Authorization: 'Bearer <token>',
'Team-SID': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
is_read: true,
is_flagged: true,
email_folder_sids: ['<string>'],
client_reference: '<string>'
})
};
fetch('https://app.gtm-api.com/email/v4/api/email-messages/{sid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gtm-api.com/email/v4/api/email-messages/{sid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'is_read' => true,
'is_flagged' => true,
'email_folder_sids' => [
'<string>'
],
'client_reference' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Team-SID: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.gtm-api.com/email/v4/api/email-messages/{sid}"
payload := strings.NewReader("{\n \"is_read\": true,\n \"is_flagged\": true,\n \"email_folder_sids\": [\n \"<string>\"\n ],\n \"client_reference\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Team-SID", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://app.gtm-api.com/email/v4/api/email-messages/{sid}")
.header("Authorization", "Bearer <token>")
.header("Team-SID", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"is_read\": true,\n \"is_flagged\": true,\n \"email_folder_sids\": [\n \"<string>\"\n ],\n \"client_reference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.gtm-api.com/email/v4/api/email-messages/{sid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Team-SID"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"is_read\": true,\n \"is_flagged\": true,\n \"email_folder_sids\": [\n \"<string>\"\n ],\n \"client_reference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"operation": "update",
"item": {
"sid": "<string>",
"team_sid": "<string>",
"email_account_sid": "<string>",
"email_thread_sid": "<string>",
"internet_message_id": "<string>",
"provider_message_id": "<string>",
"direction": "inbound",
"status": "received",
"kind": "regular",
"in_reply_to_email_message_sid": "<string>",
"bounce_type": "hard",
"bounce_code": "<string>",
"bounce_diagnostic": "<string>",
"from": {
"email": "<string>",
"display_name": "<string>"
},
"to": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"cc": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"bcc": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"reply_to": [
{
"email": "<string>",
"display_name": "<string>"
}
],
"subject": "<string>",
"snippet": "<string>",
"is_body_synced": true,
"attachments": [
{
"id": "<string>",
"name": "<string>",
"mime": "<string>",
"size": 1,
"content_id": "<string>",
"is_inline": true
}
],
"has_attachments": true,
"email_folder_sids": [
"<string>"
],
"folder_role": "inbox",
"is_read": true,
"client_reference": "<string>",
"first_opened_at": "<string>",
"opens_count": 123,
"first_clicked_at": "<string>",
"clicks_count": 123,
"unsubscribed_at": "<string>",
"sent_at": "<string>",
"scheduled_at": "<string>",
"created_by": {
"actor_type": "user",
"actor_sid": "<string>",
"team_sid": "<string>",
"permissions": {},
"actor_name": "<string>",
"oauth_client_sid": "<string>",
"reason": "<string>",
"cluster_id": 123,
"trace_id": "<string>"
},
"body_html": "<string>",
"body_text": "<string>",
"headers": [
{
"name": "<string>",
"value": "<string>"
}
],
"body_html_sanitized": "<string>",
"body_text_unquoted": "<string>",
"created_at": "<string>",
"updated_at": "<string>",
"is_flagged": true,
"is_answered": true,
"deleted_at": "<string>"
},
"updated_fields": [
"<string>"
],
"previous_values": {},
"meta": {
"trace_id": "<string>",
"span_id": "<string>",
"timestamp": "<string>",
"duration_ms": 1,
"team_sid": "<string>",
"actor_type": "<string>"
}
}Authorizations
Headers
Body
application/json
Request body of update_email_message.